Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^11: Class::DBI::AbstractSearch and SpeedyCGI

by zigdon (Deacon)
on Oct 05, 2005 at 11:45 UTC ( [id://497559]=note: print w/replies, xml ) Need Help??


in reply to Re^10: Class::DBI::AbstractSearch and SpeedyCGI
in thread Class::DBI::AbstractSearch and SpeedyCGI

The code is exactly the same, afaict. Here's the relevant code (note, it's ugly, most of it written before I know much perl).
script.pl: opendir(DIR, $MyApp::Conf::SUBMITROOT) or die "Can't read dir: $!"; foreach (grep /^\d+(?:-\d+)?\.\d+$|^[\-\w]+\.\d+(?:\.jpg)?$|^set\.\d ++(?:-\d+)?\.\d+\.jpg$/, readdir DIR) { $h = {}; $h->{File} = $_; if (/^(\d+(?:-\d+)?)\.(\d+)$/) { ... } elsif (/^set\.(\d+(-\d+)?).(\d+)\.jpg$/) { # this is the case we +'re hitting $h->{Set} = $1; $h->{Set} .= "-1" unless $2; $h->{Timestamp} = $3; $h->{Pic} = 1; my $curpic = $db->GetSetPictures({SetID => $h->{Set}, PicID => 0 +}); $h->{New} = not keys %$curpic; } else { warn "Unknown file: $_"; next; } ---- in the $db object: sub GetSetPictures { my $self = shift; my ($param) = @_; croak "Bad params" unless exists $param->{SetID}; $param->{Self} = "/inv/sets/$param->{SetID}" unless exists $param->{ +Self}; my ($setinfo) = $self->GetSetInfo({Set => $param->{SetID}}); ... sub GetSetInfo { my $self = shift; my ($param) = @_; my %where; if (exists $param->{Set}) { if ($param->{Set} eq '*') { ... } else { if ($param->{Set} =~ /-\d/) { $where{ID} = $param->{Set}; # this is our case in all 3 itera +tions } else { ... } } } else { ... } my @res = MyApp::Sets->search_where(%where); # Class::DBI object wi +th the AbstractSearch plugin ...

-- zigdon

Replies are listed 'Best First'.
Re^12: Class::DBI::AbstractSearch and SpeedyCGI
by perrin (Chancellor) on Oct 05, 2005 at 14:18 UTC
    I don't see anything in this code that would explain it. I think you should try putting in some warn statements to show the value of wantarray() inside those subs, and then use the debugger to figure out exactly where that array ref changes.
      This is still driving me crazy. That one script stopped breaking (I couldn't tell you why), and another started. It (currently) breaks consistantly when I try to run it:
      $ perl ./hist2rss.pl hist2rss.pl: Attempt to free unreferenced scalar: SV 0x87edcb4 at /hom +e/user/lib/modules/Class/DBI.pm line 1127. hist2rss.pl: Attempt to free unreferenced scalar: SV 0x87e55bc at /hom +e/user/lib/modules/Class/DBI.pm line 1127. <h1>Software error:</h1> <pre>MyApp::Sets can't SELECT id, id, setnumber, setrev, name, theme, +year, pcs, figs, picture, msrp, instructions, inventory FROM SETS WHERE ( ID = ? ) : Not an ARRAY reference at /home/user/lib/modules/Class/DBI.pm line 1 +126. at /home/user/lib/modules/Class/DBI/AbstractSearch.pm line 32
      Ok, great, I say - I'll run it under the debugger, awesome. Well, not so much - I'm running it in the debugger, and just telling it to continue:
      $ perl -d ./hist2rss.pl Loading DB routines from perl5db.pl version 1.23 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(./hist2rss.pl:15): my $db = new MyApp::DB; DB<1> c hist2rss.pl: Attempt to free unreferenced scalar: SV 0x88044c0 at /hom +e/user/lib/modules/Class/DBI.pm line 1127. hist2rss.pl: Attempt to free unreferenced scalar: SV 0x8c47508 at /hom +e/user/lib/modules/Class/DBI.pm line 1127. hist2rss.pl: Attempt to free unreferenced scalar: SV 0x8c62818 at /hom +e/user/lib/modules/Class/DBI.pm line 1127. hist2rss.pl: Attempt to free unreferenced scalar: SV 0x8c62174 at /hom +e/user/lib/modules/Class/DBI.pm line 1127. hist2rss.pl: Attempt to free unreferenced scalar: SV 0x8c629f8 at /hom +e/user/lib/modules/Class/DBI.pm line 1127. hist2rss.pl: Attempt to free unreferenced scalar: SV 0x8c62b00 at /hom +e/user/lib/modules/Class/DBI.pm line 1127. hist2rss.pl: Attempt to free unreferenced scalar: SV 0x8c650d8 at /hom +e/user/lib/modules/Class/DBI.pm line 1127. hist2rss.pl: Attempt to free unreferenced scalar: SV 0x8c65294 at /hom +e/user/lib/modules/Class/DBI.pm line 1127. hist2rss.pl: Attempt to free unreferenced scalar: SV 0x8c65c6c at /hom +e/user/lib/modules/Class/DBI.pm line 1127. hist2rss.pl: Attempt to free unreferenced scalar: SV 0x8c66c24 at /hom +e/user/lib/modules/Class/DBI.pm line 1127. hist2rss.pl: Attempt to free unreferenced scalar: SV 0x8c65ec4 at /hom +e/user/lib/modules/Class/DBI.pm line 1127. Debugged program terminated. Use q to quit or R to restart, use O inhibit_exit to avoid stopping after program termination, h q, h R or h O to get additional info. DB<1> exit
      And it just completes it's run without any error. What's the deal? Why would it NOT break under the debugger, without me doing anything?

      -- zigdon

        There sometimes are bugs that don't show up when run under the debugger. These are very rare, and are a side-effect of the way the debugger instruments the code.

        However, what's all this unreferenced scalar junk? This is making me think you have something wrong at a deeper level, and should consider recompiling your perl and DBI/DBD modules.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://497559]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-23 16:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found