Why is this line of Perl code throwing a numeric gt warning? -


i have following conditional:

if ($self->path ne 'contact_us' && !grep { $status == $_ } 2, 3, 8) { 

and throwing warning:

use of uninitialized value in numeric gt (>)

of course, there's no numeric gt @ on surface. $self->path moose attribute accessor, under-the-hood magic coming that. can't see how making numeric gt comparison, since path defined follows:

has 'path' => (is => 'rw', isa => 'str'); 

any ideas on how warning getting thrown? i'm using perl v5.8.8 built i386-linux-thread-multi, if matters in case.

update: more mysteriously, i've rewritten conditional follows:

my $cond1 = $self->path ne 'contact_us'; $cond2 = !grep { $status == $_ } 2, 3, 8; if ($cond1 && $cond2) { 

and it's third line throws warning. carp::always's stack trace isn't sufficiently informative. further disclosure, i'm feeling utterly clueless now: base file fastcgi script being called apache's mod_fcgi.

last update: $status getting set call method found in module (my::session). here line generating warning in module's method (note errant >):

my $disputes => dbh('b')->selectrow_hashref($query); 

what's confusing me why warning didn't reference module containing offending line (it referenced module making method call, my::page). here's full output carp::always; there utter lack of mention of my::session:

[wed feb 23 17:44:29 2011] [warn] [client ---.---.94.159] mod_fcgid: stderr: use of uninitialized value in numeric gt (>) @ /path/to/my/page.pm line 65, referer: https://testserver.domain.tld/help

[wed feb 23 17:44:29 2011] [warn] [client ---.---.94.159] mod_fcgid: stderr: \tpage::build('my::page::help=hash(0xa7ce788)', 'hash(0xa327904)') called @ /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/class/mop/method.pm line 123, referer: https://testserver.domain.tld/help

[wed feb 23 17:44:29 2011] [warn] [client ---.---.94.159] mod_fcgid: stderr: \tclass::mop::method::execute('moose::meta::method=hash(0x9fa357c)', 'my::page::help=hash(0xa7ce788)', 'hash(0xa327904)') called @ /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/moose/object.pm line 57, referer: https://testserver.domain.tld/help

[wed feb 23 17:44:29 2011] [warn] [client ---.---.94.159] mod_fcgid: stderr: \tmoose::object::bui, referer: https://testserver.domain.tld/help

[wed feb 23 17:44:29 2011] [warn] [client ---.---.94.159] mod_fcgid: stderr: ldall('my::page::help=hash(0xa7ce788)', 'hash(0xa327904)') called @ /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/moose/meta/class.pm line 278, referer: https://testserver.domain.tld/help

[wed feb 23 17:44:29 2011] [warn] [client ---.---.94.159] mod_fcgid: stderr: \tmoose::meta::class::new_object('class::mop::class::anon::serial::1=hash(0xa3397c8)', 'hash(0xa327904)') called @ /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/moose/object.pm line 26, referer: https://testserver.domain.tld/help

[wed feb 23 17:44:29 2011] [warn] [client ---.---.94.159] mod_fcgid: stderr: \tmoose::object::new('my::page::help', 'hash(0xa339d38)') called @ generated method (unknown origin) line 3, referer: https://testserver.domain.tld/help

[wed feb 23 17:44:29 2011] [warn] [client ---.---.94.159] mod_fcgid: stderr: \tmy::page::new('my::page::suppo, referer: https://testserver.domain.tld/help

[wed feb 23 17:44:29 2011] [warn] [client ---.---.94.159] mod_fcgid: stderr: rt', 'hash(0xa339d38)') called @ /path/to/my.pm line 44, referer: https://testserver.domain.tld/help

[wed feb 23 17:44:29 2011] [warn] [client ---.---.94.159] mod_fcgid: stderr: \tmy::start() called @ index.fcgi line 9, referer: https://testserver.domain.tld/help

my guess 1 of arguments overloaded object, , overloading throwing error. check see arguments are:

print "$_: ", ref, $/ $self, $self->path, $status; 

which should print like:

hash(0x12341234)=self::object: self::object some/path: 4: 

if instead getting:

hash(0x12341234)=self::object: self::object some/path: some::object 4: some::other::object 

then should @ each of packages see if there overloading present.

you can write bool function force value non-overloaded bool:

sub bool {$_[0] ? 1 : 0} 

and then:

my $cond1 = bool $self->path ne 'contact_us'; $cond2 = bool !grep { $status == $_ } 2, 3, 8; if ($cond1 && $cond2) { 

if fixes problem, chances @ least 1 of arguments overloaded object misbehaving.

this possibly caused 1 of autoboxing pragmas use bigint; or use bignum; convert literal numbers 2, 3, 8 overloaded objects. pragmas in effect?


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -