in reply to Patching a Package (Scalar::Util)

Why is all that stuff in import? That's wrong because it imposes the following two unnecessary restrictions:

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;