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:
Low/Low

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

BugTracker
Severity:
Normal
Broken in:
0.98
Fixed in:
(no value)

Attachments
HTTP-BrowserDetect-0.98-warnings.patch



MIME-Version: 1.0
X-Mailer: MIME-tools 5.411 (Entity 5.404)
Subject: suppress spurios warnings
Content-Type: multipart/mixed; boundary="----------=_1101077891-16755-0"
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
Content-Length: 2040
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
Content-Type: application/octet-stream; name="HTTP-BrowserDetect-0.98-warnings.patch"
Content-Disposition: inline; filename="HTTP-BrowserDetect-0.98-warnings.patch"
Content-Transfer-Encoding: base64
Content-Length: 1942
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~
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Message-Id: <rt-3.5.HEAD-13598-1145395752-1735.8547-0-0@rt.cpan.org>
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: binary
From: fmerges@cpan.org
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 2464
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.
MIME-Version: 1.0
In-Reply-To: <rt-3.5.HEAD-13598-1145395752-1735.8547-0-0@rt.cpan.org>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Charset: utf8
References: <rt-3.5.HEAD-13598-1145395752-1735.8547-0-0@rt.cpan.org>
Content-Type: text/plain
Message-ID: <rt-3.6.HEAD-3617-1256013397-1622.8547-0-0@rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 2869
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


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.