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

Re: [MacPerl] Porting Un*x perl scripts to MacPerl for CGI




Kent Cowgill <kentc@intersites.com> writes:
}
}Actually, I found that the problem was with large files.  The files I
}thought were slipping through -T were .pdf files, which I didn't realize
}until yesterday were actually TEXT files.  Some of the .pdf files in the
}directories were > 1.3MB, which I suppose was causing MacPerl to run out of
}memory.

No, PDF isn't text, but it has a large plain text header that frequently
fools Perl (both Mac and Unix).  I suppose a fix to the base Perl code may
be in order, maybe reading in a larger chunk of the beginning of the file
to do its checking.

}
}As far as iterating through each file line by line, I suppose I could do
}that; but I'd be concerned about a decrease in speed.  Can anyone tell me
}if this concern is justified?
}
}>This probably won't help much, but I have a similar sort of script that
}>processes about 4,000 files, 2/3 of them binary, the rest text, and it
}>works just fine under both MacPerl and Unix perl. The only consideration
}>I give to operating system is to use ':' for the path separator on the
}>Mac and '/' on Unix.
}
}Yeah, the way I worked around using "$ls = `ls $file`;" made a few other
}things in a few of the other routines break; as a result, I'm going to have
}to do twice the work to convert paths into URL's.  Heck, though.  It makes
}it twice as fun to learn :)

You don't need to if you don't want to.  In my MacPerl port of
libwww-perl-5 (http://mors.gsfc.nasa.gov/MacPerl.html),  there are routines
that convert back and forth.  They deal with all sorts of esoteric stuff
(at least they're supposed to) that you may never need, but that means they
work for the simple stuff as well.  Look in particular at
URI::URL::newlocal.

}
}
}-Kent
}
}  Kent Cowgill          .---'''''---...         1 West State Street
}  Intersites, Inc.      'i n t e r s i t e s.   Geneva, IL 60134
}  .-'-.-'-.-'-.-'-.-'-.      ''''---.....---'   .-'-.-'-.-'-.-'-.-'-.-'-.
}  kentc@intersites.com                          http://www.intersites.com/


---
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@pjstoaster.pg.md.us