Any criterias when $0 of a Perl script becomes null?
perl, process
Solution
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::);
}
Problem
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?