Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Can I from within a module access variables from the calling program?

by HJO (Acolyte)
on Oct 25, 2012 at 12:47 UTC ( #1000855=note: print w/ replies, xml ) Need Help??


in reply to Re: Can I from within a module access variables from the calling program?
in thread Can I from within a module access variables from the calling program?

Hi,

Well thanks for your answer, I didn't understood it at first but now it get it ^^

I just have two "problems" with your answer, first I'm using Perl 5.8.8 and I'm not sure that your technique is compatible with this version since you're using Perl 5.10

Secondly, I would have prefered not to use another Module to do so

but thansk anyway, maybe your answer will help somebody else later


Comment on Re^2: Can I from within a module access variables from the calling program?
Re^3: Can I from within a module access variables from the calling program?
by tobyink (Abbot) on Oct 25, 2012 at 13:29 UTC

    The only 5.10-specific feature I used was say which is a new (well... five years old) keyword which works like print but automatically appends a new line.

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

      Oh indeed that's quite usefull. Thanks I think i'll be able to adapt this

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2014-08-30 02:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (291 votes), past polls