[18225] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 393 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 2 00:05:57 2001

Date: Thu, 1 Mar 2001 21:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <983509507-v10-i393@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 1 Mar 2001     Volume: 10 Number: 393

Today's topics:
    Re: Bug report: splice/stringification <jdpepin@optonline.net>
        Convert dates in format "3/1/2001" to dd-Month-yy <creafin1998@yahoo.com>
    Re: extracting e-mail addresses from text file database <gavin@nospam.com>
    Re: Help Matt with small programs <steve@win.telisphere.com 		#kppp temp entry>
    Re: Help Matt with small programs <joe+usenet@sunstarsys.com>
    Re: Help Matt with small programs <mshort@usol.com>
    Re: Help Matt with small programs <brondsema@my-deja.com>
    Re: help: how to open ftp-browser in microsoft style <bwalton@rochester.rr.com>
    Re: How do I DROP a table using XBase module <bkennedy99@Home.com>
    Re: Opening STDERR for input <bernie@fantasyfarm.com>
    Re: Opening STDERR for input <bernie@fantasyfarm.com>
    Re: Perl CGI.pm RESET problem (BUCK NAKED1)
    Re: PROPOSAL: Graphics::ColorNames (Mark Jason Dominus)
    Re: referer() and https? (Randal L. Schwartz)
    Re: referer() and https? (BUCK NAKED1)
    Re: regex help please (The Mosquito ScriptKiddiot)
    Re: sendmail problem <tony_curtis32@yahoo.com>
    Re: sendmail problem <brondsema@my-deja.com>
    Re: sendmail problem <tony_curtis32@yahoo.com>
    Re: sendmail problem <brondsema@my-deja.com>
    Re: Win32 output problem <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 02 Mar 2001 02:46:21 GMT
From: "Joseph Pepin" <jdpepin@optonline.net>
Subject: Re: Bug report: splice/stringification
Message-Id: <1QDn6.49101$Vj5.8099725@news02.optonline.net>

"Abigail" <abigail@foad.org> wrote in message
news:slrn99pjj4.9a7.abigail@tsathoggua.rlyeh.net...
>
> This problem has been fixed in 5.6.1. Use the email address
perlbug@perl.org.
>

Phew! Sorry to cause so much trouble!  Thanks, Martien, for all your
efforts.




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

Date: Thu, 1 Mar 2001 21:01:36 -0600
From: "John Smith" <creafin1998@yahoo.com>
Subject: Convert dates in format "3/1/2001" to dd-Month-yy
Message-Id: <vXDn6.413$OS1.507894@nntp2.onemain.com>

Does anyone know the most efficient way to convert dates in the format
"m/d/yyyy" to dd-Month-yy using pattern matching?

thanks in advance.




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

Date: Fri, 02 Mar 2001 03:17:09 GMT
From: "Gavin Cato" <gavin@nospam.com>
Subject: Re: extracting e-mail addresses from text file database
Message-Id: <VgEn6.55625$o85.313704@news-server.bigpond.net.au>

Well, to get the email addresses (and i hope you are using this file for
good purposes!)


print "What do I search for?\n";
$search_choice = <STDIN>;
chomp $search_choice;
$file = "/tmp/yourfile";
open(FILE, "<$file") or die "Yikes! : $!\n";
    while (<FILE>) {
            if (/$search_choice/) {
            $email_address = (split) [0];
            print "Email Address : $email_address\n";
            }
    }
close FILE;

To get the whole line, remove the split & print lines near the end and
replace with

print "$_";

that should work, I havent tried it here locally on a test file though.

Gav



"Steeve Duchesne" <steevedu@mondenet.com> wrote in message
news:kOyn6.9453$f5.894269@news...
> Here's an example of a text file:
>
> name@something.com    Mike Price     25years old    453 455 6045
Mushroom
> Potatoes
> name2@somethin.com    Paul Green    19years old    654 324 4544    Celery
>
> If the file is 100 lines long and I want to have information Paul Green,
how
> do I search for it in the text file from a script
>
> Thanks in advance
>
>
> Tom Scheper <tom@power.net.uk> a écrit dans le message :
> 9ths9tg4t237dubuo989sasdpef89hr57c@4ax.com...
> > On Thu, 01 Mar 2001 12:55:14 GMT, "Steeve Duchesne"
> > <steevedu@mondenet.com> shed a beam of light on us:
> >
> > >Hello everybody,
> > >
> > >I want to dynamically populate a simple text file database from entries
> in a
> > >form using Perl. This file will contain e-mail addresses, names and
other
> > >types of data. The information will be kept as lines separated by tabs
or
> > >pipes. My question is: Is there a simple way of extracting e-mail
> addresses
> > >without extracting all the other data? Also, lets say that the e-mail
> > >addresses are placed at the beginning of each line. Is it possible to
> > >extract the information that comes with a particular address, if so how
> can
> > >I get my program to do this?
> >
> > It is, but can you post a few sample lines from the database text
> > file?
> >
> > -=Cornelis
>
>




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

Date: Fri, 02 Mar 2001 02:51:19 GMT
From: "Steve" <steve@win.telisphere.com 		#kppp temp entry>
Subject: Re: Help Matt with small programs
Message-Id: <HUDn6.184$Yh.602572@bcandid.telisphere.com>

In article <t9tvemc4keu151@corp.supernews.com>, "mshort" <mshort@usol.com>
wrote:
 
> $num=0;
> while ($num>=0){
>     next if ($num==0); last if $num==100; print "$num ";$num++;
>     }

Ah.............

So you set $num to 0  
go to the next interation if $num is 0 
stay in the loop as long as $num is >= 0
and $num is never incremented .......


Steve


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

Date: 01 Mar 2001 22:07:41 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Help Matt with small programs
Message-Id: <m33dcw27ia.fsf@mumonkan.sunstarsys.com>

"mshort" <mshort@usol.com> writes:

> You have to fix this prg with a NEXT and LAST statements, even though 
> there is a more efficient way with a FOR loop.  The program should
> print out every multiple of 5, from 0 to 100.
> 
> $num=0;
 ^^
 my
