Subject: | issues under mod_perl |
Hello,
Parse::PhoneNumber is not a mod_perl friendly module due to its error handling. Error currently
set not as a part of an object, but as a global, and there is no way currently to clear error after
it was set, so error persist during life of apache child.
there is simple solution, where we can just add clear_errstr function, which will clear $errstr
variable:
sub clear_errstr { $errstr = undef; }
and additional change is to modify $^W =1; to just "use warnings", because it is far from
optimal to include global warnings in your legacy application.
patch below will cover both of those issues.
thank you
Roman.
patch:
*** /u/DIST/www-dist/u/autobahn/CPAN/Parse/PhoneNumber.pm 2011-08-10
21:02:25.000000000 -0400
--- /u/autobahn/CPAN/Parse/PhoneNumber.pm 2011-09-08 19:17:28.000000000 -0400
***************
*** 1,7 ****
package Parse::PhoneNumber;
# $Id: PhoneNumber.pm,v 1.8 2005/10/31 16:42:04 twilde Exp $
use strict;
! $^W = 1;
use Carp;
--- 1,7 ----
package Parse::PhoneNumber;
# $Id: PhoneNumber.pm,v 1.8 2005/10/31 16:42:04 twilde Exp $
use strict;
! use warnings;
use Carp;
***************
*** 161,171 ****
{
my $errstr = undef;
sub errstr { $errstr = $_[1] if $_[1]; $errstr }
}
package Parse::PhoneNumber::Number;
use strict;
! $^W = 1;
=head2 Parse::PhoneNumber::Number Objects
--- 161,172 ----
{
my $errstr = undef;
sub errstr { $errstr = $_[1] if $_[1]; $errstr }
+ sub clear_errstr { $errstr = undef; }
}
package Parse::PhoneNumber::Number;
use strict;
! use warnings;
=head2 Parse::PhoneNumber::Number Objects