Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Accessing a scalar value in another subroutine?

by LanX (Canon)
on Sep 23, 2012 at 19:50 UTC ( #995241=note: print w/ replies, xml ) Need Help??


in reply to Accessing a scalar value in another subroutine?

TIMTOWTDI

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


Comment on Re: Accessing a scalar value in another subroutine?
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://995241]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2014-09-23 20:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (241 votes), past polls