http://qs321.pair.com?node_id=721975


in reply to Re^3: How do I pretend a reference isn't a reference
in thread How do I pretend a reference isn't a reference

It depends what sub _ is defined to be, at compile time :) Check my code in Re^2: How do I pretend a reference isn't a reference and you'll see that $foo WOULD contain an object there.

Replies are listed 'Best First'.
Re^5: How do I pretend a reference isn't a reference
by clinton (Priest) on Nov 06, 2008 at 14:37 UTC

    That's not what my code does, nor was I saying that $c was one thing at compile time and one at run time. This is what I do:

    # init the app sub _ { 'compile time '.@_}; my $compile = _(1); sub foo { _(1) }; # finished compiling, so redefine sub _ sub _ { 'run time '.@_}; # run the code my $run = foo(); print " $compile - $run\n" __END__ compile time 1 - run time 1
    UPDATE: Meant to reply to Re^5: How do I pretend a reference isn't a reference
Re^5: How do I pretend a reference isn't a reference
by Anonymous Monk on Nov 06, 2008 at 14:00 UTC
    No it doesnt.
    sub _ { 'compile time '.@_}; local *_ = sub { 'run time '.@_}; # the above is what your module/init code does my $c = _(1); die $c; __END__ run time 1 at - line 6.
    You were saying that $c is one thing at runtime, another at compile time. Its only something at runtime.