DB<114> sub doc { return } => 0 DB<115> sub tst { doc q/blab bla bla/; return "tst" } => 0 DB<116> use B::Deparse => 0 DB<117> print B::Deparse->new()->coderef2text(\&tst) { doc('blab bla bla'); return 'tst'; }
The book Perl Hacks showed another approach, I can't recall the details, IIRC something with attributes which assign a text to a hash with subnames as keys.
Cheers Rolf
In reply to Re: Accessing a scalar value in another subroutine?
by LanX
in thread Accessing a scalar value in another subroutine?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |