[23759] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5963 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 20 14:05:38 2003

Date: Sat, 20 Dec 2003 11:05:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 20 Dec 2003     Volume: 10 Number: 5963

Today's topics:
    Re: [HELP] code modification <paul.sellis@alussinan.org>
    Re: [HELP] code modification (Tad McClellan)
    Re: [HELP] code modification <paul.sellis@alussinan.org>
    Re: Adding Header to a database/csv <jwillmore@remove.adelphia.net>
    Re: Adding Header to a database/csv <jwillmore@remove.adelphia.net>
        how do I send emails as html? (Julia Briggs)
    Re: how to read data from EXCEL  <carlo.runner@libero.it>
    Re: phone number mnemonics <matthew.garrish@sympatico.ca>
    Re: redirect without meta <jwillmore@remove.adelphia.net>
    Re: redirect without meta <noreply@gunnar.cc>
    Re: redirect without meta (Tad McClellan)
    Re: redirect without meta <flavell@ph.gla.ac.uk>
    Re: redirect without meta <noreply@gunnar.cc>
    Re: redirect without meta <noreply@gunnar.cc>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sat, 20 Dec 2003 16:56:19 +0100
From: Paul Sellis <paul.sellis@alussinan.org>
Subject: Re: [HELP] code modification
Message-Id: <paul.sellis-D24BF0.16561920122003@news1-1.free.fr>