> while ($num>=0){
> 
> #####Insert code#####

  last if ($#=$num*$]|($\=$"))>>3>12;

>     print "$num ";
>     $num++;
> }

[more homework here]

> Any help would be greatly appreciated.

Learning how to debug programs by recognizing simple logic 
errors is an important skill. How about hiring a tutor?

-- 
Joe Schaefer    "We can't solve problems by using the same kind of thinking we
                                 used when we created them."
                                               --Albert Einstein


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

Date: Thu, 1 Mar 2001 22:18:28 -0800
From: "mshort" <mshort@usol.com>
Subject: Re: Help Matt with small programs
Message-Id: <t9u3vmr312s5af@corp.supernews.com>

1> $num=0;
2> while ($num>=0){
3>     next if (int($num / 5) != ($num/5));
4>     last if $num==100;
5>     print "$num ";$num++;
6>     }

Dave, Ok this is it, but I think this is still right, but it prints a 0 and
then sits there.

1 Sets $num equal to 0
2 While $num is greater than or equal to 0 the loop will run
3 if $num divided by 5 and returns the integral part compares this to $num
divided by 5 if they are not the same it reloops if they are the same it
continues.
4 if $num equals 100 then it exits
5 prints $num and then adds one to $num and reloops.

But I now I am getting errors, "Can't modify int in scalar assignment at....
line 3, near "))"

So what am I doing wrong? Or where am I "thinking" wrong?



Sincerely,

Matt
Dave Brondsema <brondsema@my-deja.com> wrote in message
news:ZcDn6.15359$W05.3643876@news1.rdc1.mi.home.com...
>
> "mshort" <mshort@usol.com> wrote in message
> news:t9tvemc4keu151@corp.supernews.com...
> > Perl People,
> >
> > I worked on this problem for about an hour and gave up.  And it was
> labeled
> > easy!!
> >
> > You have to fix this prg with a NEXT and LAST statements, even though
> there
> > is a more efficient way with a FOR loop.  The program should print out
> every
> > multiple of 5, from 0 to 100.
> >
> > $num=0;
> > while ($num>=0){
> >
> > #####Insert code#####
> >
> >     print "$num ";
> >     $num++;
> > }
> >
> > Ok here's one program that I did that I THOUGHT should just print 0
> through
> > 100 and then exit
> >
> > $num=0;
> > while ($num>=0){
> >     next if ($num==0);
> >     last if $num==100;
> >     print "$num ";$num++;
> >     }
> >
> >
> > I couldn't get this one to work either:
> >
> > $num=0;
> > while ($num>=0){
> >     next if (int($num / 5) != ($num/5));
> >     last if $num==100;
> >     print "$num ";$num++;
> >     }
> >
> > Any help would be greatly appreciated.
> >
> > Sincerely,
> >
> > Matt
> >
> >
>
> My first programming teacher always told us to "pretend you're the
> computer".  Go through line by line and do what the computer would do,
> writing down the values of any variables as they change.  Let's do this
with
> your first program.
>
> 1> $num=0;
> 2> while ($num>=0){
> 3>     next if ($num==0);
> 4>     last if $num==100;
> 5>     print "$num ";$num++;
> 6>     }
>
> line 1: num is 0, write that down
> line 2: num is >= 0, so the code in the while block will execute
> line 3: is num == 0?  yes.  so we do the loop again.  we directly go back
to
> line 2
> line 2: num is >= 0, so the code in the while block will execute
> line 3: is num == 0?  yes.  so we do the loop again.  we directly go back
to
> line 2
> ...
>
> see the problem?  on line three, the loop starts over without changing the
> value of $num.  This is an infinite loop.
>
> Now try it yourself for the 2nd program.
>
> Dave Brondsema
>
>
>
>
>




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

Date: Fri, 02 Mar 2001 03:21:20 GMT
From: "Dave Brondsema" <brondsema@my-deja.com>
Subject: Re: Help Matt with small programs
Message-Id: <QkEn6.15801$W05.3697991@news1.rdc1.mi.home.com>


"mshort" <mshort@usol.com> wrote in message
news:t9u3vmr312s5af@corp.supernews.com...
> 1> $num=0;
> 2> while ($num>=0){
> 3>     next if (int($num / 5) != ($num/5));
> 4>     last if $num==100;
> 5>     print "$num ";$num++;
> 6>     }
>
> Dave, Ok this is it, but I think this is still right, but it prints a 0
and
> then sits there.
>
> 1 Sets $num equal to 0
> 2 While $num is greater than or equal to 0 the loop will run
> 3 if $num divided by 5 and returns the integral part compares this to $num
> divided by 5 if they are not the same it reloops if they are the same it
> continues.
> 4 if $num equals 100 then it exits
> 5 prints $num and then adds one to $num and reloops.

good so far, but what actually happens on line 3 the first time through?
Does the 'next' happen?  or does it continue on to lines 4 and 5?
Now do it again for the 2nd time through the loop.

Does this make sense?  You need to "execute" the code in your head (and on
paper, if necessary).  Think through what the computer would do when the
program runs.

>
> But I now I am getting errors, "Can't modify int in scalar assignment
at....
> line 3, near "))"

I don't get this error.  Did you copy and paste your code to this post?
Hmm.....

>
> So what am I doing wrong? Or where am I "thinking" wrong?
>
>
>
> Sincerely,
>
> Matt





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

Date: Fri, 02 Mar 2001 03:00:21 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: help: how to open ftp-browser in microsoft style
Message-Id: <3A9F0DBF.3EE287F7@rochester.rr.com>

Mike wrote:
 ...
> I wish to open a new browser window for ftp purposes. In the original
> browser windows I leave almost untouched. I only increase the number of
> views here. But by doing this with the following line...
> (first part is to increase views for the particular id & second part is to
> open a new browser window
> <a href="$dcscript?action=redirect&id=$link[$field_id{"ID"}] & URL=
> ftp://$link[$field_id{"FTP-server"}]:$link[$field_id{"Port"}]"
> target="_blank">
> 
> I get in the new ftp browser the unix style directory listing... while I
> would like to have the simpeler microsoft style directory listing, just as
> if you type in your browser ftp://mpeg3c:mpeg3c@cls.dhs.org/ (classical
> music mp3's). Is this a common know problem, and if so.. how to solve it?
 ...
> Mike
That would be a function of your FTP server.  It is what generates
output back to the brower, and whatever it sends is what you get. 
You'll need to adjust your FTP server configuration or maybe your FTP
server vendor to get what you request.  You could probably even write
your own FTP server in Perl, and then you could get exactly what you
want :-).  You might try getting the same FTP server used by the site
you like (Serv-U FTP-Server v2.5i).
-- 
Bob Walton


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

Date: Fri, 02 Mar 2001 04:51:41 GMT
From: "Ben Kennedy" <bkennedy99@Home.com>
Subject: Re: How do I DROP a table using XBase module
Message-Id: <xFFn6.5601$Ok4.813676@news1.rdc1.ct.home.com>


"Don" <don@lclcan.com> wrote in message news:3A9E8F2F.8065A723@lclcan.com...

> However, the docs state that the above statement will NOT overwrite if
> it already exists. It then states that the table must be DROPPED first
> via the "drop" method.  Unfortunately, the docs don't state how to use
> it nor is there an example.

Well, I'm not sure about if there is an official method for it, but why not
just unlink() the dbf file as you would any other?

--Ben Kennedy




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

Date: Thu, 01 Mar 2001 21:49:47 -0500
From: Bernard Cosell <bernie@fantasyfarm.com>
Subject: Re: Opening STDERR for input
Message-Id: <up1u9t4ah7eq5em2emu1tefbv9a990oh0d@4ax.com>

On Thu, 01 Mar 2001 00:27:27 GMT, "John W. Krahn" <krahnj@acm.org>
wrote:

} Bernie Cosell wrote:
} > 
} > On Unix, STDERR is standardly open for both reading and writing [try it
} > from a shell script, for example].
} 
} You'll have to provide an example to substantiate this claim!

