Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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
Replies are listed 'Best First'.
Re^2: Hope a subroutine will return undef by default
by hdb (Prior) 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 exploiting the Monastery: (13)
As of 2015-07-31 11:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (276 votes), past polls