Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

james (1129)

james
  (email not shown publicly)
http://whoot.org/

...

Journal of james (1129)

Thursday May 16, 2002
10:35 AM

Overloading

[ #4963 ]

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.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Overload style (Score:3, Informative)

    by Matts (1087) on 2002.05.16 13:36 (#8476) Journal
    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.
    • 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.