Well, I misspoke, it isn't default read/write in Unix, but it is
readable/writable, viz:
=============================
/* Read from STDERR */

#include <stdio.h>

char line[1000] ;
FILE * ERRBOTH ;

main()
{
    ERRBOTH = fdopen(2, "r+") ;
    fprintf(ERRBOTH, "Please type: ") ;
    fgets (line, 1000, ERRBOTH)
    printf ("You typed %s\n", line) ;
}
===================================

OTOH, it *IS* open as a default read/write in the *shell* [when I'm
not doing Perl, I do most shell stuff and only very very rarely C, so
I got a little confused.  But this works just fine:


=====================
#!/bin/bash

echo -n >&2 "Please type: "
read ans <&2
echo "you typed $ans"
======================

I can't get simul read/write to work at all in Perl.  For example, in
my 'STDERR' example, I also tried the simple:

   open (BOTH, "+</dev/tty")

and the open succeeds just fine, but I can't get anything but an error
when I try to read from it...

  /Bernie\


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

Date: Thu, 01 Mar 2001 21:58:03 -0500
From: Bernard Cosell <bernie@fantasyfarm.com>
Subject: Re: Opening STDERR for input
Message-Id: <bi2u9t035rfuia67hg0ia4a3ucn39qrn16@4ax.com>

On 1 Mar 2001 02:55:37 GMT, damian@qimr.edu.au (Damian James) wrote:

} Thus spake nobull@mail.com on 28 Feb 2001 23:28:03 +0000:
} >Bernie Cosell <bernie@fantasyfarm.com> writes:
} >
} >> On Unix, STDERR is standardly open for both reading and writing [try it
} >> from a shell script, for example].  I was somewhat surprised to discover
} >> that in Perl, STDERR is open for output-only.
} >
} >Reading from file descriptor 2 is in itself hugely ugly.
} >
} >open X,"<&2";

} 
} I can't quite understand why you'd want to do this anyway. One the one hand
} it doesn't make sense: whose STDERR are you talking about? The current
} process'?

Yes...

} ...There are a zillion other ways to pass data around inside the
} program.

It is not passing data around inside the program -- it is a relatively
standard Unix hack [that I've used before, just never before from
Perl] for getting user input when you have a program that is running
as a proper filter.  you can't print out prompts and read responses
using stdin/stdout else you'll mess up the pipeline, so it was always
SOP to use stderr.

} Or are you trying to parse errors in some wacky way? I'm sure there are
} better ways to do it...

