in reply to Re^5: Storable perl module error?
in thread Storable perl module error?

Thanks again for your response. I was running the script on the exact same server, just a different account (which has been deleted). I have three scripts similiar to the one below that run. The first two work properly but for some reason this one is giving me problems. Is there anyway to just rename the database/column that it is writing to instead of trying to add/update the current corrupted one?
package MT::Plugin::NetflixHistory; use strict; use MT::Template::Context; use LWP::UserAgent; use HTTP::Cookies; MT::Template::Context->add_container_tag('NetflixHistory', \&queue); MT::Template::Context->add_tag('NetflixHistoryURL', \&queue_info); MT::Template::Context->add_tag('NetflixHistoryImage', \&queue_info); MT::Template::Context->add_tag('NetflixHistoryTitle', \&queue_info); MT::Template::Context->add_tag('NetflixHistoryShipDate', \&queue_info) +; MT::Template::Context->add_tag('NetflixHistoryReturnDate', \&queue_inf +o); my $queue = 'http://www.netflix.com/RentalActivity'; sub queue { my($ctx, $args) = @_; my $session_id = $args->{session_id}; my $lastn = defined($args->{lastn})?$args->{lastn}:0; my $noparms = 0; if (!$lastn) { $noparms = 1; } my $jar = HTTP::Cookies->new; $jar->set_cookie(0, 'NetflixShopperId', $session_id, '/', '.netfli +x.com'); my $req = HTTP::Request->new(GET => $queue); $jar->add_cookie_header($req); my $ua = LWP::UserAgent->new; $ua->agent('NetflixWebServices/1.0'); my $res = $ua->request($req); return $ctx->error("HTTP error: " . $res->status_line) unless $res->is_success; my $builder = $ctx->stash('builder'); my $tokens = $ctx->stash('tokens'); my $c = $res->content; my $out = ''; $c =~ m!Returned</div>(.*?)</body>!sg; $c = $1; while ($c =~ m!"buf"(.*?)"brdr"></td>!sg) { my $rec = $1; my @rec = $rec =~ m!eid=(.*?)&trk!sg; my $url = "http://www.netflix.com/MovieDisplay?"."movieid=".$1 +; $rec[4] = "http://a408.g.akamai.net/f/408/1284/24h/image.netfl +ix.com/NetFlix_Assets/boxshots/small/".$1.".jpg"; $rec =~ m!jr=5">(.*?)</a>.*?ter>(.*?)</td>.*?ter>(.*?)</td>!sg +; my $title = $1; $rec[2] = $2; $rec[3] = $3; my $f = 0; if ($rec[3]) { if ($rec[3] eq "-") { $c =~ m!"buf"(.*?)ght=2></td>!sg; $rec = $1; $rec =~ m!on(.*?)\. <br>!sg; $rec[3] = $1; $f = 1; } } if ($f) {next;} if ($lastn || $noparms) { if ($title && $rec[2] && $rec[3] && $rec[4]) { my $entry = { title => $title, url => $url, shipdate => $r +ec[2], returndate => $rec[3], image => $rec[4]}; $ctx->stash('netflix_history_entry', $entry); defined(my $o = $builder->build($ctx, $tokens)) or return $ctx->error($builder->errstr); $out .= $o; if ($lastn){--$lastn;} } } } $out; } sub queue_info { my $n = $_[0]->stash('netflix_history_entry'); (my $tag = lc $_[0]->stash('tag')) =~ s!^netflixhistory!!; $n->{$tag}; } 1;
Thanks, John

Replies are listed 'Best First'.
Re^7: Storable perl module error?
by tkil (Monk) on Apr 27, 2004 at 22:36 UTC

    Uh. The code you post above seems like a total non-sequitor from what we were discussing earlier. I'm inferring that MT::PluginData::data is getting called from something in the above blob of code, but without grokking the entire system, I'm afraid I can't help you further.

    If you have direct access to the database, you might try deleting the relevant rows (or entries out of the BerkeleyDB, etc) to see if it just random corruption. But without a lot more info about the system (which I simply don't have time to learn!), I don't have much else to suggest.

    Good luck!