I am running a Movable Type blog and everytime one of my pages is called
the following lines show up in my error_log. Does anybody know why this is
happening or how to fix it? I've looked everywhere and can't find any
answers. I'm running Freebsd 4.7 with Perl 5.6.1 and have tried
recompiling the Storable perl module as well.

Corrupted storable string (binary v2.4) at blib/lib/Storable.pm (autosplit
into blib/lib/auto/Storable/thaw.al) line 369, at lib/MT/PluginData.pm
line 28 Compilation failed in require at lib/MT.pm line 117.
Out of memory!

Here is the script that seems to be causing the problem:

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_info);


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, '/',
'.netflix.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.netflix.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 =>
$rec[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;


Any help would be greatly appreciated.


John

Reply via email to