Nope, I just need a file descriptor pair [I and O] that'll get me to
the user's terminal when I have to leave STDIN and STDOUT where they
were.  On Unix, for example, "/dev/tty" is commonly used for that.

As a footnote, I can fix/have fixed my problem.  I simply did:
    open (RDERR, "<&2") or die "Can't read from STDERR: $!\n" ;
and then in the code itself I did
    print STDERR "Account to connect to: \n" ;
    chomp ($acct = <RDERR>) ;
and that works just fine.  It just appears that Perl [at least 5.004]
has some serious trouble dealing with a tty-like file open for
simultaneous read/write.  [as I mentioned in another posting on this
thread, I had already tried something that absolutely ought to have
worked:
    open (TTY, "+</dev/tty")
and that, too, only got me errors when I tried to read from it...

  /Bernie\


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

Date: Thu, 1 Mar 2001 22:26:07 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Perl CGI.pm RESET problem
Message-Id: <21681-3A9F20DF-3@storefull-246.iap.bryant.webtv.net>

No Luck from Lincoln :) All he did was send me the
$query->defaults('button') paragraph from cgi.pm that I had already read
and tried numerous times. Looks like I need to clear the script's URL
from an environmental variable, but don't know how... $ENV{'SCRIPT_URL'}
= ""; doesn't work.

--Dennis



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

Date: Fri, 02 Mar 2001 04:28:11 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: PROPOSAL: Graphics::ColorNames
Message-Id: <3a9f215b.3721$14@news.op.net>
Keywords: Clarence, affectionate, parapsychology, transmittance

In article <97l52r$3bq$1@mamenchi.zrz.TU-Berlin.DE>,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>> >          *get_colour = *get_couleur = *get_colore = \ &get_color;
>> 
>> This also aliases $get_colour and $get_couleur, etc.
>
>Uh, no.  Assignment of a reference to a typeglob is selective.

Your code performs one selective assignment of a reference to a typeglob,
and two unselected assignments of entire typeglobs to typeglobs.

The assignments to *get_colour and *get_coleur are not selective.

(As an aside, I would like to see a ban on the phrase 'Uh, no.'  At
best, it is just impolite.  At worst, it means the newsgroup will be
subjected to two people repeatedly shouting 'IS NOT!'  'IS TOO!' until
they get tired.  Perhaps it would be useful to adopt a policy of never
saying 'Uh, no.' without supplying a code example.  This would allow
matters to be resolved quickly, or would at least provide material for
more substantive discussion.)

        @a = (1,2,3);
        @b = (4,5,6);
        @c = (7,8,9);
        $s = 'hello';
        
        *a = *b = *c = \$s;
        print "@a @b @c\n";  # prints 7 8 9 7 8 9 7 8 9 
                             # "Uh, yes."  :)

    
        
        
-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: 01 Mar 2001 19:38:13 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: referer() and https?
Message-Id: <m17l28vo0q.fsf@halfdome.holdit.com>

>>>>> "John" == John Hall <jhall@ifxonline.com> writes:

John> This might be a wierd one, but I am using referer() in CGI.pm
John> and it looks like it isn't working for requests from https
John> sites. Am I crazy? If not, is there a way to get the referer for
John> https sites?

"referer" can be bad, faked, or eliminated by security gateways.  I
hope you're just logging it for informational purposes only, and not
using it as the basis for a security or operations policy, because
it's useless for that.  And if "referer()" shows nothing, you got
nothing.  That's life.

print "Just another Perl hacker,";

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Thu, 1 Mar 2001 22:17:51 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: referer() and https?
Message-Id: <21678-3A9F1EEF-16@storefull-246.iap.bryant.webtv.net>

I couldn't get "referer" to work either with CGI.pm as the docs say, but
I did get this to work, thanks to someone's help here recently.

use CGI qw(:standard);
$query = new CGI;
print $query->textfield(-name=>'foo', -value=>"$ENV{HTTP_REFERER}" );

hope that helps,
--Dennis
             



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

Date: 02 Mar 2001 04:31:14 GMT
From: anotherway83@aol.com (The Mosquito ScriptKiddiot)
Subject: Re: regex help please
Message-Id: <20010301233114.01076.00000165@ng-fi1.aol.com>

