Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Beginner needs help! Writing to file using Perl...

Expand Messages
  • Angi
    Hi, I just sent a reply about my directory path, and it seems that I should not have had a / before cgi-bin. Thanks to everyone who helped (on all lists!) Angi
    Message 1 of 6 , Apr 9, 2000
    • 0 Attachment
      Hi,

      I just sent a reply about my directory path, and
      it seems that I should not have had a / before
      cgi-bin. Thanks to everyone who helped (on all lists!)

      Angi

      Ingenue wrote:
      >
      > Did you use "die" to see if there's any problems that get put into '$!' ?
      >
      > open (F, "> /path/to/file") or die "$!\n";
      >
      > ----- Original Message -----
      > From: "Angi" <angib@...>
      > To: <perl-beginner@egroups.com>
      > Sent: Sunday, April 09, 2000 10:15 AM
      > Subject: [PBML] Beginner needs help! Writing to file using Perl...
      >
      > > Hi,
      > >
      > > I should mention that I am a beginner. I would also like
      > > to apologize if anyone has seen this message already, as
      > > I posted on a few other lists as well. I am on an NT server,
      > > running Perl 5.
      > >
      > > Although it appears that the script works, there are no
      > > errors, and the redirection works as planned. LWP::Simple;
      > > does work. I was able to print the page to the screen. I
      > > want to print it to a file instead of the page. The file
      > > it should print to (and the url to grab) is being sent
      > > via a form. The file does exist. I hope that someone can
      > > offer some suggestions. BTW, I also tried entering the actual
      > > filename and a line of text to write to the file, just to
      > > test it, and it did not work either. My file remains blank!
      > >
      > > Here is the code I am using:
      > >
      > > #!/perl/bin/perl
      > >
      > > use LWP::Simple;
      > > &get_form;
      > > $URL = $INPUT{'url'};
      > > $TEMPFILE = $INPUT{'tempfile'};
      > > $KEYW1 = $INPUT{'keyw1'};
      > > $KEYW2 = $INPUT{'keyw2'};
      > > $KEYW3 = $INPUT{'keyw3'};
      > > $REDIRECTURL = 'testred.asp';
      > > $ERRREDIRECTURL = 'metalyzerr.asp';
      > > $CONTENT = get($URL);
      > >
      > > if (head($URL)) {
      > >
      > > print "Location: $ERRREDIRECTURL\n\n";
      > >
      > > } else {
      > >
      > > open (HANDLE, ">>$TEMPFILE");
      > > print HANDLE $CONTENT;
      > > close (HANDLE);
      > > print "Location:
      > >
      > $REDIRECTURL?url=$URL&filename=$TEMPFILE&keyw1=$KEYW1&keyw2=$KEYW2&keyw3=$KE
      > YW3\n\n";
      > >
      > > }
      > >
      > > exit;
      > >
      > > sub get_form {
      > > read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
      > > @pairs = split(/&/, $buffer);
      > > foreach $pair (@pairs) {
      > > ($name, $value) = split(/=/, $pair);
      > > $value =~ tr/+/ /;
      > > $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
      > > if ($INPUT{$name}) { $INPUT{$name} = $INPUT{$name}.",".$value; }
      > > else { $INPUT{$name} = $value; }
      > > }
      > > }
      > >
      > > Thank you in advance,
      > >
      > > Angi [mailto:angib@...]
      > >
      > > ------------------------------------------------------------------------
      > > @Backup- Protect and Access your data any time, any where on the net.
      > > Try @Backup FREE and recieve 300 points from mypoints.com Install now:
      > > http://click.egroups.com/1/2345/1/_/12898/_/955300781/
      > > ------------------------------------------------------------------------
      > >
      > >
      >
      > ------------------------------------------------------------------------
      > Whatever you want, chances are you'll find it at one of the hundreds
      > of sites in The PointClick Network--like Disney.com, eCost.com,
      > FogDog.com and many more. You get paid as you shop and an additional
      > 10% off any purchase, anytime.
      > http://click.egroups.com/1/2994/1/_/12898/_/955315106/
      > ------------------------------------------------------------------------
    Your message has been successfully submitted and would be delivered to recipients shortly.