I am having a Perl script which internally uses dependent Perl modules from CPAN and my own project. I am using the $0
(process script name) attribute value in my script. Strangely, this value suddently becomes NULL after some dependent API calls. I am not using eval()
or system()
in my process. Just a regular top-down running script. Any idea what could be the reason for the vanishing of $0
value?
Tie::StdScalar to find out who changed $0
.
{
package Tie::Scalar::Croaker;
use Tie::Scalar qw( );
use Carp qw( confess );
our @ISA = qw( Tie::StdScalar );
sub FETCH { $0 }
sub STORE { confess('$0 changed'); }
tie($0, Tie::Scalar::Croaker::);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With