>I wanted to go on,
>and on, and on, and eventually get a decent Taylor polynomial

holy crap....i friggin hate series of any kind

well, i should've thought abt that, guess u were rite

peace
The Mosquito ScriptKiddiot
Championing the Cause of Mosquitoes in Technology


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

Date: 01 Mar 2001 20:20:15 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: sendmail problem
Message-Id: <87lmqonc80.fsf@limey.hpcc.uh.edu>

>> On Fri, 02 Mar 2001 01:56:17 GMT,
>> "Dave Brondsema" <brondsema@my-deja.com> said:

> I have a simple perl CGI program to send out
> newsletters.  I haven't really used sendmail before and
> I'm having problems.  When the following line is
> included, I get a server 500 error.  When it's not, I
> get no errors.

> open (SENDMAIL, "| /usr/sbin/sendmail -t -n") or die
> "can't open sendmail: $!";

> I have included use CGI::Carp qw(fatalsToBrowser); at
> the top of the program.

Looks like the program (or something forked like the pipe
above) is outputting to stdout before the CGI headers.  Or
possibly CGI processes are not allowed to use sendmail.

Either run it locally and see what appears on stdout or
start with a minimal new program that just sends mail and
returns a trivial response for the browser, then
complicate things until you can identify where it all goes
wrong.

comp.infosystems.www.authoring.cgi is probably a better
place to ask further as this isn't perl-specific (more
likely a sendmail/web-server/CGI interaction problem).

hth
t
-- 
The avalanche has already started.
It is too late for the pebbles to vote.


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

Date: Fri, 02 Mar 2001 03:03:21 GMT
From: "Dave Brondsema" <brondsema@my-deja.com>
Subject: Re: sendmail problem
Message-Id: <Z3En6.15646$W05.3684983@news1.rdc1.mi.home.com>


"Tony Curtis" <tony_curtis32@yahoo.com> wrote in message
news:87lmqonc80.fsf@limey.hpcc.uh.edu...
> >> On Fri, 02 Mar 2001 01:56:17 GMT,
> >> "Dave Brondsema" <brondsema@my-deja.com> said:
>
> > I have a simple perl CGI program to send out
> > newsletters.  I haven't really used sendmail before and
> > I'm having problems.  When the following line is
> > included, I get a server 500 error.  When it's not, I
> > get no errors.
>
> > open (SENDMAIL, "| /usr/sbin/sendmail -t -n") or die
> > "can't open sendmail: $!";
>
> > I have included use CGI::Carp qw(fatalsToBrowser); at
> > the top of the program.
>
> Looks like the program (or something forked like the pipe
> above) is outputting to stdout before the CGI headers.  Or
> possibly CGI processes are not allowed to use sendmail.
>

the header is printed out before anything with sendmail happens

> Either run it locally and see what appears on stdout or
> start with a minimal new program that just sends mail and
> returns a trivial response for the browser, then
> complicate things until you can identify where it all goes
> wrong.

unfortunately, my dev. computer is currently win98.  still working on
getting those linux computers on the network...

>
> comp.infosystems.www.authoring.cgi is probably a better
> place to ask further as this isn't perl-specific (more
> likely a sendmail/web-server/CGI interaction problem).

I don't think it's webserver related (but I could be wrong), but rather
piping & sendmail.  Is there a newsgroup for sendmail?

>
> hth
> t
> --
> The avalanche has already started.
> It is too late for the pebbles to vote.




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

Date: 01 Mar 2001 21:29:22 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: sendmail problem
Message-Id: <87hf1cn90t.fsf@limey.hpcc.uh.edu>

>> On Fri, 02 Mar 2001 03:03:21 GMT,
>> "Dave Brondsema" <brondsema@my-deja.com> said:

> I don't think it's webserver related (but I could be
> wrong), but rather piping & sendmail.  Is there a
> newsgroup for sendmail?

comp.mail.sendmail, but I don't think it's likely to be a
sendmail problem per se.

