Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Hope a subroutine will return undef by default

by Anonymous Monk
on Feb 11, 2014 at 16:37 UTC ( #1074443=note: print w/ replies, xml ) Need Help??


in reply to Hope a subroutine will return undef by default

With sub rewriting, via attributes at least, you could arrange the sub to return undef: http://perltv.org/v/code-attributes presentation about code attributes by Steve B (video; via https://twitter.com/PerlWeekly). (Blame PerlMonks for links being just dead text.)


Comment on Re: Hope a subroutine will return undef by default
Re^2: Hope a subroutine will return undef by default
by hdb (Parson) on Feb 11, 2014 at 16:39 UTC

    Put your links into square brackets and they become alive...

      I did that first, with variations; got "Permission denied ... [Tt]ough beans". >-/

Re^2: Hope a subroutine will return undef by default
by qj1020 (Initiate) on Feb 11, 2014 at 17:23 UTC

    Thanks to you all for replying and giving me some thoughts. Will check out the link of the youtube video when I get more time.

    Here is more of the context: the subroutines (in the form of strings) was sent to my server on the fly for execution by a function under my control. I wish I can go and change the source of the subroutines to add an explicit "return undef" (the function is executed on my side in scalar context, so it's ok) but I can't. I am thinking of modifying the incoming subroutines, if it doesn't have a "return undef" before the ending of the subroutine, I will add one. But it's not elegant.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (13)
As of 2014-07-30 14:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (234 votes), past polls