From: Randal L. Schwartz Date: Tue, 11 Jul 2006 01:38:49 GMT Subject: Re: [PATCH] Eliminate Scalar::Util usage from private-Error.pm Message-ID: <86bqrwncnq.fsf@blue.stonehenge.com> In-Reply-To: <20060711005354.5911.62525.stgit@machine.or.cz> >>>>> "Petr" == Petr Baudis writes: Petr> We used just the blessed() routine so steal it from Scalar/Util.pm. ;-) Petr> (Unfortunately, Scalar::Util is not bundled with older Perl versions.) Wow. That's sure the long way around for what I would use this for: sub blessed { my $item = shift; local $@; # don't kill an outer $@ ref $item and eval { $item->can('can') }; } We call it "doing the can-can". :) And this solution has the advantage that it doesn't pollute UNIVERSAL. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!