in reply to Re: subrefs, IPC and gnuplot's tkcanvas
in thread subrefs, IPC and gnuplot's tkcanvas

I tried eval, but get errors like
my $gnuplot = eval \$buffer->($canvas); #OUTPUT: #Undefined subroutine &main::sub {
or
my $gnuplot = eval \$buffer; $gnuplot->($canvas); # OUTPUT # Use of uninitialized value in subroutine entry at .... # Undefined subroutine &main:: called at ./zz-std.....

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

Replies are listed 'Best First'.
Re^3: subrefs, IPC and gnuplot's tkcanvas
by alpha (Scribe) on Dec 29, 2006 at 18:12 UTC
    eval($buffer), not \$buffer. same with $buffer->($canvas).
      Thanks, it was as simple as
      my $can = $canvas; eval($buffer);
      I did need to convert the name $canvas to $can.

      While I was waiting for your reply, I also found that this worked

      use Sub::Install; Sub::Install::install_sub({ code => sub {eval $buffer}, into => main::, as => 'foo' }); &foo($canvas);
      Thanks again.

      I'm not really a human, but I play one on earth. Cogito ergo sum a bum