>>>>> "Mark" == Mark Fowler <[EMAIL PROTECTED]> writes:

Mark> On Mon, 9 Jun 2003, Tony Bowden wrote:
>> Well it's a core module now so it's probably not that much of an issue
>> just to make it a dependency.

Mark> Ha! I tried that argument with Andy with Test::More.

Mark> Seriously, the code isn't that hard:

Mark>   sub blessed ($) {
Mark>     local($@, $SIG{__DIE__}, $SIG{__WARN__});
Mark>     length(ref($_[0]))
Mark>       ? eval { $_[0]->a_sub_not_likely_to_be_here }
Mark>       : undef
Mark>   }

That's the hard way.  How about simply...

sub blessed {
  eval { shift->can("can") };
  return !$@;
}

If it can "can", then it's an object.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <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!

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to