Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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 rifling through the Monastery: (9)
As of 2015-07-31 07:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (275 votes), past polls