Surprisingly nobody has commented on this nice use of the goto Function
which exists only in Perl:
sub newFuctionName
{
#Doing the same stuff as always ...
}
sub oldFunctionName
{
goto &newFuctionName;
}
Which has the nice effect:
http://perldoc.perl.org/functions/goto.html
it exits the current subroutine (losing any changes set by local) and immediately calls in its place the named subroutine using the current value of @_ .
That way the Parameters won't be copied again when you go from oldFunctionName() to newFunctionName()
which is very useful when you use a Library in many Projects and by the time find that you should rename this Feature.
I also found this often in Modules as:
sub _internalImplementation
{
#Doing the job ...
}
sub exportFunctionName
{
goto &_internalImplementation;
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|