Overloading

james on 2002-05-16T15:35:05

So, I'm trying to overload the iterative operator: <>, which, according to the camel, is possible. However, I'm running into a slight problem:

my $data = <$obj>;

causes my iterator sub to be called once, in scalar context.

my @data = <$obj>;

causes my iterator sub to be called once, in scalar context.

ARRRRGG!

wantarray returns false no matter how I pervert my calling method, and I can't figure out why.


Overload style

Matts on 2002-05-16T18:36:14

How are you overloading? I sometimes find overload doing different things whether I give it a string (the name of my function) or a reference to it.

Re:Overload style

james on 2002-05-17T08:36:58

Hmm, passing it a reference to a sub, rather than an anon. I'll try an anonymous sub, but I've not got much hope at this point :-)

cheers for the tip though, will let you know how it works out.

James.