Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

line 192: die $err; [rt.cpan.org #120777] #55

Open
toddr opened this issue Sep 24, 2019 · 1 comment
Open

line 192: die $err; [rt.cpan.org #120777] #55

toddr opened this issue Sep 24, 2019 · 1 comment

Comments

@toddr
Copy link
Member

toddr commented Sep 24, 2019

Migrated from rt.cpan.org#120777 (status was 'new')

Requestors:

From [email protected] on 2017-03-28 14:58:27
:

Code starting at line 184 (Version 2.44):

       my @result = ();
       my $result;
       eval {
         $result = $expat->parse($arg);
       };
       my $err = $@;
       if ($err) {
         $expat->release;
         die $err;
       }

Perl guidelines discourage arbitrarily killing a process from within a 
utility library.  So I am reporting this issue as a bug.

Please excuse the peevishness:  I am frustrated that one of our 
production processes crashed because this code doesn't distinguish 
between an exception for unexpected data and a fatal error.  I expect 
any useful module to perform basic error handling.

Although I understand that I can wrap inside a a perl "try" (ie, eval):

 1. Error handling is not discussed in the documentation
 2. It's impractical to wrap every single method call "just to be safe"
 3. Forcing consumer code to distinguish between exceptions and errors
    violates the principle of encapsulation.

I notice [email protected] is listed as the original author.  (Error 
handling seems like a systemic weakness. :)  Notwithstanding, this code 
falls short of my expectations, which are established by the overall 
quality of other CPAN modules.  Either the code should be upgraded to 
current standards, or it should be designated as obsolete.  Either way, 
I am happy to contribute.  Please let me know.

Thanks for your attention, etc.

-- 

Jim Schueler
Software Developer
The NoCheck Group, LLC
Office: 248-865-3048
Fax: 248-799-1004
Support Line: 734-224-4066
____________
*NOTICE:*
This message (including any attachments) is confidential and may be 
privileged.
If you have received it by mistake please notify the sender by return 
e-mail and delete this message from your system. Any  nauthorized use or 
dissemination of this message in whole or in part is strictly 
prohibited. Please note that e-mails are susceptible to change.  oCheck 
Payment Service, LLC (including its group companies) shall not be liable 
for the improper or incomplete transmission of the information contained 
in this communication nor for any delay in its receipt or damage to your 
system.NoCheck Payment Service, LLC (including its group companies) does 
not guarantee that the integrity of this communication has been 
maintained nor that this communication is free of viruses, interceptions 
or interference.



@toddr
Copy link
Member Author

toddr commented Sep 24, 2019

It sounds like you're suggesting the documentation should clarify that parse might die. Patches are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant