Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Just before subroutine returns (depends)

by Anonymous Monk
on Aug 29, 2017 at 16:11 UTC ( [id://1198274]=note: print w/replies, xml ) Need Help??


in reply to Re: Just before subroutine returns (depends)
in thread Just before subroutine returns

The fourth category is those of us who are just glad we don't have to read the OP's code. This one sub has so many returns that he can't just put a log statement in front of each of them? Yikes!
  • Comment on Re^2: Just before subroutine returns (depends)

Replies are listed 'Best First'.
Re^3: Just before subroutine returns (depends)
by GrandFather (Saint) on Aug 29, 2017 at 21:03 UTC

    Log statement for each of many returns or log statement for each of many execution branches comes to the same number of log statements if you are trying to determine execution sequence as is implied by OP's question. So there is no "logging" advantage to multiple returns here, and there are vast opportunities to make the flow of code clearer by using early exits.

    Multiply nested conditional code blocks and loops with a single exit: Yikes! (throws up hands and runs away).

    Premature optimization is the root of all job security
Re^3: Just before subroutine returns (archive)
by LanX (Saint) on Aug 29, 2017 at 16:17 UTC
    We - or at least me - don't answer for the OP but for the archive.

    There are many possible cases where one needs to monitor subs, like e.g. needing to maintain foreign code and needing to figure out the intended mechanics.

    And PM is not Stack-Overflow, our strength is to have deep discussions not just singular case recipes.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

Re^3: Just before subroutine returns (depends)
by iguanodon (Priest) on Aug 29, 2017 at 17:22 UTC
    Maybe the OP didn't write the code, just inherited it.

Log In?
Username:
Password:

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

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

    No recent polls found