How is Perl’s @INC constructed?

We will look at how the contents of this array are constructed and can be manipulated to affect where the Perl interpreter will find module files. Default @INC The Perl interpreter is compiled with a specific default value for @INC. To find this value, run the command env -i perl -V (env -i ignores the … Read more

export vs export_ok in perl

Let’s say I have a package MyPackage that uses @EXPORT. #this is MyPackage.pm package MyPackage; @EXPORT = qw(do_awesome_thing); sub do_awesome_thing { … } sub be_awesome { … } Now, when I use MyPackage in my code, #this is myscript.pl use MyPackage; do_awesome_thing(); #works be_awesome(); #doesn’t work MyPackage::be_awesome(); #works do_awesome_thing gets automatically exported to my code … Read more

ListUtil.c: loadable library and perl binaries are mismatched (got handshake key 0xdb00080, needed 0xdb80080)

This may happen when perl or perl modules are installed separately along side the official packages. Environment variable can be used to switch to a different perl installation. To find out if that is the case run: env | grep PERL Having PERL5LIB or PERL_LOCAL_LIB_ROOT in the output might cause the issue. Try unsetting the … Read more

What does “1;” mean in Perl?

1 at the end of a module means that the module returns true to use/require statements. It can be used to tell if module initialization is successful. Otherwise, use/require will fail. $somevar is a variable which is accessable only inside the block. It is used to simulate “static” variables. Starting from Perl 5.10 you can … Read more

tech