Which, incidentally, is probably what causes much of the
friction around here regarding CGI questions.  You've got
perl, CGI, the OS and the web-server and possibly more
components such as databases interacting in a remote
environment to which the, err, "supplicant", does not have
direct access.  Newsgroups for the individual components
each see it as "someone else's problem".

You really need to find a way to test out all the bits
separately and then you can target the appropriate
newsgroup.  There's too much going on at different levels
to see the wood for the (binary?  :-) trees...

hth
t
-- 
The avalanche has already started.
It is too late for the pebbles to vote.


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

Date: Fri, 02 Mar 2001 04:13:17 GMT
From: "Dave Brondsema" <brondsema@my-deja.com>
Subject: Re: sendmail problem
Message-Id: <x5Fn6.16032$W05.3736064@news1.rdc1.mi.home.com>


"Tony Curtis" <tony_curtis32@yahoo.com> wrote in message
news:87hf1cn90t.fsf@limey.hpcc.uh.edu...
> >> On Fri, 02 Mar 2001 03:03:21 GMT,
> >> "Dave Brondsema" <brondsema@my-deja.com> said:
>
> > I don't think it's webserver related (but I could be
> > wrong), but rather piping & sendmail.  Is there a
> > newsgroup for sendmail?
>
> comp.mail.sendmail, but I don't think it's likely to be a
> sendmail problem per se.
>
> Which, incidentally, is probably what causes much of the
> friction around here regarding CGI questions.  You've got
> perl, CGI, the OS and the web-server and possibly more
> components such as databases interacting in a remote
> environment to which the, err, "supplicant", does not have
> direct access.  Newsgroups for the individual components
> each see it as "someone else's problem".

I agree

>
> You really need to find a way to test out all the bits
> separately and then you can target the appropriate
> newsgroup.  There's too much going on at different levels
> to see the wood for the (binary?  :-) trees...
>


Well, after lots of little changes and uploads, the problem was an \n before
the first line printed to sendmail.

Thanks




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

Date: Fri, 02 Mar 2001 02:09:22 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Win32 output problem
Message-Id: <3A9F01CF.ACA6EC69@rochester.rr.com>

Matthew Azzaro wrote:
> 
> Hello, I am new at Perl and having a problem. The code below is to select a
> random quote from a file, and print it in HTML format. It works fine on
> Unix/Apache, and on Win2K from the command prompt, but when I try to access
> it through a browser, everything outputs fine except for the quote and
> auther ($quote[0] and $quote[1]). Where is it going??? I tested before and
> after the HTML output to make sure the array is correct and contains data,
> and it does. Please email me directly at azzaro@oswego.edu with any advice.
> Thank you!! Here is the code
> -Matt
> **********************************
> #! /usr/local/bin/perl -w
> use Win32;
> 
> #READ INPUT FILE
> if (! open (QUOTES,"quotes.dat")) {
>   print "Error opening file: $!\n";
> }
> 
> srand;
> rand($.) <1 and ($line=$_) while <QUOTES>;
> close QUOTES;
> 
> @quote = split(/\*/,$line);
> 
> print <<As_Is;
> Content-type: text/html
> 
> <HTML><BODY><TABLE><TR><TD><I>$quote[0]</TD></TR><TR><TD
> ALIGN=RIGHT>$quote[1]</TD></TR></TABLE></BODY></HTML>
> 
> As_Is
> 
> exit (0);
Hmmmmm...sure ought to work if everything you said is true.  You
actually verified that when the script ran as a CGI script on your
problem Windoze system that the proper data was present in $quote[0] and
$quote[1]?  If I had to bet on it, I'd bet that your open fails on the
Windoze system when your program is run as a CGI script, and that @quote
ends up empty (that probably happens due to the web server being
configured differently than you think it is).  Also, you should probably
die after the open fails, since at the point continued execution is
hopeless.  The usual idiom is:

    open QUOTES,"quotes.dat" or die "Oops, $!\n";

You might want to consider putting out your HTTP header as the first
thing your program does, so that you will get a web page back even if an
error occurs.

You might also want to consider using the CGI module.  It is definitely
the way to do CGI in Perl.  

    perldoc CGI

BTW, srand is not needed any more (unless you're running a pretty old
version of Perl).
-- 
Bob Walton


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 393
**************************************


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