Thank you.

-Sharad

-----Original Message-----
From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]
Sent: Monday, September 22, 2003 10:20 PM
To: Gupta, Sharad
Cc: [EMAIL PROTECTED]
Subject: Re: Silly question


On Sep 22, Gupta, Sharad said:

>               package Foo;
>               use overload q("") => sub {return shift->{bar}};
>               $s = bless{bar=>"hello"}, Foo;
>               print "$s\n"
>
>prints "hello".

Because you have overloaded "" for objects of class Foo.

>               package Foo;
>               use overload q("") => sub {return shift->{bar}};
>               $s = bless{bar=>"hello"},Foo;
>               $wilma = "how r u";
>               print "$wilma\n"
>
>prints "how r u".

Because you have overloaded "" for objects of class Foo, but there is no
object of class Foo in double quotes.

If you want to intercept ALL quoted strings, you'll need to use
overload::constant, but that becomes tricky business.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]

Reply via email to