Ask a Question related to PERL Beginners, Design and Development.
-
Trina Espinoza #1
Script chokes on various file formats.
I am starting to write a lot of scripts that require a user to input a file that my script processes for data. Since there are may file formats rtf, txt, microsoft word, etc, my scripts have often choked when users submit the data in various file formats. I need something to ensure my scripts don't choke.
I already know how to do the open(source, "./file.txt") || die "stuff stuff stuff:!";
But what I really think I need is the ability to assess the validity of the files (rule out bad formats) or write something that makes my code robust enough to handle the most common formats. I'm sure one of these options are doable and I don't really know where to start.
If someone could give me suggestions or point me to a web page that gives instructions on how to do this that would be much appreciated.
Thanks!
-T
Trina Espinoza Guest
-
Does a pdf retain file formats?
I am not sure this is the right wording for this; but the question is...When writing a pdf out of InDesign does the pdf retain the file formats of... -
Adobe Illustrator file formats specification
Is the Adobe Illustrator file format specification available for versions 9 to 11? If so where can I get a copy? -
Camera Raw and using other file formats
The Camera Raw plug-in will only open Camera Raw files. Rich -
file formats?
hi, i am new to photoshop 7, so please bear with me, i have downloaded certain pictures off the net and i am trying to resize and then print them,... -
Don't need these file formats! Please help!
I would like to keep the file formats I use (PSD, BMP, GIF, JPEG, & TIFF). How can I unload the others? I've gone through the progam files folders of... -
Ramprasad #2
Re: Script chokes on various file formats.
Trina Espinoza wrote:
Incidentally your answer seems to lie in your initial -T> I am starting to write a lot of scripts that require a user to input a file that my script processes for data. Since there are may file formats rtf, txt, microsoft word, etc, my scripts have often choked when users submit the data in various file formats. I need something to ensure my scripts don't choke.
>
>
> I already know how to do the open(source, "./file.txt") || die "stuff stuff stuff:!";
>
> But what I really think I need is the ability to assess the validity of the files (rule out bad formats) or write something that makes my code robust enough to handle the most common formats. I'm sure one of these options are doable and I don't really know where to start.
>
> If someone could give me suggestions or point me to a web page that gives instructions on how to do this that would be much appreciated.
>
>
> Thanks!
>
> -T
try this
perldoc -f -T
Basically perl can tell you wether your file is a text file or not and
then you can do whatever with it
Ram
Ramprasad Guest



Reply With Quote

