How do I find the module dependencies of my Perl script?

Check out Module::ScanDeps and the “scandeps.pl” utility that comes with it. It can do a static (and recursive) analysis of your code for dependencies as well as the %INC dump either after compiling or running the program. Please note that the static source scanning always errs on the side of including too many dependencies. (It … Read more

Is there a need for a “use strict” Python compiler?

Well, I’m not much of a python programmer, but I’d say that the answer is ‘YES’. Any dynamic language that lets you create a variable with any name at any time, could use a ‘strict’ pragma. Strict vars (one of the options for strict in Perl, ‘use strict’ turns them all on at once) in … Read more

Perl – Subroutine redefined

Do you have a dependency loop? If Perl starts compiling your script and encounters a line like this: use PackageA; Perl pauses the compilation of your script; locates PackageA.pm and starts compiling it. If it encounters a line like this: use PackageB; Perl pauses the compilation of PackageA; locates PackageB.pm and starts compiling it. Normally, … Read more

How to run an anonymous function in Perl?

(sub { … }) will give you the pointer to the function so you must call by reference. (sub { print “Hello world\n” })->(); The other easy method, as pointed out by Blagovest Buyukliev would be to dereference the function pointer and call that using the { } operators &{ sub { print “Hello World” … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)