in reply to Re: Parse error with subroutines and <
in thread Parse error with subroutines and <

Good call on the arity! The reason I didn't want to give them a () prototype is because I will find it convenient to call them like:
$enumClass->$enumName
sometimes. I was getting ready to respond, it occurred to me that -> notation ignores prototypes! Yay! I get the best of both words. I guess it helps to talk things out!

Thanks!

Ted Young

($$<<$$=>$$<=>$$<=$$>>$$) always returns 1. :-)

Replies are listed 'Best First'.
Re^3: Parse error with subroutines and <
by Fletch (Bishop) on Dec 14, 2007 at 20:17 UTC

    Just be careful you don't shadow one of your packages with a sub of the same name.

    use strict; use warnings; package Foo; sub bar { print "Foo::bar\n"; } package Bar; sub bar { print "Bar::bar\n"; } package main; sub Foo { "Bar" } Foo->bar(); "Foo"->bar(); exit 0; __END__

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Re^3: Parse error with subroutines and <
by ikegami (Patriarch) on Dec 14, 2007 at 21:35 UTC
    The problem isn't that you're missing the prototype. The problem is that you're missing parens. Omitting parens leads to a lot of problem. Simply put, omitting parens is broken. You must be prepared to add them when necessary.