[Melbourne-pm] $0 behaviour

Alfie John alfiej at opera.com
Fri Jul 20 03:00:46 PDT 2012


Hey Matthew,

On Fri, Jul 20, 2012, at 01:17 PM, Mathew Robertson wrote:
> Ignoring the globals, this sets $0 to something useful for
> top/ps/pidof/killall.

I know it's not what you're asking, but have you thought about just
setting +x and running all scripts directly?

  # perl /tmp/test.pl
  # killall test.pl
  test.pl: no process found

  # /tmp/test.pl
  # killall test.pl
  Terminated

That way (unless you've abstracted all of the above), you don't need to
much boilerplate?

And if you're running scripts using their full pathnames, it could all
simplify down to:

  $0 = __FILE__;

Alfie

-- 
  Alfie John
  alfiej at opera.com


More information about the Melbourne-pm mailing list