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

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.
  • by djberg96 (2603) on 2004.12.05 9:36 (#36542) Journal
    What about lvalue subs? Say I want to do this:
    $obj->foo = $hash_ref;
    I want to make sure that the foo() method only accepts a hash. Would it be defined like this?
    sub foo : method(HASH $x){
       $x->{whatever} = 1;
    }
    I may have the syntax wrong - it's been a while since I played with lvalue subs. But, I think you see what I'm trying to do. Possible?
    • Argh! I hadn't even considered lvalue subs. I'll have to think about them. At the present time I don't see support for them being offered without someone being gracious enough to send a patch :) (after it gets to the CPAN, of course.)