Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Unique testing problem

by little (Curate)
on May 24, 2003 at 10:33 UTC ( [id://260554]=note: print w/replies, xml ) Need Help??


in reply to Unique testing problem

... but, since the code calls exit(0); it never returns to the test program

So you better go along the lines of BazB's suggestion, as an exit would kill your mod_perl on a webserver. No need to fumble with exit here. Just just die and return reasonable stuff. See SIGDIE by Adam for an elaboration on that.

Have a nice day
All decision is left to your taste

Update
No need to have your own __DIE__ handler, just die for a good reason die "action failed .. some more elusive stuff" and the place where you call it should be able to interpet those comments on proper death. *smile*
keep it simple

Replies are listed 'Best First'.
Re^2: Unique testing problem
by adrianh (Chancellor) on May 24, 2003 at 11:19 UTC
    So you better go along the lines of BazB's suggestion, as an exit would kill your mod_perl on a webserver

    Nobody's mentioned mod_perl :-)

    Also, since perl 5.6, mod_perl overrides exit behind the scenes so it's often a non-issue.

    No need to fumble with exit here. Just just die and return reasonable stuff. See SIGDIE by Adam for an elaboration on that.

    I would not recommend using a __DIE__ handler in mod_perl code. It's global nature causes problems if you need to support multiple applications, virtual hosts, etc.

    Alternative Exception Handling Techniques in the mod_perl guide has more info on this.

    Personally, if there was the opportunity, I would probably try to refactor the code so that there were not multiple exit points for the program, rather than throwing exceptions into the mix. Multiple exit points are a Code Smell in my experience.

Log In?
Username:
Password:

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

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

    No recent polls found