[Ilugc] Perl Help

  • From: imthiazrafiq@xxxxxxx (Imthiaz Rafiq)
  • Date: Tue, 6 Aug 2002 22:23:18 +0530

your script work well. But one more help
the savehim routine is not saving the file binary format.

it doesnot work when downloading the zip file

i changed your file to
#!/usr/bin/perl

use LWP;
use Symbol ;

my $Content = GetHim( 'http://www.asksathia.com/1.zip' ) or
         die "Check out the Link/Connectivity\n";

print "Retrieved Him...\n" ;

SaveHim ( 'temp.zip' , $Content );

#Subs follow
sub GetHim($)
{
   my $Request =  HTTP::Request->new('GET');

   $Request->url( shift );

   print "Retrieving Him.....\n";

   LWP::UserAgent->new->request( $Request )->content ;
}

sub SaveHim($$)
{
   my ( $FileName , $Content )   =  @_;
   my $Handle ;

   $Handle  =  gensym();

   open $Handle , "> $FileName " or die "open failed -- $!\n";

   print $Handle $Content ;

   print "Done at :$FileName:\n" ;
   close $Handle ;
}

is there any way to correct the above problem....

Imthiaz

----- Original Message -----
From: "Udaya Kumar.R" <itsuday@xxxxxxxxxxxxxxxxx>
To: "Imthiaz Rafiq" <imthiazrafiq@xxxxxxx>
Cc: "LUG Chennai" <ilugc@xxxxxxxxxxxxxxxxxx>
Sent: Tuesday, August 06, 2002 7:08 PM
Subject: Re: [Ilugc] Perl Help


On Tue, 6 Aug 2002, Imthiaz Rafiq Wrote :

imthia :Hi All
imthia :
imthia :  I want a perl script that will open a remote file from some
other server like http://www.something.com/somefile.zip and store the file
onto my server being http://www.myserver.com/somefile.zip
imthia :
imthia :Please tell me a method or any example for the same. I am new to
perl coding......
imthia :
imthia :Help Me
imthia :Thanks In advance

check out this .

<perl-script>
#!/usr/bin/perl

use LWP;
use Symbol ;

my $Content = GetHim( 'http://perl.com' ) or
         die "Check out the Link/Connectivity\n";

print "Retrieved Him...\n" ;

SaveHim ( 'temp.html' , $Content );

#Subs follow
sub GetHim($)
{
   my $Request =  HTTP::Request->new( 'GET' );

   $Request->url( shift );

   print "Retrieving Him.....\n";

   LWP::UserAgent->new->request( $Request )->content ;
}

sub SaveHim($$)
{
   my ( $FileName , $Content )   =  @_;
   my $Handle ;

   $Handle  =  gensym();

   open $Handle , "> $FileName " or die "open failed -- $!\n";

   print $Handle $Content ;

   print "Done at :$FileName:\n" ;
   close $Handle ;
}
<perl-script>

bye.
uday.

--
Reply To :
perl -e 'print pack
"H*","69747375646179406c696e7578667265656d61696c2e636f6d";'
                                       OR
                          to the above 'From' Address

_______________________________________________
To unsubscribe email Ilugc-request@xxxxxxxxxxxxxxxxxx with "unsubscribe"
in the subject or body of the message.
http://www.aero.iitm.ernet.in/mailman/listinfo/ilugc



Other related posts: