git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Eliminate Scalar::Util usage from private-Error.pm

From
Randal L. Schwartz <merlyn@stonehenge.com>
Date
Jul 11, 2006, 01:38 UTC
Message-ID
<86bqrwncnq.fsf@blue.stonehenge.com>
In-Reply-To
<20060711005354.5911.62525.stgit@machine.or.cz>
>>>>> "Petr" == Petr Baudis <pasky@suse.cz> 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
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Previous: Petr BaudisNext: Randal L. Schwartz
Message 4 of 10 in “Perl gurus: why do we need Scalar::Util?”
  1. Johannes SchindelinJul 10, 2006
  2. Petr BaudisJul 10, 2006
  3. Eliminate Scalar::Util usage from private-Error.pmPetr Baudis, Jul 11, 2006
  4. Randal L. SchwartzJul 11, 2006
  5. Randal L. SchwartzJul 11, 2006
  6. Randal L. SchwartzJul 11, 2006
  7. Junio C HamanoJul 11, 2006
  8. Randal L. SchwartzJul 11, 2006
  9. Randal L. SchwartzJul 10, 2006
  10. Petr BaudisJul 10, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.