[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] I've been a good boy...




        I've this script that runs without problems under Linux, but
that refuses to do it's work in MacPerl. The -w switch is silent in
both systems. Anybody could please help me?

#!/usr/bin/perl -w

$/ = "";
$* = 1;

print STDERR "Procesando: ";
foreach $arc (@ARGV) {
    print STDERR "[$arc] ";
    open (DATA, $arc) || die "No puedo abrir $arc\n";
    read (DATA, $_, 1024);
    close (DATA);
    $version = 3 if (m/Photoshop 3\.0/);
    $version = 2 if (m/Adobe_Photoshop2\.5/);
    if ($version == 3) {
        s/(.*)8BIM\004\004(.*)[^(8BIM)]8BIM\003/$2/g;
    } elsif ($version == 2) {
        s/(.*)8BIM\003\374(.*)[^(8BIM)]8BIM\003/$2/g;
    }
    while (m/8BIM/) {
        $aux = substr ($_, 0, rindex ($_, "8BIM"));
        $_   = $aux;
    }
    s/\n/\040/g;
    s/\000//g;
    s/\015/\040/g;
    s/\207/\341/g;              # 'a
    s/\216/\351/g;              # 'e
    s/\222/\355/g;              # 'i
    s/\227/\363/g;              # 'o
    s/\234/\372/g;              # 'u
    s/\226/\361/g;              # ~n
    s/\250/\277/g;              # '?
    s/\255/\241/g;              # '!
    s/\201/\374/g;              # "u
    s/\256/\253/g;              # <<
    s/\257/\273/g;              # >>
    s@foto: @</I><B>Foto: @i;
    print "<IMG SRC=\"$arc\"><BR><I>$_</B><P>\n\n";
}
print STDERR "\n";

        It extracts the commentaries on JPGs generated by PhotoShop. I
know that it's dirty, but it works... on Linux.

--
La Mancha, http://uxcomp2.iimas.unam.mx/~mancha
casa://AvCopilco.162.edificio.22.depto.1003/~mancha
ring://550-1829.df.telmex.com.mx/~pedir.por.mancha
chamba://cubo-320.iimas.unam.cu/~mancha