in reply to Check if a package exists

Instead of checking for

defined %{ 'some::package::' }

... which has been deprecated for a long time and subsequently been removed, why not check whether there are any elements within the package?

perl -wle "package foo; sub unknown {}; package main; print for keys % +{ 'foo::' }"

In other words, keys %{ 'some::package' } should tell you whether a package exists, or rather, whether it contains any things of note (to Perl).

Update: perl56delta tells us:

defined(%hash) is deprecated

(D) defined() is not usually useful on hashes because it checks for an undefined scalar value. If you want to see if the hash is empty, just use if (%hash) { # not empty } for example.