Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: sub Prototype Syntax

by eyepopslikeamosquito (Canon)
on Apr 07, 2012 at 04:59 UTC ( #963885=note: print w/ replies, xml ) Need Help??


in reply to sub Prototype Syntax

First, the code you posted has a syntax error in that you are missing a semi-colon after the first line below:

$template_string = $_[0] %internal = %{$_[1]};
There are also some stylistic oddities, such as using ALL CAPS for function names, calling the function with a leading &, and using prototypes (see next para), that caused me to pull a face -- though not errors they show dubious style IMHO.

Second, you probably shouldn't be using prototypes at all. For why not see:

This new 5.12 warning that you experienced is described in perl 5.12 perldelta (search for "prototype after"). It seems you can silence this warning by adding the line:

no warnings 'illegalproto';
after your "use warnings" line (I am assuming you are using strict and warnings). However, I doubt that blindly silencing this warning is a good idea because it is telling you that the prototype is invalid -- presumably because of the optional arguments after the '%' character (I don't use prototypes so I'm not certain of that). See perlsub for Perl prototype documentation. You can also make it go away by simply removing the prototype (recommended) or shortening it to just:
sub POPULATE_TEMPLATE($%) {


Comment on Re: sub Prototype Syntax
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (15)
As of 2014-12-19 18:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (91 votes), past polls