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

>> -----Original Message-----
>> From: Randal L. Schwartz [mailto:[EMAIL PROTECTED]
>> sub blessed {
>> eval { shift->can("can") };
>> return !$@;
>> }
>> 
>> If it can "can", then it's an object.

Mark> [We're going to lurch a bit off topic here...]

Mark> How come "1" can't can but "a" can?

Mark>   print "a: ",blessed("a"),"\n1: ",blessed("1"),"\n";

Mark> That kinda surprised me.

Ooops... forgot the other needed thing:

sub blessed {
  my $thing = shift;
  return 0 unless defined $thing and ref $thing;
  eval { $thing->can("can") };
  return !$@;
}

-- 
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