git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: merlyn@stonehenge.com (Randal L. Schwartz)
To: Petr Baudis <pasky@suse.cz>
Cc: Junio C Hamano <junkio@cox.net>, <git@vger.kernel.org>
Subject: Re: [PATCH] Eliminate Scalar::Util usage from private-Error.pm
Date: 10 Jul 2006 18:38:49 -0700	[thread overview]
Message-ID: <86bqrwncnq.fsf@blue.stonehenge.com> (raw)
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!

  reply	other threads:[~2006-07-11  1:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-10 11:44 Perl gurus: why do we need Scalar::Util? Johannes Schindelin
2006-07-10 13:00 ` Petr Baudis
2006-07-11  0:53   ` [PATCH] Eliminate Scalar::Util usage from private-Error.pm Petr Baudis
2006-07-11  1:38     ` Randal L. Schwartz [this message]
2006-07-11  1:40       ` Randal L. Schwartz
2006-07-11  1:42         ` Randal L. Schwartz
2006-07-11  1:57     ` Junio C Hamano
2006-07-11  3:38       ` Randal L. Schwartz
2006-07-10 13:28 ` Perl gurus: why do we need Scalar::Util? Randal L. Schwartz
2006-07-10 14:29   ` Petr Baudis
  -- strict thread matches above, loose matches on Subject: below --
2006-07-25 16:10 Git.xs problem, was Re: [PATCH] cvsserver: avoid warning about active db handles Johannes Schindelin
2006-07-26  1:03 ` [PATCH] Eliminate Scalar::Util usage from private-Error.pm Petr Baudis
2006-07-26  2:01   ` Johannes Schindelin
2006-07-26  2:03     ` Johannes Schindelin
2006-07-26  2:11       ` Petr Baudis
2006-07-26  2:26         ` Johannes Schindelin
2006-07-26  2:10     ` Petr Baudis
2006-07-26  2:25       ` Johannes Schindelin
2006-07-26 13:35         ` Jakub Narebski
2006-07-26 15:17           ` Johannes Schindelin
2006-07-26 17:59             ` Luben Tuikov
2006-07-27 12:47             ` Randal L. Schwartz
2006-07-27 14:00               ` Johannes Schindelin
2006-07-27 14:22                 ` Randal L. Schwartz
2006-07-27 14:32                   ` Johannes Schindelin
2006-07-26 21:34         ` Petr Baudis
     [not found]   ` <7vhd15cfaj.fsf@assigned-by-dhcp.cox.net>
2006-07-26  2:15     ` Petr Baudis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86bqrwncnq.fsf@blue.stonehenge.com \
    --to=merlyn@stonehenge.com \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=pasky@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).