in reply to Bug in Devel::Size?

On cygwin 1.5.21-2 with perl 5.8.7 I get a parse error on the second variation...(which seems normal given the lonely doublequote at the end of the eval no??) Devel::Size is 0.59 which seems to be old (latest is 0.63)

UPDATE: with the modification indicated by shmem, I get the same result in both cases. latest version of Devel::Size is 0.64 (not 0.63) so the problem could also come from there

% stephan@armen (/home/stephan) % % perl -MDevel::Size -e 'print $Devel::Size::VERSION' 0.59 % stephan@armen (/home/stephan) % % ./devel_size_test.px Devel::Size: Calculated sizes for CVs are incomplete 108 Devel::Size: Calculated sizes for CVs are incomplete 108 sub2 args('main','./devel_size_test.px','19','main::__ANON__','1','',' +','','2','UUUUUUUUUUUU') Hullo, monkses! sub1 args('main','./devel_size_test.px','20','main::__ANON__','1','',' +','','2','UUUUUUUUUUUU') Howdy, world! % stephan@armen (/home/stephan) % % ./devel_size_test2.px Warning: Use of "require" without parentheses is ambiguous at (eval 1) + line 1. String found where operator expected at (eval 1) line 1, at end of lin +e Can't find string terminator '"' anywhere before EOF at (eval 1) line +1. % stephan@armen (/home/stephan) % % diff devel_size_test@(|2).px 2d1 < 7,10c6,8 < my $file = shift; < my $sub = \eval "package ".caller()."; require \"$file\""; < my $foo = sub { goto $$sub }; < $foo; --- > my $sub = \eval 'package '.caller().'; require '.shift(@_).'"'; > die $@ if $@; > sub { goto $$sub }; 21d18 <
hth --stephan

Replies are listed 'Best First'.
Re^2: Bug in Devel::Size?
by shmem (Chancellor) on Dec 22, 2006 at 13:41 UTC
    Oops... that line should be
    my $sub = \eval 'package '.caller().'; require "'.shift(@_).'"';

    of course, since the file name must be quoted... fixed in root node.

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}