Closed mik2 closed 3 years ago
It is a common trick to use a module also as a script by checking caller() to be false in scalar context. Such a script when packaged with PAR will behave as a module because caller() will return PAR, which is different from running the script without packaging.
Don't do that then. Just pack a oneliner instead of the original script-or-module.
It is a common trick to use a module also as a script by checking
caller()
to be false in scalar context. Such a script when packaged with PAR will behave as a module becausecaller()
will returnPAR
, which is different from running the script without packaging. A workaround is to testcaller()
to be empty orPAR
, but this requires modification of the original script. A method used inCall::From
could be used to fake the script as being run in top level (so thatcaller()
returns an empty string).