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)