in reply to RE: Re: How Does Interpolation Work? (CMonster: method call eval)
in thread How Does Interpolation Work?

Thanks for the example, CMonster, but I don't get it to work on my machine (ActiveState 5.005_03).

I get:

Warning: Use of "caller" without parens is ambiguous at C:\... line 11. syntax error at C:\... line 29, near "use Eval =>"

So I change from:

use Eval => :;

to:

use Eval ( ':');

at line 29.

Then I get:

Modification of a read-only value attempted at Eval.pm line 17

and that one I just don't know what to do about. I tried to change

my $self = \'fake'

to:

my $self = {}

at line 16, but that didn't help.

/jeorgen

Replies are listed 'Best First'.
RE: RE: RE: Re: How Does Interpolation Work? (CMonster: method call eval)
by chromatic (Archbishop) on Jul 23, 2000 at 08:02 UTC
    I had to make the following changes:
    • Add a $ to the typeglob line: *{$caller . '::' . $name} = \%magical_hash;
    • Do a two-step reference creation in TIEHASH():
      my $self = 'fake'; $self = \$self;
    • Use a more standard use statement: use Eval (':');
    It won't run under strict, though, with the symbolic reference in the import() bit.