CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Adding unzip module to current script

 



abhijeet
New User

Oct 13, 2015, 4:47 AM

Post #1 of 4 (1207 views)
Adding unzip module to current script Can't Post

Hello,

I have a script that will read all new mails from outlook and then extract the attchments(in .xls) to a specified folders .

but now I am facing an issue because I have started receiving attachments in zip format.



I am using the below error





Can't locate File/Type.pm in @INC (@INC contains:C:/Dwimperl/perl/site/lib C:/D



wimperl/perl/vendor/lib C:/Dwimperl/perl/lib .) at test.plline 5.



BEGIN failed--compilation aborted at test.pl line 5.



Press any key to continue . . .





script as below





use strict ;



use warnings ;



use IO::Uncompress::Unzip qw(unzip$UnzipError) ;



use File::Temp qw/ tempfile tempdir /;



use File::Type ;











my $ft = File::Type->new();



my $input_file =$ft->checktype_filename($file);







if ( checktype_filename ( $input_file ) == 'application/zip' )



{



my $tmp_file = tempfile();



unzip $input_file => $tmp_file ;



$input_file = $tmp_file ;



}







I am new to perl scripting,hence please help.









FishMonger
Veteran / Moderator

Oct 13, 2015, 6:47 AM

Post #2 of 4 (1202 views)
Re: [abhijeet] Adding unzip module to current script [In reply to] Can't Post

The error message is telling you that it can't find the File::Type module. Either the module isn't installed or was not installed correctly.

You need to install the File::Type module.

However, the author of that module abandoned it 11 years ago and no-one else is maintaining it, so I'd recommend finding a replacement module which is more up to date and is being maintained.

File::LibMagic is the recommended replacement and was just updated a few weeks ago.
http://search.cpan.org/~drolsky/File-LibMagic-1.15/lib/File/LibMagic.pm


abhijeet
New User

Oct 14, 2015, 2:36 AM

Post #3 of 4 (1196 views)
Re: [FishMonger] Adding unzip module to current script [In reply to] Can't Post

Hello FishMonger,



Thanks for your reply,the main purpose is to unzip a file while mail is being read and place in a specified folder.

however I tried using the filetype but the same issue occurs.



If you could provide a simple script to do this it would be helpful.


Laurent_R
Veteran / Moderator

Oct 14, 2015, 3:41 AM

Post #4 of 4 (1188 views)
Re: [abhijeet] Adding unzip module to current script [In reply to] Can't Post

So long as your script does not even compile, there is no way it will do what you expect. So, start by fixing the compile errors and installing the right modules as needed, and then only let's see if the script fits your bill or if something needs to be changed.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives