This:
return $outputs->{ $call_key } if defined $outputs->{ $call_key
+};
$outputs->{ $call_key } = $self->$orig( @args );
return $outputs->{ $call_key };
Would be more concise like this:
return( $outputs->{$call_key} //= $self->$orig(@args) );
As it's the last line in the sub, you don't even need the return keyword. (And sub calls are slightly optimized if you leave it out.)
One thing to beware: get_method_list doesn't return a list of all methods — it doesn't include inherited methods. You could use get_all_methods (which retuns Moose::Meta::Method objects instead of a list of method names as strings, so you will need to do $_->name on each).
-
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.
|