in reply to Re^2: Finding out whether a module contains a certain package
in thread Finding out whether a module contains a certain package
without any package statement, or even:sub Abc::foo { ... } sub Abc::bar { ... }
I think you can forget about catching all possible cases.BEGIN { my $package = ... Complicated expression ...; eval <<"EOT" package ${package}; sub foo { ... } sub bar { ... } EOT }
Considering that the majority of the people will write package Abc; near the top of the file, and all you seem to want is earlier program termination, why not perform a check that will catch the majority of the error, and let the few cases where 1) the author doesn't use "package Abc", and 2) the author miscapitalizes the package name, and 3) the author uses a case insensitive file system die sometime later (due to missing subroutines)?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Finding out whether a module contains a certain package
by rovf (Priest) on May 04, 2009 at 14:38 UTC |