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

1357another quick dumb question.

Expand Messages
  • Franki
    Jan 4, 2001
    • 0 Attachment
      Hi all again,,,

      I have another small question,

      If I have a file, say confix.txt, that is written to each time people fill
      out a form, how can I have the config.txt file wiped of contents first.

      There can only be one set of values in that file, and the way it is now,
      each time I run the script, it just adds the new values to the bottom of the
      old ones.

      So that won't work. Is there an easy way to just wipe the contents of the
      file before the new values are written to it?

      Kindest regards

      Frank Hauptle
      http://www.gshop.com.au/
      franki@...

      -----Original Message-----
      From: Franki [mailto:frankieh@...]
      Sent: Friday, 5 January 2001 3:18 PM
      To: perl-beginner@egroups.com
      Subject: [PBML] Dumb Question that is driving me nuts.

      Hi all,

      I am new and not terribly good a perl yet and I have a problem that is
      making me pull my hair out.

      I have an auto config script that is supposed to offer a way for people to
      configure another script via their browser.

      There is a section in this script that is supposed to add variables to a
      config file, it looks like the following.

      print LOGFILE "$CHECKOUT_PATH\n
      $HASHKEY_PASSWORD\n$IP_ADDRESS\n$SERVER_IP\n$ADMIN_EMAIL\n$MAIL_SERVER\n$SIT
      E_ADDRESS\n$SERVER_TYPE\n$RETURN_POST\n$POST_URL\n$BANNER_ADDRESS\n$TITLE_NA
      ME\n$BACKGROUND_COLOUR\n$TEXT_COLOUR\n$GO_CART_ADDRESS\n$POST_PATH_FOR_GOCAR
      T\n$GOCART_BANNER_ADDRESS\n$GOCART_STORE_NAME\n$GOCART_BACKGROUND_COLOUR1\n$
      GOCART_FORM_COLOUR1\n" ;

      This just puts the values of the above variables in the file. Like so:


      /home/httpd/cgi-bin/checkout/
      YourPassword
      Your IP Address
      E-Pay Server Address
      franki@...
      Mail Server IP Address.
      http://www.yourdomain.com.au
      TEST_SERVER
      CHECKOUT
      http://www.yourdomain.com.au/your_cart_address
      http://www.yourdomain.com.au/images/title.jpg
      My Stores Name
      #008000
      #008000
      http://www.yourdomain.com.au/cgi-bin/checkout/GoCart.pl
      http://www.yourdomain.com.au/cgi-bin/checkout/Checkout.pl
      http://www.yourdomain.com.au/images/title.jpg
      My Stores Name
      #008000
      #008000


      I need it to print out the following,. ( I'll just do it for the first one,
      there is no need to do them all.)

      $CHECKOUT_PATH="/home/httpd/cgi-bin/checkout/"
      I need it to print out as above instead of just the variables value.

      But no matter what I do, it doesn't print it out properly.

      Any anyone help me in how to setup the:

      print LOGFILE "$CHECKOUT_PATH\n
      $HASHKEY_PASSWORD\n$IP_ADDRESS\n$SERVER_IP\n$ADMIN_EMAIL\n$MAIL_SERVER\n$SIT
      E_ADDRESS\n$SERVER_TYPE\n$RETURN_POST\n$POST_URL\n$BANNER_ADDRESS\n$TITLE_NA
      ME\n$BACKGROUND_COLOUR\n$TEXT_COLOUR\n$GO_CART_ADDRESS\n$POST_PATH_FOR_GOCAR
      T\n$GOCART_BANNER_ADDRESS\n$GOCART_STORE_NAME\n$GOCART_BACKGROUND_COLOUR1\n$
      GOCART_FORM_COLOUR1\n" ;

      line so that it prints out the lot in the correct format?


      Thankyou all,

      Kindest regards


      Frank Hauptle
      http://www.gshop.com.au/
      franki@...

      -----Original Message-----
      From: Kul [mailto:aka.Kul@...]
      Sent: Friday, 5 January 2001 3:00 PM
      To: perl-beginner@egroups.com
      Subject: Re: [PBML] Sendmail problem

      Hi Alan,
      When I cut'n'pasted your first example and uploaded it to my server, it ran
      straight away (after changing the email address and adding a print
      content-type header).
      Now for a dumb question: Have you got any scripts working before?
      Are you sure that sendmail is in that location?
      try locating sendmail via telnet/ssh etc ("whereis sendmail")
      or if you dont have access to telnet/ssh, try this baby script:

      #!/bin/perl
      print "Content-type: text/plain", "\n\n";
      $sendmail =`whereis sendmail`;
      @mailloc = split(" ", $sendmail);
      foreach $loc (@mailloc) { print "$loc\n"; }

      Regards
      Kul

      Alan Mackenzie wrote:

      > I have tried this mini e-mail script two ways and can't get it to send
      > mail. The scripts check out under -c and -wc but don't send mail. Any
      ideas
      > what the problem is?
      > (permissions are okay, digiweb site; Solaris system; Apache server)
      >
      > 1.
      > #!/bin/perl
      > $from_address = "asm\@...";
      > $to_address = "asm\@...";
      > $subject='test';
      > $body='test sent 8:40';
      > open(MAIL, "|/usr/lib/sendmail -oi -t") or die "Can't open sendmail:
      $!\n";
      > print MAIL <<"EOF";
      > From: $from_address
      > To: $to_address
      > Subject: $subject
      > sendmail worked
      > $body
      > EOF
      > close(MAIL) or die $! ? "sendmail didn't close nicely: $!\n":
      > "sendmail exit code $?";
      >
      > 2.
      > #!/bin/perl
      > $from_address="asm/@...";
      > $to_address="alan/@...";
      > $subject="test";
      > $body="test sent 12:00";
      > use Mail::Mailer;
      >
      > $mailer = Mail::Mailer->new();
      > $mailer->open({ From => $from_address,
      > To => $to_address,
      > Subject => $subject,
      > })
      > or die "Can't open: $!\n";
      > print $mailer $body;
      > $mailer->close();
      >
      > =============================================
      > ***** DEVELOPING AUTONOMY *****
      > The 2nd CUE mini-conference
      > @
      > Shimizu, Shizuoka. May 12-13th 2001.
      > Proposals deadline is January 25th 2001
      > Need more information?
      > http://www.wild-e.org/cue/conferences/autonomy.html
      > or contact Eamon McCafferty eamon@...
      >
      > ============================================
      > Alan Mackenzie
      > CUE Coordinator
      > College and University Educators Special Interest Group of
      > JALT (the Japan Association for Language Teaching)
    • Show all 3 messages in this topic