Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Module caller

by marinersk (Priest)
on May 06, 2015 at 17:47 UTC ( [id://1125874]=note: print w/replies, xml ) Need Help??


in reply to Re: Module caller
in thread Module caller

I should think Findbinand $0 would be more helpful in figuring out how the script was called, but I don't see how it can help find who called the Module.

Can you post an example?

Replies are listed 'Best First'.
Re^3: Module caller
by suaveant (Parson) on May 07, 2015 at 15:05 UTC
    You said the name of the script calling the module, so I'd assumed you meant the actual script being run. If you mean what file the use or require was called from then no, FindBin and $0 won't help in that case.

                    - Ant
                    - Some of my best work - (1 2 3)

Re^3: Module caller
by RonW (Parson) on May 06, 2015 at 21:16 UTC
      #!/usr/bin/env perl # File is named zeroTest.pl. $0 = "Oh, sure, why not?"; print $0, $/;
      moo@cow[27]~>zeroTest.pl Oh, sure, why not?

      :P

        #!perl -w $0 = 'Oh, sure, why not?'; sleep 5; print $0;
        > perl zeroTest.pl & > ps PID PPID TTY UID STIME COMMAND 35401 3400 pty0 101 19:45:35 Oh, sure, why no 35402 3400 pty0 101 19:45:37 /usr/bin/ps > Oh, sure, why not?

        (16 character limit exceded)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2024-04-19 07:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found