Any criteria when a $ 0 Perl script becomes null?

I have a Perl script that internally uses Perl dependent modules from CPAN and my own project. I am using the attribute value $0 (process script name) in my script. Oddly enough, this suddently value becomes NULL after some dependent API calls. I do not use eval() or system() in my process. Just a normal top-down script. Any idea what could be causing $0 disappear?

+6
source share
1 answer

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::); } 
+9
source

Source: https://habr.com/ru/post/950901/


All Articles