Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: Parse error with subroutines and <

by TedYoung (Deacon)
on Dec 14, 2007 at 20:02 UTC ( [id://657103]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://657103]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-19 07:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found