Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

notation of a sub.

by jbrugger (Parson)
on Jul 19, 2005 at 04:41 UTC ( #475964=perlquestion: print w/replies, xml ) Need Help??

jbrugger has asked for the wisdom of the Perl Monks concerning the following question:

Hi fellow monks,
Recently i'm playing with catalyst and came to the following notation of a sub, that i've never seen:
sub default : Private { ... or: sub show : Regex('^(\w+)\.html$') {
Now i can guess what Private or Regex means ;-) but i don't understand the notation, a sub named default or show and than a : as delimiter to what?

Can anyone please explain?
Thanks

"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.

Replies are listed 'Best First'.
Re: notation of a sub.
by Zaxo (Archbishop) on Jul 19, 2005 at 04:48 UTC
      Well, I read the pointed documentation but still can't figure out how does it works. Any thoughs?


      Igor S. Lopes - izut
      surrender to perl. your code, your rules.
Re: notation of a sub.
by CountZero (Bishop) on Jul 19, 2005 at 06:21 UTC
    Catalyst needs those attributes to decide which sub to call when it parses the URL. You can see it working very nicely if you run the included your_app_server.pl script. In its debug-output you see it building your packages and subs linked to the URLs it understands.

    Very nice application this Catalyst. Pity only the docs are not (yet) up to standard.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://475964]
Approved by Old_Gray_Bear
Front-paged by Tanktalus
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2019-10-18 21:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?