Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^4: [SOLVED] Return statement in subroutine(s) is necessary when not returning anything?

by Preceptor (Deacon)
on Nov 06, 2015 at 12:05 UTC ( [id://1147089]=note: print w/replies, xml ) Need Help??


in reply to Re^3: [SOLVED] Return statement in subroutine(s) is necessary when not returning anything?
in thread [SOLVED] Return statement in subroutine(s) is necessary when not returning anything?

Indeed.

But my point was just because a lot of people do something, really doesn't have any bearing on it being a good - or bad - practice. Argumentum ad populum

Especially in perl, which lets you get away with all sorts of horrific nastiness for extended periods of time.

  • Comment on Re^4: [SOLVED] Return statement in subroutine(s) is necessary when not returning anything?

Replies are listed 'Best First'.
Re^5: [SOLVED] Return statement in subroutine(s) is necessary when not returning anything?
by ikegami (Patriarch) on Nov 06, 2015 at 18:55 UTC

    I didn't say "lot of module use the practice"; I said "lots of that modules that work perfectly fine use the practice". When the argument against the practice is that cause things to malfunction, this isn't argumentum ad populum.

Re^5: [SOLVED] Return statement in subroutine(s) is necessary when not returning anything?
by Your Mother (Archbishop) on Nov 06, 2015 at 13:28 UTC

    The opposite is also true. Just because something is rarely used doesn't make it a good practice. Nearly no one really means just that. You can argue that nearly every single author on CPAN writes shoddy code 100% of the time but I don't think the argument has much traction. :P

    Returning to the OP and the theme at hand. Printing from subroutines is a poor practice. They should return data for the controller (program flow) to use. Printing from a sub breaks its extensibility, limits its usefulness, and encourages code duplication (by avoiding view/template practices and making things impossible to reuse as is).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-25 20:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found