Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 surveying the Monastery: (9)
As of 2014-09-19 07:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (133 votes), past polls