Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the HTTP-BrowserDetect CPAN distribution.

Report information
The Basics
Id: 8547
Status: resolved
Priority: 0/
Queue: HTTP-BrowserDetect

People
Owner: Nobody in particular
Requestors: steve [...] purkis.ca
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.98
Fixed in: (no value)



Subject: suppress spurios warnings
Hiya, I'm running into a small problem with the warning output of HTTP::BrowserDetect -- it's making the output of my test scripts difficult to read due to the number of warnings generated. This will also clutter up log files, and I'd rather avoid that if possible. For example, this program: use HTTP::BrowserDetect; my $ua = 'Internet Explorer 6 (MSIE 6; Windows XP)'; my $bd = HTTP::BrowserDetect->new; $bd->user_agent( $ua ); Produces these warnings: Use of uninitialized value in concatenation (.) or string at /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line 118. Argument "." isn't numeric in addition (+) at /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line 118. Use of uninitialized value in index at /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line 176. Use of uninitialized value in numeric eq (==) at /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line 185. Use of uninitialized value in numeric eq (==) at /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line 186. Use of uninitialized value in numeric ge (>=) at /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line 187. Use of uninitialized value in numeric eq (==) at /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line 188. Use of uninitialized value in numeric ge (>=) at /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line 189. Use of uninitialized value in numeric eq (==) at /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line 190. Use of uninitialized value in numeric ge (>=) at /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line 191. Use of uninitialized value in numeric eq (==) at /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line 192. Use of uninitialized value in string eq at /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line 370. Most of these can be avoided by making sure the vars are initialized -- see attached patch. hth, -Steve
diff -ru HTTP-BrowserDetect-0.98.orig/BrowserDetect.pm HTTP-BrowserDetect-0.98/BrowserDetect.pm --- HTTP-BrowserDetect-0.98.orig/BrowserDetect.pm Sun Nov 21 22:16:00 2004 +++ HTTP-BrowserDetect-0.98/BrowserDetect.pm Sun Nov 21 22:55:21 2004 @@ -7,7 +7,7 @@ @ISA = qw(Exporter); @EXPORT = qw(); @EXPORT_OK = qw(); -$VERSION = '0.98'; +$VERSION = '0.98_01'; # Operating Systems push @ALL_TESTS,(qw(win16 win3x win31 win95 win98 winnt windows win32 win2k winxp winme dotnet mac macosx mac68k macppc os2 unix sun sun4 sun5 suni86 irix irix5 irix6 hpux hpux9 hpux10 aix aix1 aix2 aix3 aix4 linux sco unixware mpras reliant dec sinix freebsd bsd vms x11 amiga)); @@ -115,7 +115,12 @@ } - $minor = 0+".$minor"; + # avoid spurious warnnings + $minor = 0 unless defined $minor; + $major = 0 unless defined $major; + $beta = '' unless defined $beta; + + $minor = 0 + "0.$minor"; $self->{tests} = {}; my $tests = $self->{tests}; @@ -161,7 +166,13 @@ ( [\d]* ) # Minor version nnumber is digits after first dot ( [^\s]* ) /x); - $minor = 0+".$minor"; + + # avoid spurious warnnings + $minor = 0 unless defined $minor; + $major = 0 unless defined $major; + $beta = '' unless defined $beta; + + $minor = 0 + "0.$minor"; #print "major=$major minor=$minor beta=$beta\n"; } Only in HTTP-BrowserDetect-0.98: BrowserDetect.pm~
From: fmerges [...] cpan.org
On Sun Nov 21 17:58:12 2004, guest wrote: Show quoted text
> Hiya, > > I'm running into a small problem with the warning output of > HTTP::BrowserDetect -- it's making the output of my test scripts > difficult to read due to the number of warnings generated. This > will also clutter up log files, and I'd rather avoid that if > possible. > > For example, this program: > > use HTTP::BrowserDetect; > my $ua = 'Internet Explorer 6 (MSIE 6; Windows XP)'; > my $bd = HTTP::BrowserDetect->new; > $bd->user_agent( $ua ); > > Produces these warnings: > > Use of uninitialized value in concatenation (.) or string at > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > 118. > Argument "." isn't numeric in addition (+) at > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > 118. > Use of uninitialized value in index at > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > 176. > Use of uninitialized value in numeric eq (==) at > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > 185. > Use of uninitialized value in numeric eq (==) at > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > 186. > Use of uninitialized value in numeric ge (>=) at > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > 187. > Use of uninitialized value in numeric eq (==) at > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > 188. > Use of uninitialized value in numeric ge (>=) at > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > 189. > Use of uninitialized value in numeric eq (==) at > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > 190. > Use of uninitialized value in numeric ge (>=) at > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > 191. > Use of uninitialized value in numeric eq (==) at > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > 192. > Use of uninitialized value in string eq at > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > 370. > > Most of these can be avoided by making sure the vars are initialized > -- see attached patch. > > hth, > -Steve
I came up with the same problems when passing in the UA string below: Links (2.1pre15; Linux 2.4.26-vc4 i586; x) Should need some refactoring... but anyway, good module.
On Tue Apr 18 17:29:12 2006, guest wrote: Show quoted text
> On Sun Nov 21 17:58:12 2004, guest wrote:
> > Hiya, > > > > I'm running into a small problem with the warning output of > > HTTP::BrowserDetect -- it's making the output of my test scripts > > difficult to read due to the number of warnings generated. This > > will also clutter up log files, and I'd rather avoid that if > > possible. > > > > For example, this program: > > > > use HTTP::BrowserDetect; > > my $ua = 'Internet Explorer 6 (MSIE 6; Windows XP)'; > > my $bd = HTTP::BrowserDetect->new; > > $bd->user_agent( $ua ); > > > > Produces these warnings: > > > > Use of uninitialized value in concatenation (.) or string at > > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > > 118. > > Argument "." isn't numeric in addition (+) at > > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > > 118. > > Use of uninitialized value in index at > > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > > 176. > > Use of uninitialized value in numeric eq (==) at > > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > > 185. > > Use of uninitialized value in numeric eq (==) at > > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > > 186. > > Use of uninitialized value in numeric ge (>=) at > > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > > 187. > > Use of uninitialized value in numeric eq (==) at > > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > > 188. > > Use of uninitialized value in numeric ge (>=) at > > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > > 189. > > Use of uninitialized value in numeric eq (==) at > > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > > 190. > > Use of uninitialized value in numeric ge (>=) at > > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > > 191. > > Use of uninitialized value in numeric eq (==) at > > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > > 192. > > Use of uninitialized value in string eq at > > /usr/local/lib/perl5/site_perl/5.8.4/HTTP/BrowserDetect.pm line > > 370. > > > > Most of these can be avoided by making sure the vars are initialized > > -- see attached patch. > > > > hth, > > -Steve
> > > I came up with the same problems when passing in the UA string below: > > Links (2.1pre15; Linux 2.4.26-vc4 i586; x) > > Should need some refactoring... but anyway, good module.
Hi, I'm a new co-maintainer of this module. Thanks for pointing this out. It appears to be fixed in the latest version, but I've added tests for these cases to 1.01, which will be on CPAN in the next day or so. Best, Olaf