RE: [tcltk-perl] Drop listify [PATCH]
Brought to you by:
hobbs
From: Konovalov, V. <vko...@sp...> - 2004-04-15 05:36:36
|
> OK, I think the real problem was the bit of code at the end of > 'call' that conflicted with Tcl.xs:prepare_Tcl_result() which > handled the G_SCALAR / G_ARRAY diffs already. I think the > following patch is appropriate, and it works with a call.t that > I just checked into CVS. Please comment on this, as I am not > certain that I'm not breaking some perl basic assumptions here. I see new code as good improvements of elder one. However I have few ideas to this bit of code, and I have them implemented in my local machine: 1. it could be reasonable to sometimes make reverse subtitution of parameters after getting result of Tcl calculation. May be in subroutine with slightly different name (wcall?) it is needed for, say, $widget->cget('-textvariable') to return a reference scalar and not a name like _SCALAR_0xXXXXXX Very correct way is not obvious to me, but half-correct way is to create another wrapper layer subroutine wcall that will search content of $res (and @res?) in %anon_refs hash. 2. I see it very useful for DEBUGging purposes to have a possibility to track what exactly list passed to "icall" and what returned from it. This helps in developing perlTk compatibility subroutines... > > Index: Tcl.pm > =================================================================== > RCS file: /cvsroot/tcltkce/Tcl/Tcl.pm,v > retrieving revision 1.9 > diff -u -r1.9 Tcl.pm > --- Tcl.pm 12 Apr 2004 23:09:56 -0000 1.9 > +++ Tcl.pm 14 Apr 2004 18:33:09 -0000 > @@ -395,15 +395,23 @@ > } > } > } > - my (@res,$res); > - eval { > - @res = $interp->icall(@args); > - }; > - if ($@) { > - confess "Tcl error $@ while invoking call\n \"@args\""; > + if (wantarray) { > + my @res; > + eval { @res = $interp->icall(@args); }; > + if ($@) { > + confess "Tcl error '$@' while invoking array > result call:\n" . > + "\t\"@args\""; > + } > + return @res; > + } else { > + my $res; > + eval { $res = $interp->icall(@args); }; > + if ($@) { > + confess "Tcl error '$@' while invoking scalar > result call:\n" . > + "\t\"@args\""; > + } > + return $res; > } > - return @res if wantarray; > - return $res[0]; > } > > > Jeff > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Tcltk-perl mailing list > Tcl...@li... > https://lists.sourceforge.net/lists/listinfo/tcltk-perl > |