In article (Dans l'article) 
<paul.sellis-B3911D.10560620122003@news3-1.free.fr>,
 Paul Sellis <paul.sellis@alussinan.org> wrote (écrivait) :

> The original 3rd Coast Technologies code can be found there :
> http://3rdcoast.com/free_scripts.html
> I don't know if you recommand it to me Š

I paste here the code in case of you want to look at it :
(I don't remember if that's bad or not to put the whole code Š I hope 
notŠ)




#!/usr/local/bin/perl 
#
#########################################################################
###
#  EZ Form Mailer    Version 1.3
#
#  1.3   Added tests to prevent script from being used by spammers.
#     - email must be valid
#     - Name must be under 80 characters
#     - To email limited to 5 address and must be valid emails
#     - Subject must be under 100 characters
#     Added options to turn on and off the email header and the 
#     environment information at the bottom of the email.
#     Improved look of error messages
#
#  1.2   Additional Y2K Compliance
#
#  1.1   Changed get_date to be Y2K compliant.
#
#  Copyright 1997, 1999, 2003 3rd Coast Technologies, LLC
#
#     http://www.3rdcoast.com
#     support@3rdcoast.com
#
#  This CGI script takes the data entered in an HTML form 
#  and sends it via e-mail to the specified location.
#
#  EZ Form Mailer is available for anyone to use or modify for no charge.
#  All we ask is that you leave this copyright notice in the script
#  and readme.txt file.  If someone asks where you got the script, 
#  refer them to 3rd Coast Technologies.
#
#  Selling or distributing this program without prior written approval
#  is forbidden. 
#
#########################################################################
###
#        Configuration Variables
#
#  The following variables are used to define how your form data
#  will be processed.  The data values can be defined here in the
#  script or optionally they can be sent from the form by hidden fields.
#  See the readme.txt file for information on using hidden fields.    
#
#  When changing any of these values, be sure to include the single
#  quote marks around the values and the semi colon at the end of 
#  each statement.
#
#########################################################################
####
# $SENDMAIL    identifies the location of the send mail program on 
#     your server.  Verify this with your webmaster or isp.
#     ******************************************************
#     ***   This variable MUST be specified here and   *** 
#     ***   cannot be sent using hidden fields.        ***
#     ******************************************************
#########################################################################
####

$SENDMAIL = '/usr/lib/sendmail';

#########################################################################
####
# @AUTHURLS    identifies the URL's that are authorized to use this 
#     CGI Script.  Be sure to include all possible variations.
#     ******************************************************
#     ***   This variable MUST be specified here and   *** 
#     ***   cannot be sent using hidden fields.        ***
#     ******************************************************
#########################################################################
####

@AUTHURLS = ('www.yourcompany.com','yourcompany.com');

#########################################################################
####
# $TO       the email address where the form data will be sent.
#########################################################################
####

$TO       = 'you@yourcompany.com';

#########################################################################
####
# $SUBJECT  the text that will be used for the subject of the email.
#########################################################################
####

$SUBJECT  = 'Form Data';

#########################################################################
####
# $REDIRECT    identifies the page to be displayed to the user 
#              after they submit the form.
#########################################################################
####

$REDIRECT = 'http://www.yourcompany.com/confirm.htm';

#########################################################################
####
# $SORT_TYPE   defines the sort type for the form output.
#              Options are 'alphabetic', 'field', or 'none'.
#########################################################################
####

$SORT_TYPE = 'none';

#########################################################################
####
# @SORT_FIELDS    If the $SORT_TYPE is 'field', enter the field names
#               in the desired print sequence.
#########################################################################
####

@SORT_FIELDS = ('Field1','Field2','Field3','Field4','Field5');

#########################################################################
####
# $INCLUDE_HEADER If you want the email to include the header that 
identifies
#                 who submitted the form, from what address, and at what 
time,
#                 set this varibale to "Yes".  If not, set it to "No".  
#########################################################################
####

$INCLUDE_HEADER = "Yes";

#########################################################################
####
# $INCLUDE_ENV_INFO If you want the email to include Environment 
Information
#                   about the person that submitted the form (IP Address 
and 
#                   browser type), set this varible to "Yes".  
#########################################################################
####

$INCLUDE_ENV_INFO = "Yes";

#########################################################################
####
#                                                                           
#
#  There is not anything below here that you need to change.           #
#                                                                           
#
#########################################################################
####


# Check to make sure this script was called by an authorized URL(s)

   &check_url;

# Format Local Date/Time for Email Message Date

   &get_date;

# Reformat Form Contents

   &reformat_form_data;

# Send the form data to the recipient via e-mail

   &send_email;

# Redirect user to confirmation page

   print "Location: $REDIRECT\n\n";

   exit();

sub check_url 
{
   if ($ENV{'HTTP_REFERER'}) 
   {
      foreach $AUTHURL (@AUTHURLS) 
      {
         if ($ENV{'HTTP_REFERER'} =~ /$AUTHURL/i) 
         {
            $check_url = '1';       
            last;
               }
            }
   }
   else 
   {
      $check_url = '1';
   }

   if ($check_url != 1) 
      {

      $errorHeading = "Unauthorized URL Referrer - Access Denied";
      $errorMessage = "The form that is trying to use this script 
resides at: $ENV{'HTTP_REFERER'}, which is not allowed to access this 
cgi script.";
         &print_error;
      exit;
   }

}

sub get_date 
{
      @days = 
('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
      @months = 
('January','February','March','April','May','June','July',
      'August','September','October','November','December');

      ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = 
localtime(time);
      if ($hour < 10) 
      { $hour = "0$hour"; }
      if ($min < 10) 
      { $min = "0$min"; }
      if ($sec < 10) 
      { $sec = "0$sec"; }
   if ($year >= 100)
      { $year = $year - 100; }
      if ($year < 10) 
      { $year = "0$year"; }
   if ($year < 90) 
      { $cent = "20"; }
   else
      { $cent = "19"; }

      $date = "$days[$wday], $months[$mon] $mday, $cent$year at 
$hour\:$min\:$sec";

   $mon = $mon + 1;
   if ($mon < 10) 
      { $mon = "0$mon"; }
   if ($mday < 10) 
      { $mday = "0$mday"; }

   $dateShort = "$cent$year\-$mon\-$mday";
   $timeShort = "$hour\:$min\:$sec";

}

sub reformat_form_data
{
   if ($ENV{'REQUEST_METHOD'} eq 'POST') 
   {
            # Get the input
            read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
            # Split the name-value pairs
            @pairs = split(/&/, $buffer);
      }
      else 
   {
      $errorHeading = "Error: Invalid Request Method";
      $errorMessage = "The Request Method of the Form you submitted was 
not POST.  Please check the form, and make sure the method= statement is 
in upper case and is set to POST.";
         &print_error;
      exit;
      }
   foreach $pair (@pairs) 
   {
         ($name, $value) = split(/=/, $pair);
            $name =~ tr/+/ /;
            $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
      $value =~ tr/+/ /;
         $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
      $value =~ s/<!--(.|\n)*-->//g;
      if ($name eq 'email' && ($value)) 
      {
         ## Test for valid email
         if ($value !~ /^[\w\.-]+@[\w\.-]+$/) {
            $errorHeading = "Error: Invalid Email Address";
            $errorMessage = "The email address you entered is not 
valid.";
               &print_error;
            exit;
         }

               $CONFIG{$name} = $value;
      }

      if ($name eq 'name' || $name eq 'Name' && ($value)) 
      {
         ##  Name should be under 80 Characters
         if (length($value) > 80) {
            $errorHeading = "Error: Invalid Name";
            $errorMessage = "The Name you entered is not valid.";
               &print_error;
            exit;
         }

               $CONFIG{Name} = $value;
      }
      if ($name eq 'to_email' && ($value)) 
      {
         ## Test for valid email - allow up to 5
         @TO_EMAILS = split(/,/, $value);
         $numberOfEmails = @TO_EMAILS;
         if ($numberOfEmails > 5) {
            $errorHeading = "Error: Invalid Send To Email";
            $errorMessage = "You have specified too many Send To Email 
Addresses.";
               &print_error;
            exit;
         }
         foreach $TO_EMAIL (@TO_EMAILS)  {
            if ($TO_EMAIL !~ /^[\w\.-]+@[\w\.-]+$/) {
               $errorHeading = "Error: Invalid Send To Email";
               $errorMessage = "The the Send To email address you 
entered is not valid.";
                  &print_error;
               exit;
            }
         }
         $TO = $value;
      }     
      elsif ($name eq 'subject' && ($value)) 
      {
         ##  Subject should be under 100 Characters
         if (length($value) > 100) {
            $errorHeading = "Error: Invalid Subject";
            $errorMessage = "The the Subject you entered is not valid.";
               &print_error;
            exit;
         }
         $SUBJECT = $value;
      }
      
      elsif ($name eq 'redirect' && ($value)) 
      {
         $REDIRECT = $value;
      }     
      elsif ($name eq 'sort_type' && ($value)) 
      {
         $SORT_TYPE = $value;
      }           
      elsif ($name eq 'sort_fields' && ($value)) 
      {
         @SORT_FIELDS = split(/,/, $value);
      }     
      elsif ($FORM{$name} && ($value)) 
      {
         $FORM{$name} = "$FORM{$name}, $value";
      }
      elsif ($value) 
      {
               $FORM{$name} = $value;
            }
   }
}

sub send_email
{
# Build the 'from' address of the form: "name <email address>"

   $from_name=($CONFIG{'Name'} . " <" . $CONFIG{'email'} . "> ");

   open(MAIL,"|$SENDMAIL -t") || die "Can't open $mailprog!\n";

# Output the mail header

   print MAIL "To: $TO\r\n";
      print MAIL "From: $from_name\r\n";
   print MAIL "Reply-To: $from_name\r\n";
   print MAIL "Subject: $SUBJECT\r\n\n";  

# Output the mail message header with the Local Date/Time

   if ($INCLUDE_HEADER == "Yes") {
      print MAIL 
"---------------------------------------------------------------\n";
      print MAIL "   The following information was submitted by: \n";
      print MAIL "   $CONFIG{'Name'} on $date\n";
      print MAIL "   From: $ENV{HTTP_REFERER}\n";
      print MAIL 
"---------------------------------------------------------------\n\n";
   }

# Output the mail body
# Optionally Sort and Print the name and value pairs in FORM array

   if ($SORT_TYPE eq 'alphabetic') 
   {
            foreach $key (sort keys %FORM) 
      {
               print MAIL "$key: $FORM{$key}\n\n";
            }
      }
      elsif ($SORT_TYPE eq 'field') 
   {
      foreach $SORT_FIELD (@SORT_FIELDS) 
      {
               if ($FORM{$SORT_FIELD}) 
         {
                     print MAIL "$SORT_FIELD:  $FORM{$SORT_FIELD}\n\n";
         }
      }
   }
      else 
   {
         foreach $key (keys %FORM) 
      {
            print MAIL "$key:  $FORM{$key}\n\n";
         }
   }

# Output the mail footer

   if ($INCLUDE_ENV_INFO == "Yes") {
      print MAIL "<REMOTE HOST>    $ENV{'REMOTE_HOST'}\n";
      print MAIL "<REMOTE ADDRESS> $ENV{'REMOTE_ADDR'}\n";
      print MAIL "<USER AGENT>     $ENV{'HTTP_USER_AGENT'}\r\n";
   }

# Close the pipe and send the mail

   close(MAIL);
}

sub print_error
{
   print "Content-type: text/html\n\n";
   print "<html>\n";
   print "<head>\n";
   print "<title>EZ Form Mailer - Form Entry Error</title>\n";
   print "</head>\n";
         print "<body bgcolor=\"#FFFFFF\" text=\"#000000\" 
alink=\"#FF0000\" vlink=\"#FF00FF\" link=\"#0000FF\">\n";
   print "<center><table width=\"400\" cellspacing=\"0\" 
cellpadding=\"0\" border=\"0\">\n";
   print "<tr><td><center><h1>$errorHeading</h1></center></td></tr>\n";
   print "<tr><td><p>$errorMessage</p></td></tr>\n";
   print "<tr><td><p>&nbsp;<br>If you believe that you received this 
message in error, please contact the webmaster for this 
site.</p></td></tr>\n";
   print "<tr><td><p align=\"center\">&nbsp;<br><a 
href=\"$ENV{'HTTP_REFERER'}\">Back to the Submission 
Form</a></p></td></tr>\n";
   print "</table></center>\n";
      print "</body>\n";
   print "</html>\n";
}


------------------------------

Date: Sat, 20 Dec 2003 10:11:32 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: [HELP] code modification
Message-Id: <slrnbu8t5k.nk1.tadmc@magna.augustmail.com>

Paul Sellis <paul.sellis@alussinan.org> wrote:
> In article (Dans l'article) 
><paul.sellis-B3911D.10560620122003@news3-1.free.fr>,
>  Paul Sellis <paul.sellis@alussinan.org> wrote (écrivait) :


>> I don't know if you recommand it to me Š


The code is amateurish and buggy. I recommend deleting it and
looking for a replacement.

It is worth *less* than you paid for it!


>    &check_url;


That is how subroutines were called 7 years ago.

Is this program 7 years old?

Or is the "programmer" just stuck in the Dark Ages?


   check_url();


> sub check_url 
> {
>    if ($ENV{'HTTP_REFERER'}) 
>    {
>       foreach $AUTHURL (@AUTHURLS) 
>       {
>          if ($ENV{'HTTP_REFERER'} =~ /$AUTHURL/i) 
>          {
>             $check_url = '1';       
>             last;
>                }
>             }
>    }
>    else 
>    {
>       $check_url = '1';
>    }


That is some foolish logic.

It accepts _anything_ if HTTP_REFERER is not defined.


>       if ($hour < 10) 
>       { $hour = "0$hour"; }


sprintf() should be used for padding instead.


>    if ($year >= 100)
>       { $year = $year - 100; }


This is a y2100 bug.

The docs for localtime() show the correct way to get a 2-digit year.

Looks like the "programmer" did not read the docs for the function
that he used...


> sub reformat_form_data
> {
>    if ($ENV{'REQUEST_METHOD'} eq 'POST') 
>    {
>             # Get the input
>             read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
>             # Split the name-value pairs
>             @pairs = split(/&/, $buffer);


Contains a host of classic bugs, repeated yet again!


>          ## Test for valid email
>          if ($value !~ /^[\w\.-]+@[\w\.-]+$/) {


This will reject some perfectly valid addresses...


> sub send_email
> {
> # Build the 'from' address of the form: "name <email address>"
> 
>    $from_name=($CONFIG{'Name'} . " <" . $CONFIG{'email'} . "> ");


   $from_name = "$CONFIG{Name} <$CONFIG{email}> ";


>    open(MAIL,"|$SENDMAIL -t") || die "Can't open $mailprog!\n";


That diagnostic message is misleading, and it does not include
the $! variable containing the reason for the failure.


This is an example of Script Kiddie code. Blech!


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Sat, 20 Dec 2003 18:47:22 +0100
From: Paul Sellis <paul.sellis@alussinan.org>
Subject: Re: [HELP] code modification
Message-Id: <paul.sellis-D661C5.18472220122003@news3-1.free.fr>

In article (Dans l'article) 
<slrnbu8t5k.nk1.tadmc@magna.augustmail.com>,
 tadmc@augustmail.com (Tad McClellan) wrote (écrivait) :

> >> I don't know if you recommand it to me Š
> 
> The code is amateurish and buggy. I recommend deleting it and
> looking for a replacement.


Well that's very clear thanks !


So for my Flash form submission with CGI, you recommanded me 2 scripts
- FormMail
- TFMail

And as I need to write also the datas in a text file, the better choice 
seems to be TFMail.

But do you know how I can make to avoid the html redirection (success 
page) ? Because the script is called from a Flash file, that makes the 
script not workingŠ
Unless it is possible for the CGI to redirect to a specific scene in the 
same Flash file instead of the html fileŠ


------------------------------

Date: Sat, 20 Dec 2003 14:08:15 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Adding Header to a database/csv
Message-Id: <20031220090815.1596bee9.jwillmore@remove.adelphia.net>

On Fri, 19 Dec 2003 16:03:46 GMT
"Public Interest" <test@test.com> wrote:

> i have something like:
> aaa, 11.11, 123456
> bbb, 22.22, 122432
> in a csv file
> 
> but i want it to look like
> stock symbol, price, volume,
> aaa, 11.11, 123456
> bbb, 22.22, 122432
> 
> can i access to the csv file without reading the first line?

There are various CSV modules to handle this for you.

http://search.cpan.org and search for cvs.

HTH

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
These days the necessities of life cost you about three times
what they used to, and half the time they aren't even fit to
drink. 


------------------------------

Date: Sat, 20 Dec 2003 14:27:22 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Adding Header to a database/csv
Message-Id: <20031220092722.02ecd92e.jwillmore@remove.adelphia.net>

On Sat, 20 Dec 2003 14:08:15 GMT
James Willmore <jwillmore@remove.adelphia.net> wrote:
> http://search.cpan.org and search for cvs.

should be csv, not cvs.  :-)

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
"... all the modern inconveniences ..."   -- Mark Twain 



------------------------------

Date: 20 Dec 2003 10:47:57 -0800
From: julia4_me@yahoo.com (Julia Briggs)
Subject: how do I send emails as html?
Message-Id: <c48f65ef.0312201047.60cfda67@posting.google.com>

What headers/data do I have to add to output sent emails as HTML?  

Any advice or examples?


------------------------------

Date: Sat, 20 Dec 2003 17:37:26 GMT
From: "Carlo Cazzaniga" <carlo.runner@libero.it>
Subject: Re: how to read data from EXCEL 
Message-Id: <qN%Eb.199077$vO5.7936081@twister1.libero.it>

It's TEXT file..
It should

"Fengshui" <test@test.com> ha scritto nel messaggio
news:vIRCb.451818$0v4.20914757@bgtnsc04-news.ops.worldnet.att.net...
> I would like to know if excel file is a BINARY or TEXT file. I konw .csv
is
> text file.
>
> > I need to read data from EXCEL worksheets in this way:
> > The script perl asks me to write a number .
> >  I type a Number  f.e.  1000 , the script should look for the number
1000
> > inside a
> > excel worksheet  file and if it find it, should capture all the  other
> > numbers reported in the raw where  there is the number 1000.
> > the mother number (1000) is always in the first colomn of excel sheet.
> >
> >               col1    col2    col3    col4    col5
> > raw1     900     002     004      006
> > raw2    1000    345     445      888      777
> >
> > once the script had found the wanted number (1000)  in the raw2  col1 ,
> > it gives me the other 4 number   (345 445 888 777).
> > and put them in an array.
> > the cells with number in the excel workspread are variable from 0 to
 ...,
> > the script should be able to read all the cells of the raw till the
first
> > empty cell.
> > there is someone could help me
> > Thanks Carlo
> >
> >
> >
> >
>
>




------------------------------

Date: Sat, 20 Dec 2003 10:08:39 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: phone number mnemonics
Message-Id: <bCZEb.25118$CK3.2685328@news20.bellglobal.com>


"Jason Quek" <qjason@starhub.net.sg> wrote in message
news:ucp7uv4ml3vhljj1mvju381ov0rrmhbouv@4ax.com...
>
> My problem now is how do I write the code which will find all possible
> combinations of words which will give the same results as
> http://www.phonespell.com.
>
> Any help would be appreciated.
>

I would start by reading their FAQ:

http://www.phonespell.com/faq/tech.html#mnemonic

Matt




------------------------------

Date: Sat, 20 Dec 2003 14:18:19 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: redirect without meta
Message-Id: <20031220091819.558fc6be.jwillmore@remove.adelphia.net>

On Fri, 19 Dec 2003 10:48:09 -0700
"Robin" <robin@csf.edu> wrote:

> I've been trying to redirect to an html page in a cgi script...how
> would one do this wihout using a META tag in the script...?

post this to
comp.infosystems.www.authoring.cgi

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
Never make anything simple and efficient when a way can be found 
to make it complex and wonderful. 


------------------------------

Date: Sat, 20 Dec 2003 15:59:14 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: redirect without meta
Message-Id: <bs1o3l$8kgv6$1@ID-184292.news.uni-berlin.de>

Robin wrote:
> I've been trying to redirect to an html page in a cgi script...how 
> would one do this wihout using a META tag in the script...?

Sherm Pendley replied:
> The same way you'd do it in any language: Return the appropriate
> HTTP header. Did you have a Perl question?

 ... and Abigail replied:
> Why do you ask here?

 ... and Tad McClellan replied:
> The same way you would if you were writing your CGI program in
> Python.
> 
> (you do not have a Perl question)

 ... and James Willmore replied:
> post this to
> comp.infosystems.www.authoring.cgi

I get so tired. As you may have noticed, I chose to simply answer the
question that was asked. (OP thanked me privately.) Suppose it took
about as much time as each of the replies above.

Was the question obviously off topic here? Personally I don't think
so. OP asked about how to solve a particular detail in a program
written in Perl. Yes, it was a CGI problem rather than a Perl language
problem, but so what? People who write Perl programs often encounter
problems that are not strictly Perl programming language matters, and
I often see questions about system interaction, emails, database
communication etc. politely answered here.

Why this attitude when it comes to CGI?

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: Sat, 20 Dec 2003 10:20:26 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: redirect without meta
Message-Id: <slrnbu8tma.nk1.tadmc@magna.augustmail.com>

Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> Robin wrote:
>> I've been trying to redirect to an html page in a cgi script...how 
>> would one do this wihout using a META tag in the script...?
> 
> Sherm Pendley replied:
>> The same way you'd do it in any language: Return the appropriate
>> HTTP header. Did you have a Perl question?
> 
> ... and Abigail replied:
>> Why do you ask here?
> 
> ... and Tad McClellan replied:
>> The same way you would if you were writing your CGI program in
>> Python.
>> 
>> (you do not have a Perl question)
> 
> ... and James Willmore replied:
>> post this to
>> comp.infosystems.www.authoring.cgi
> 
> I get so tired. As you may have noticed, I chose to simply answer the
> question that was asked. (OP thanked me privately.) Suppose it took
> about as much time as each of the replies above.


But it trains all of the lurkers to post their off-topic questions here too.

When I see someone litter in the park, I might just go pick up the litter,
in which case the original litterer will litter again and everyone who
sees trash all over the park will add their trash as well.

Or, I might ask that the litterer not leave trash in the park.


> Was the question obviously off topic here?


Yes.


> OP asked about how to solve a particular detail in a program
> written in Perl.


To accomplish what he wants, he simply needs to make the
correct output.

The answer to the Perl part of his question was:

   use the print() function to make output.

Knowing _what_ should be output was the real problem, and what
should be output is the same regardless of his choice of
programming language, so a programming language newsgroup is
not the place to find the right answer.


> Why this attitude when it comes to CGI?


We don't like litter in our park.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Sat, 20 Dec 2003 17:22:19 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: redirect without meta
Message-Id: <Pine.LNX.4.53.0312201700210.18767@ppepc56.ph.gla.ac.uk>

On Sat, 20 Dec 2003, Gunnar Hjalmarsson wrote:

> I get so tired.

Nevertheless, taking the line of least resistance my not be the right
response.  As you can see, several well-respected contributors around
here already expressed their view on that.  (I also expressed a view,
just in case there's any misunderstanding  ;-).

> As you may have noticed, I chose to simply answer the
> question that was asked.

But, with respect, your answer was incomplete in a material respect
(you referred to $url without saying anything about whether it could
be a relative URL or what), nor gave any reference by which anyone
could read-up on the details if they were so minded.  Some of us
around here happen to think that learning more about the principles is
a more valuable function of usenet than getting given prepared
answers, even answers which work, if the questioner gets no indication
why they work nor where to learn more.

> (OP thanked me privately.)

That's OK, but this is a community, not an on-demand help desk.

The OP is also to be commended for wanting a genuine redirection
instead of the meta...refresh; but that isn't the point at issue just
here.

> Was the question obviously off topic here?

I'd say perlfaq9 considers it to be off-topic, and mentions not only
the solution but also shows where to learn more.   So, it's not
sufficiently off-topic to be ruled out of getting a faq pointer, but
the faq pointer should suffice - unless there's some Perl-specific
content in the problem, rather than just the incidental fact that Perl
is the scripting language.  Or if the faq itself is in dispute, which
would be fair enough reason to discuss it here.

> I often see questions about system interaction, emails, database
> communication etc. politely answered here.
>
> Why this attitude when it comes to CGI?

There's something in what you say, but I stand by the original point.

I see plenty of off-topic questions that are not about the CGI, given
sharp responses and told to find a more appropriate forum.  I've been
on the receiving end of a few myself, and, when that happened, I'd
have to say they were generally right and I was generally wrong.

all the best


------------------------------

Date: Sat, 20 Dec 2003 18:58:16 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: redirect without meta
Message-Id: <bs22lc$8le1h$1@ID-184292.news.uni-berlin.de>

Tad McClellan wrote:
> Gunnar Hjalmarsson wrote:
>> I get so tired. As you may have noticed, I chose to simply answer
>> the question that was asked. (OP thanked me privately.) Suppose
>> it took about as much time as each of the replies above.
> 
> But it trains all of the lurkers to post their off-topic questions
> here too.

Okay, point taken, and I agree in principle. Just a few days ago I
moved a CGI related thread to ciwac. But I think you overdo it
sometimes.

>> Why this attitude when it comes to CGI?
> 
> We don't like litter in our park.

Please, Tad, your quoting of and reply to that question were out of
context. I wrote:

     OP asked about how to solve a particular detail in a program
     written in Perl. Yes, it was a CGI problem rather than a Perl
     language problem, but so what? People who write Perl programs
     often encounter problems that are not strictly Perl
     programming language matters, and I often see questions about
     system interaction, emails, database communication etc.
     politely answered here.

     Why this attitude when it comes to CGI?

Seems as if you avoided to address the point I was trying to make.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: Sat, 20 Dec 2003 19:28:00 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: redirect without meta
Message-Id: <bs24dg$8rven$1@ID-184292.news.uni-berlin.de>

Alan J. Flavell wrote:
> Gunnar Hjalmarsson wrote:
>> As you may have noticed, I chose to simply answer the question
>> that was asked.
> 
> But, with respect, your answer was incomplete in a material respect
> (you referred to $url without saying anything about whether it
> could be a relative URL or what), nor gave any reference by which
> anyone could read-up on the details if they were so minded.

Yep, a reference to the FAQ had been appropriate. OTOH, you posted
that. ;-) (Actually, the reason why I excluded your comment from my
enumeration was that your post included guidance aimed to help OP.)

>> Was the question obviously off topic here?
> 
> I'd say perlfaq9 considers it to be off-topic,

I'd say that the pure existence of perlfaq9 indicates that CGI is not
obviously off-topic. :)  Maybe we should distinguish between 'simple'
and 'in-depth' questions about things that are just peripherally Perl
related.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 5963
***************************************


home help back first fref pref prev next nref lref last post