in reply to "possible typo" warnings in modules

almut, The main difference that I can best express to you about your two scripts is this:

When you are writing code and executing the warnme.pl script, the call to

my $val = $Some::Nonexistent::Pkg::variable;

tells Perl to find and use that pre-existing package and assign its value to $val .

When you are coding in the package warnme.pm, the call to

my $val = $Some::Nonexistent::Pkg::variable;

tells Perl to search for the pre-existing package, but if not found, CREATE the package and assign it to $val .

Now I am sure that I don't have it nailed down exactly, but in concept, I believe I am right.

A study of perlboot, perltoot, and perlobj will help distinguish the differences more clearly.

A look at ISA may shed some light on this, as well.

  • Comment on Re: "possible typo" warnings in modules

Replies are listed 'Best First'.
Re^2: "possible typo" warnings in modules
by diotalevi (Canon) on Feb 17, 2007 at 18:38 UTC

    You are wrong. They are both compiled identically. The statement my $val = $Some::Nonexistent::Pkg::variable does a lookup to the glob *Some::Nonexistent::Pkg::variable in both cases. As I said in my other node, the warning is disabled for modules.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