Apache-ImageMagick

 view release on metacpan or  search on metacpan

scripts/aimcgi.pl  view on Meta::CPAN



open PIC, $fn or die "Cannot open $fn ($!)" ;

my $size = -s $fn ;

print "Content-Type: image/$ext\n" ;
print "Connection: close\n" ;
print "Content-Length: $size\n\n" ;

binmode (PIC) ;
binmode (STDOUT) ;

print $buffer while read(PIC, $buffer, 32768);

close PIC ;

} ;
if ($@)
    {
    print "Content-Type: text/plain\n\n" ;
    print "ERROR:$@\n" ;

tst/test.pl  view on Meta::CPAN

    $fn =~ /.*\.(.*?)$/;
    my $ext = $1 ;

    my $pi = $filter?"-$filter":'' ;
    $pi =~ s#/#_# ;
    my $cmpfn = "$cmppath/$file$pi" ;

    open PIC, $fn or die "Cannot open $fn ($!)" ;
    open CMP, $cmpfn or die "Cannot open $cmpfn ($!)" ;

    binmode (PIC) ;
    binmode (CMP) ;

    my $picbuf ;
    my $cmbuf ;
    while (my $npic = read(PIC, $picbuf, 32768))
        {
        my $ncmp = read(CMP, $cmpbuf, 32768) ;

        die "Read picture $npic bytes and should be $ncmp bytes" if ($npic != $ncmp) ;
        die "Picture is different as is should" if ($picbuf ne $cmpbuf) ;
        }



( run in 0.508 second using v1.01-cache-2.11-cpan-87723dcf8b7 )