Why is all that stuff in import? That's wrong because it imposes the following two unnecessary restrictions:
The module must be loaded using use PatchPackages;. Using require PatchPackages; or use PatchPackages (); will not work, because import does not get executed in those circumstances.
use PatchPackages; can only appear once in your code. import is called every time use PatchPackages; is encountered.
Put the code at the top level (as in the following snippet) to fix those problems. It will only be executed once, and it will get executed no matter how the module is loaded.
package PatchPackages; use strict; use version; our $VERSION = qv/0.0.1/; require Scalar::Util; if (! Scalar::Util->can('refaddr')) { ... } 1;
In reply to Re: Patching a Package (Scalar::Util)
by ikegami
in thread Patching a Package (Scalar::Util)
by tall_man
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |