On Sun, Apr 28, 2002, Dan Kenigsberg wrote about "Re: OT: a short Perl question":
> Thanks to everyone who answered me on and off the list.
>
> print "standalone\n" if (!caller);
Interesting.
Dan, thanks for posting the answer you got here. I was interes
Thanks to everyone who answered me on and off the list.
print "standalone\n" if (!caller);
seems just what I've been looking for.
(comparing $0 to the script's name would also work most of the times.)
Dan.
=
To unsubscrib
On Sat, 27 Apr 2002, Dan Kenigsberg wrote:
> How can I tell, within a Perl script, whether it was executed from the command
> line, or use'd by another script?
you can only use a heuristics - use 'getppid()' to get the PID of the
parrent process. then use 'ps -o comm PID' to get its command lin