[11944] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5544 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 2 18:07:17 1999

Date: Sun, 2 May 99 15:00:21 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 2 May 1999     Volume: 8 Number: 5544

Today's topics:
    Re: a complex associative array problem <cassell@mail.cor.epa.gov>
    Re: Account Registration to email <cassell@mail.cor.epa.gov>
        Any Ideas? <JK@sandwell98.free-online.co.uk>
    Re: Any Ideas? (Sam Holden)
        Create a new file <ghf62@dial.pipex.com>
    Re: Create a new file (Sam Holden)
    Re: Debug - Single step ? <cassell@mail.cor.epa.gov>
    Re: Filtering a file (Tad McClellan)
        Frequent Posters: new group for WWW applications of Per (Tad McClellan)
    Re: getting a remote URL <cassell@mail.cor.epa.gov>
        HELP! - perl script won't write?!? (Bpcorbray)
    Re: HELP! - perl script won't write?!? (Sam Holden)
        HELP! Need Some Info Please.... luppens@pipeline.com
    Re: HELP! Need Some Info Please.... (Sam Holden)
        I'm stuck- persistent connection wont quit!! michael_13353@my-dejanews.com
    Re: I'm stuck- persistent connection wont quit!! (Michel Dalle)
    Re: is o'reilly auctioning off llama books? (Bart Lateur)
    Re: Learning Perl for the first time <cassell@mail.cor.epa.gov>
        looking for a Perl Hosting Control Panel...... puffyz@my-dejanews.com
    Re: Question : Maybe I missed something about arrays, h (Larry Rosler)
    Re: RegEx for matching Mbx "From " delimeter (John Stanley)
    Re: searching perl documentation <cassell@mail.cor.epa.gov>
    Re: Throw a person a fish... <cassell@mail.cor.epa.gov>
    Re: Throw a person a fish... (Larry Rosler)
    Re: unos problemitas <cassell@mail.cor.epa.gov>
    Re: Who is Just another Perl hacker? (Michel Dalle)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Sun, 02 May 1999 13:33:04 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: a complex associative array problem
Message-Id: <372CB680.B397C2B7@mail.cor.epa.gov>

Jonathan Stowe wrote:
> 
> On Thu, 29 Apr 1999 21:13:39 GMT du_bing@my-dejanews.com wrote:
> >
> >
> > I fixed the problem myself.
> >
> 
> Although it might seem a minor thing, it is generally considered polite
> in these cases to post back the solution to the group in order that those
> who might find themselves in a similar position can find the answer.
> 
> Oh and so we jaded hackers can have a little fun at your expense picking
> your code to bits ;-}

In the words of Bob Trieger, "Post here, get mocked here."  :-)

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Sun, 02 May 1999 12:40:51 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Account Registration to email
Message-Id: <372CAA43.D5896908@mail.cor.epa.gov>

Matt Melton wrote:
> 
> Hi there everyone,
> 
> I'm looking for some sort of script that will allow a "new user" to register
> an account by entering their email address and a user name, and when they
> submit the form, an email is automatically sent to the address they entered
> with a generated password which in turn allows them to access the site...
> Obviously these scripts exist as we've all seen them, but now has come the
> time that I need to see it from the other side.  If anyone can point me in
> the right direction, I'd appreciate.

I would suggest going to one (or more) of the big net search engines 
and searching.  Some good keywords might be cgi, perl, account, email,
form, password, and/or script.

And please don't ask this sort of question here again.  This is not
a web newsgroup, or a cgi newsgroup, or a here-are-free-scripts
newsgroup.  This is a newsgroup for the Perl programming language
and helping people with Perl coding problems.  Requests such as yours
are off-topic, and considered a breach of netiquette.

Thank you,
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Sun, 2 May 1999 19:42:46 +0100
From: "Sandwell" <JK@sandwell98.free-online.co.uk>
Subject: Any Ideas?
Message-Id: <ia1X2.595$%x.717@wards>

Hi,

Please could you help, I am new to the world of CGI and Perl.  I have a CGI
Guest Book script, which I have got permission to edit.  I would like to
make it mult-user support.  The guest-book write new entries to a .txt file.
I would like the following to happen -

Someone goes to guestbook.cgi?user=forexample

The script looks for a log file called forexample.txt

If a file doesn't exist, it creates a blank .txt file called....
forexample.txt

Please Could Anyone help me out..

Graeme Sandwell (graeme@sandwell98.free-online.co.uk)

PS - Also, how do you assign properties in perl?




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

Date: 2 May 1999 18:59:11 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Any Ideas?
Message-Id: <slrn7ip83v.kgl.sholden@pgrad.cs.usyd.edu.au>

 Sandwell <JK@sandwell98.free-online.co.uk> wrote:
>Hi,
>
>Please could you help, I am new to the world of CGI and Perl.  I have a CGI
>Guest Book script, which I have got permission to edit.  I would like to
>make it mult-user support.  The guest-book write new entries to a .txt file.
>I would like the following to happen -
>
>Someone goes to guestbook.cgi?user=forexample
>
>The script looks for a log file called forexample.txt

You would probably use :

use CGI
param()
-e

>
>If a file doesn't exist, it creates a blank .txt file called....
>forexample.txt

You would probably use :

open

>PS - Also, how do you assign properties in perl?

use RealEstate::Transaction;


You probably want to learn perl. Look for tutorials on the web, buy a book,
pay for a course. All of those might help. Posting here probably won't since
I don't think anyone could really be bothered teaching perl over usenet...

-- 
Sam

In case you hadn't noticed, Perl is not big on originality.
	--Larry Wall


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

Date: Sun, 2 May 1999 21:21:07 +0100
From: "Lawrence Brendish" <ghf62@dial.pipex.com>
Subject: Create a new file
Message-Id: <7gic1p$1as$1@lure.pipex.net>

Hi,

Very new to perl (less than 24 hours!), how do you create a new file using a
perl script?

I seem to come across how to rename, delete, etc. but can't find how to
create a new one.

Thanks in advance,

Lawrence.




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

Date: 2 May 1999 20:31:55 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Create a new file
Message-Id: <slrn7ipdhr.to.sholden@pgrad.cs.usyd.edu.au>

 Lawrence Brendish <ghf62@dial.pipex.com> wrote:
>Hi,
>
>Very new to perl (less than 24 hours!), how do you create a new file using a
>perl script?

You will find most of the answers to your questions are already contained in
the documentation that you got with perl.

'perldoc -f open' should show you one way of doing it.

-- 
Sam

Remember that the P in Perl stands for Practical.  The P in Python
doesn't seem to stand for anything.
	--Randal Schwartz in <8cemsabtef.fsf@gadget.cscaper.com>


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

Date: Sun, 02 May 1999 14:09:52 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Debug - Single step ?
Message-Id: <372CBF20.25BB0E49@mail.cor.epa.gov>

Tom Christiansen wrote:
> 
>  [courtesy cc of this posting sent to cited author via email]
> 
> In comp.lang.perl.misc, Phillip Grobler <info@grobler.co.za> writes:
> :How can I single step thrugh a perl program ?
> 
>     man perldebug

Or, if you're using some OS which is so sad that it doesn't have a
`man' function to read on-line docs, then you would want to use one 
of the nifty Perl programs which help you.  Try typing at a
comand prompt:
    perldoc perldebug
or if you're using ActiveState Perl on a win32 box, you have HTML
on-line docs which you can read in your favorite browser.  You'll
find that Perl's debugger does pretty much everything you might
hope for.. except write code for you.

HTH,
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Sun, 2 May 1999 08:38:45 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Filtering a file
Message-Id: <l0hhg7.s21.ln@magna.metronet.com>

Larry Rosler (lr@hpl.hp.com) wrote:
: [Posted and a courtesy copy sent.]

: In article <7ggbd1$5q5$1@news.alaska.edu> on Sat, 1 May 1999 17:57:53 -
: 0800, Chris <chrisl@muskox.alaska.edu> says...
: > I picked up a Perl book because I need to write a program that will read in
: > a file and spit out into another file all the lines that contain any of a
: > list of various strings.

: I think that what you are looking for is in perlfaq6:  "How do I 
: efficiently match many regular expressions at once"

: That gives a solution that uses a new feature of perl5.005, qr//.  For 
: older perls, you can create a unified regex.  The following causes the 
: "trigger" strings to be matched literally:

:    my $re = join '|', map quotemeta, @trigger_strings;
:    /$re/o and print while <>;


: PS:  When you 'compare against a list which I could create dynamically 
: based on another file of "trigger" strings,' don't forget to chomp off 
: the newlines:

:    chomp(my @trigger_strings = <FILE>);


PPS: and if you want to use capturing parens (not needed for the
     original problem), then remember to order @trigger_strings
     so that the left-to-right pattern matching that perl uses
     will find the Right Thing.

     Either arrange them in the right order in the trigger strings
     file, or sort them in your script:

     my $re = join '|', map quotemeta, sort {$b cmp $a} @trigger_strings;


This program gives different output if you swap the commented lines:

----------
#!/usr/bin/perl -w
use strict;

#my @trigger_strings = qw(catalog cat);
my @trigger_strings = qw(cat catalog);

   my $re = join '|', map quotemeta, @trigger_strings;

   /($re)/o and print "'$1'\n" while <DATA>;

__DATA__
i have a catalog
no Catalog here
i have another catalog here
----------


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sun, 2 May 1999 12:44:21 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Frequent Posters: new group for WWW applications of Perl?
Message-Id: <5dvhg7.1a1.ln@magna.metronet.com>


[ Subject changed to contain the actual subject ]


Charles R. Thompson (design@raincloud-studios.com) wrote:
: From: "Charles R. Thompson" <design@raincloud-studios.com>
: Newsgroups: comp.lang.perl.misc
: Subject: Frequent Posters... gurus. I will regret this post I'm sure.
: Date: Sun, 02 May 1999 16:15:31 GMT
: Message-ID: <DS_W2.371$iu1.773@news.rdc1.tn.home.com>
: 
: 
: I'm not trying to be a jerk, but I'd really only like to get
: responses from the 'gurus' of this group, you know who you are.


   I regard myself as several steps below "Guru" level.

   Yet I think you really meant       s/gurus/frequent posters/ 
   (as in your original Subject:) since you mention my
   (not-yet-enlightened) name.

   So here I am.

   :-)


: Ya know... I pop in here from time to time, frequent a few other
: newsgroups and have seen something I'm curious about and have
: finally decided to take the heat of the flames and just ask it.

: Has anyone every actually considered a *focused* newsgroup for
: developers who use Perl for their website development language?


   It has been discussed here before, as has the 
   related-but-different clp.beginners or clp.newbie or
   some such.

   The consensus for clp.beginners was that it just wouldn't work.
   Several of the reasons are common with your proposed
   "WWW applications of Perl" newsgroup though:


      Folks are already confused and making the wrong choices
      about where to post.

        hand 1: adding more choices will make them yet more confused

        hand 2: this new group will become The Place for them to
                use, thus reducing the confusion

        hand 3: they'll just resort to the shotgun approach and
                crosspost to ciwac, clpmisc, and the new group.



: Tad, I'm not sure what the correct terminology should be. 


   I'm not conviced that it would work, nor that it should even be 
   attempted.

   I am also not conviced that it would not work or that it
   should not be attempted.

   (I'm a politician type of poster, I guess :-)


: You
: have a very strong stance towards those who come in here with
: questions in the 'grey area'. 


   I have both selfish and selfless reasons for urging that
   WWW questions be asked in a WWW newsgroup:

   selfish:

      I remember when all sorts of True Perl Luminaries, even
      Larry, participated in clpmisc, or the defunct clp. Only
      a precious few are here nowadays.

      I realize that the world has changed and it will never be
      the way it used to be.

      Yet I have seen (over the course of about 4 years here)
      really smart and helpful Perl folks show up here, 
      participate for a few weeks or months, and then disappear
      never to be heard from again.

      I don't want yet more such folks to abandon the newsgroup.

      I occasionally picked up a new tidbit of Perl knowledge
      from stumbling across them while reading the group. This
      is the "motivation" for me to continue participation,
      rather than ditching the group as so many others have done.

      "Tidbits" are getting more and more rare.

      I have a couple times stopped reading the group figuring
      I would succumb too and never go back. Yet I pop back up.

      I dunno if I am Too Tolerant or a Masochist  :-)


      [ "_Tad_ is too tolerant?" You are asking yourself.

        The intolerant ones abandon the group and are not
        here to be observed.

        So the curmudgeonly nature here could be even worse  :-)
      ]


   selfless:

      I think that pointing out that the folks who know the
      subject area of a question are somewhere other than
      where the question is is _helping_ the poster find
      the answer to their question.


      "Proctologists and Gynocologists are both doctors and
       they work only an inch apart, so either of them can
       answer my question"

      heh, heh  :-)


: That's not a flame.

   Yes, I see that.


: I can see how 98% of CGI solutions using Perl fit into another
: newsgroup because of the interaction with a web server, etc.


   So the "market" for your proposed group would be the 2%
   that currently have no place to go?

   Is that going to be enough traffic to warrant a new group?

   I dunno...


: They grey area for me is something like a Perl library for
: flat-file database routines that just *happens* to run on a web
: server. Sometimes those questions get sent away if the phrase
: 'website' pops up. 


   Folks become oversensitized to some phrases, and try to 
   "push off" articles that really don't need to be pushed off.

   That's what we get for being fallible humans.


: I mean... is something like the FTP module,
: or the CGI module a barred topic here even though they use Perl?


   For the FTP module, no, they should not be barred.

   For the CGI module, "it depends" on the nature of the problem.

   Therein lies the rub, as the folks we are discussing here
   cannot discern the dependencies.

   :-(


   But being able to make the distinction is *crucial* to
   getting an understanding of the problem so that you can
   start to deal with fixing it.

   Really. 

   The ability to know if you have an "HTML problem" or
   a "CGI problem" or a "Perl problem" or a "Unix problem"
   goes a Very Long Way toward discovering the solution(s).

   Some examples of Wrong Thinking that lead folks to chase
   red herring "solutions":

      Perl scripts run in the browser.

      The environment of different user accounts are the same.

      Only one copy of a file-writing program will be executing
      at any given time.

      How "state" is maintained in a WWW application is different
      in different programming languages.

      etc, ...


: If Perl is used to write scripts for website functions, or for
: Internet development... what do I call it so it is clearly a
: separation from what this site is about? This way I'll know when
                            ^^^^

   "site" will be taken as short for "website".

   I think you meant    s/site/newsgroup/  there?

   Precise terminology is important when discussing technical topics :-)


: to leave this group alone.


   Here are two tests that pretty much guarantee that your
   problem is not a Perl problem:

      "It works from the command line, but not from the browser (sic)"

      "The answer will be the same even if I changed to a different
       programming language for my CGI apps"


   I, in a machine-like manner, spawn a "off-topic, point to correct
   place" type of answer for any form of the above.


: I'm not trying to be a smart-ass, 


   Oh good.

   The last ten days or so have been a banner period for 
   those already...


: or cause a fight... you guys
: seem to have the most clear cut idea on this, I just want to
: know how you define this. I really want to see the light here.


   We have to realize that folks just will not _be able_
   to tell from time to time. But at the same time, we would
   hope that they would make a conscientious attempt at
   determining where their question "should" go.

   My (intended anyway) approach is to point to a Better Place,
   rather than just turn the flamethrower on high. (though
   I know that my "trigger finger" does sometimes spin the
   dial a bit too far. Sorry.)


: I can basically realize Tad's ever-vigilant stand on the
: separation of WWW and Perl in this newsgroup, 


   Let me summarize again why the vigilance.

      I don't want to drive off knowledgeable people with a bunch
      of posts that they may percieve as "noise". (and I don't
      want to be driven off myself either)

      I want folks to get their answers. CGI questions in the
      Perl newsgroup may get flamed or ignored. CGI questions
      in the CGI newsgroup have much less chance of that outcome.


: and I really hope
: this can be a focused thread that produces a positive result not
: only for the 'gurus' who are most likely sick of it all, but
: also for the newbies who get needlessly flogged and vanish. 


   I feel that newbies get flogged because they are trying
   to take on too many disparite subjects at once. They are
   often new to all or most of these at once:

      Usenet (bad Subjects, 80 quoted lines and 2 new lines, 
              Jeopardy quoting style, etc, ...)

      Programming (what is an array? what is a loop?)

      Perl (which has a bewildering collection of data structures,
            methods for accessing variables, loops, ...)

      CGI environment (client/server, multitasking, parameter passing, ...)

      HTML (escaping chars with entities, what tags have what semantics ...)

      Unix  (ISP uses an OS that they are not familar with)


   They cannot separate them out, and get taken to task for it.

   Look at that list. Damn it is big. Getting a robust CGI program
   working just isn't easy. It is the nature of the beast (IMO).

   
: I
: personally don't think it helps the continuation of Perl to
: verbally whip tomorrow's programmers.


   Me either.

   If they hope to be tomorrow's programmers, then they need to
   develop the ability to "partition" their problems.

   This is the fundamental first (and repeated) step in
   troubleshooting.

   As anyone who has programmed knows, troubleshooting is a 
   large part of what we do.

   Bugs in a program often seem to be as large a component
   as the features the program implements.

   :-(


   If you cannot troubleshoot, you don't have much of a future
   as a programmer.

   A sensible person taking on learning to play the violin should
   fully expect the instructor to shout at you for making sqwauks
   and squeeks on occasion.

   It is part of internalizing the "lesson" for future use.

   Don't get all huffy, just realize you have learned something
   that won't need to be learned again later, and move on.

   :-)


: Here's my key point to make about the problem: *Nobody seems to
: realize the name of this group is the biggest cause of
: mis-posts.*
: 

: Obviously, the name cannot and will not
: be changed... ever. 


   Right.

   So I'm not going to address that.


: People using perl search for 'Perl' in the
: newsgroups because the language in their minds takes precedence
: over the functionality terms like HTTP, FTP, CGI, etc.


   But they need to "fix" that thinking if they want to become
   effective at dealing with the unavoidable bugs that will
   be a part of everyday programming life.

   Which, I think, is why the FPs keep pointing it out.

   (or maybe it is just because they don't care about WWW
    applications of Perl. I choose the more complimentary
    potential reason  :-)
   )


: 2) Going to authoring.cgi is practically useless because you get
: thrown in with the javascripters, people who can't get their
: guestbook or form to work, or other semi-conscious lamos who
: can't answer your question anyway.


   So my pointing them there is not as helpful as I thought
   it was then. 

   I read ciwac only when I don't have anything better to do, 
   (probably for the reasons you cite above) and I often have 
   something better to do.


: I'm not sure what is involved with getting a newsgroup started,


   Start with:

      http://www.dejanews.com/[ST_rn=ps]/getdoc.xp?AN=465869349


: but seeing as how I work at home, I probably have enough free
: time between projects to talk to all the right people and do the
: legwork if others are willing to see something like this happen.
: I may need a few pointers, but am willing to try.


   Not to be discouraging, but it will take a considerable
   amount of time. Perhaps more than you realize.

   You might search for articles about the creation of the
   clp.moderated newsgroup to see what went on for that one.

   The discussion phase will bring out coherent spokespeople
   (and some kooks too) for both approving and disapproving 
   a request for the new group.

   It may be that there is considerable support, yet not
   enough votes to pass.

   You pays your money and you takes your chances.



   You might instead consider starting a mailing list with such
   a focus, and see if it is popular enough to warrant its
   own newsgroup...



: I don't mind admitting that I'm an entry level Perl developer. I
: don't want to constantly bug you guys if it is unnecessary.
: However, this is one of the only groups where real questions
: about Perl get real answers.


   I see your point.


: I can't help but think something like
: 
: comp.lang.perl.webscripting
: comp.lang.perl.internet (this sounds 'correct')
: comp.lang.perl.internetdev


   I would not approve (or vote for) anything like that
   in the comp.lang.perl.* hieararchy.

   If it is about WWW applications, then it should be in the
   hierarchy for WWW stuff somewhere.


: would take the burden off this newsgroup, and give Perl
: developers a better place than authoring.cgi to get help with
: these taboo issues. There are plenty of developers expert in
: this area that I'm sure would like to have a home, and I'm
: certain it would be a success. I'm willing to help in any way I
: can if it is something that is feasible.
: 
: I'm open to your opinions on this matter


   I would not vote against it out-of-hand.

   But I do not know which way I would end up voting for such 
   an RFD either.

   (there's that fence-sitting position of mine again...)




--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sun, 02 May 1999 14:32:31 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: getting a remote URL
Message-Id: <372CC46F.420997C7@mail.cor.epa.gov>

Jonathan Stowe wrote:
> 
> On Sun, 02 May 1999 10:16:59 GMT Cim wrote:
> > How could I access a remote URL via perl?
> > http://someplace.com/cgi-bin/abc.cgi?img=123&xx=xxxxx ........
> >
> > This URL could return a HTML with img links inside or just an image.
> > Then I want to print it.
> 
> You will want to use the LWP::UserAgent module that is available from
> CPAN - that is <http:://www.perl.com/CPAN> (I thought that it was
> unnecessary to point that ought until today).
> 
> The module comes with good documentation including a 'cookbook' lwpcook.pod
> and a variety of examples so I wont bother everyone else with the details.
> 
> > What will the <img src> be? I want to hide the original location. So
> > that it would look as if the output would come from my server.
> >
> 
> Perl doesnt have an <img src> so  I guess you will want to ask that
> question in a group that discusses such matters.

And if you're set on snitching images from other sites and passing
them off as yours, then you might want to check out a newsgroup
that discusses the ethical issues involved in web use.  What's
wrong with giving credit where credit is due?

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: 2 May 1999 18:28:36 GMT
From: bpcorbray@aol.com (Bpcorbray)
Subject: HELP! - perl script won't write?!?
Message-Id: <19990502142836.08297.00001244@ng-cb1.aol.com>


The following was written as a simple script to generate username and password
to file.  But it is not working write (sic).  Aside from the debugging notes in
comments - occassionally when it outputs 'Could not open file.' it tags it with
an 'S' or other character.  BTW, both the permissions (755) and ownerships have
been checked and rechecked on both the script and the output file.  Also, the
two 'parts' of the script (the post-n-parse variable & the write-to-file) were
written as seperate working scripts then brought together in one not-working
script.  Any other suggestions would be greatly appreaciated.

Thank you.

Len


=================

#!/usr/local/bin/perl

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

$html =  "Content-type: text/html\n\n";

$Inp = $buffer;

@Inp2 = split(/&/, $Inp);

$T1 = $Inp2[0];
@Inp3 = split(/=/, $T1);

$T2 = $Inp2[1];
@Inp4 = split(/=/, $T2);

$name = $Inp3[1];
$name =~ s/&//g;

$pword = $Inp4[1];
$pword =~ s/&//g;

#print $html . $name . "     " . $pword . "<BR>";

####everything works above this

###this works from command line w/ no input - prints 'done', etc
###works in winperl32 w/ no errors but no userlist.txt exists when running
### - it doesn't seem to mind
##dies on exec from html -> *cgi* -> 'Could not open file.'

open(OTT, ">>userlist.txt") || die print $html . "Could not open file.";
print OTT $name . "    " . $pword . "\n";
close(OTT);

####everything works past this

print $html;
print "<BR><BR><B>done</B>";



#############
#############
# But this works...

#!/usr/local/bin/perl
$name = "bbbb";
$pword = "2222";

open(OTT, ">>userlist.txt") || die print $html . "Could not open file.";
print OTT $name . "    " . $pword . "\n";
close(OTT);



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

Date: 2 May 1999 18:51:19 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: HELP! - perl script won't write?!?
Message-Id: <slrn7ip7l6.kgl.sholden@pgrad.cs.usyd.edu.au>

On 2 May 1999 18:28:36 GMT, Bpcorbray <bpcorbray@aol.com> wrote:
>
>#!/usr/local/bin/perl

Well you missed the -w. A bad sign to start with. Always enable warnings,
especially if something isn't working.

Some would argue use strict is missing too, I'm undecided on that yet though,
so I'll let that slip.


>
>read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

Why are you doing this yourself....?
Have you read the appropriate protocol spec or are you jusy copying what you
have seen?

Read does actually return something, it would be very wise to check that value. 

>
>$html =  "Content-type: text/html\n\n";
>
>$Inp = $buffer;
>
>@Inp2 = split(/&/, $Inp);

Why not just use $buffer instead of copying it around...
>
>$T1 = $Inp2[0];
>@Inp3 = split(/=/, $T1);
>
>$T2 = $Inp2[1];
>@Inp4 = split(/=/, $T2);

Again with the useless copying...

>
>$name = $Inp3[1];
>$name =~ s/&//g;
>
>$pword = $Inp4[1];
>$pword =~ s/&//g;

You split on & at the beginning, so there can't be any & characters in those
strings. 

>
>#print $html . $name . "     " . $pword . "<BR>";

See below for a better way...

>
>####everything works above this
>
>###this works from command line w/ no input - prints 'done', etc
>###works in winperl32 w/ no errors but no userlist.txt exists when running
>### - it doesn't seem to mind
>##dies on exec from html -> *cgi* -> 'Could not open file.'
>
>open(OTT, ">>userlist.txt") || die print $html . "Could not open file.";

'die print <something>' is a construct I have never seen before. I guess since
your not using the appropriate modules you have to resort to such contortions.

You should include $! in the error message, since that's how perl tells
you what went wrong.

perlfaq9 : My CGI script runs from the command line but not the browser.

Did you read the FAQ before posting?

Did you have a look at all the resources that particular FAQ says to look at?

That would give you your answer a little faster I suspect.


>print OTT $name . "    " . $pword . "\n";

That is a really aweful way of writing that why not use:

print OTT "$name    $pword\n";

Much nicer don't you think.

>close(OTT);
>
>####everything works past this
>
>print $html;
>print "<BR><BR><B>done</B>";

Two breaks in a row doesn't make any sense in HTML. 

>
>
>
>#############
>#############
># But this works...
>
>#!/usr/local/bin/perl
>$name = "bbbb";
>$pword = "2222";
>
>open(OTT, ">>userlist.txt") || die print $html . "Could not open file.";
>print OTT $name . "    " . $pword . "\n";
>close(OTT);

If that really does work as a CGI then I have no idea what the problem is.

If it doesn't (and so why do you put it here) then I suspect you are having
permission problems. I suggest you read all of perlfaq9 and the idiot's guide
to CGI programming (which hopefully someone will else will post a pointer to).

Using the information perl gives you gives $! will probably tell you what the
problem is anyway. but won't tell you how to fix it.

-- 
Sam

 "... the whole documentation is not unreasonably transportable in a
 student's briefcase." - John Lions describing UNIX 6th Edition
 "This has since been fixed in recent versions." - Kernighan & Pike


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

Date: Sun, 02 May 1999 21:36:51 GMT
From: luppens@pipeline.com
Subject: HELP! Need Some Info Please....
Message-Id: <372cc3ea.21637400@news.mindspring.com>

Greetings,

A friend of mine has been given an assignement to create a:

"partly fucntional 1.1 cache & proxy http responses to get requests"

and someone has suggested that he should try PERL. Don't know why he
chose this course as one of his last prior to graduation, but anyway,
does anyone know of a site where he can obtain a basic, tutorial level
PERL source listing for a proxy server having the above attributes? I
really hate asking but I I've never done any Web programming but I
would like to help him at least pass this course and graduate. Thanks
for reading this post and any possible help you can give.

Joe




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

Date: 2 May 1999 21:51:39 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: HELP! Need Some Info Please....
Message-Id: <slrn7ipi7b.6s6.sholden@pgrad.cs.usyd.edu.au>

On Sun, 02 May 1999 21:36:51 GMT, luppens@pipeline.com wrote:
>Greetings,
>
>A friend of mine has been given an assignement to create a:
>
>"partly fucntional 1.1 cache & proxy http responses to get requests"
>
>and someone has suggested that he should try PERL. Don't know why he
>chose this course as one of his last prior to graduation, but anyway,
>does anyone know of a site where he can obtain a basic, tutorial level
>PERL source listing for a proxy server having the above attributes? I
>really hate asking but I I've never done any Web programming but I
>would like to help him at least pass this course and graduate. Thanks
>for reading this post and any possible help you can give.

#!/usr/bin/perl -w
use strict;
use LWP;

That's all. It's 'partly functional' - a very small part...

Your friend is better off asking his own questions.

Simply find out what a proxy needs to do and then implement it. A simple
matter of programming. I wrote an advertising filter proxy a while ago
(I'm sure everyone has) and it's not hard at all. Especially with all
the modules available for perl.
 
If the assignment is to write such a beast then surely a a source listing
for exactly that would be a bit of a temptation to copy. Finding how
to retrieve stuff over http with perl is easy just use LWP. Finding how
to listen for connections in perl is easy just read the documentation that
comes with perl (perlipc for example). Finding how to create a daemon
process (useful for a proxy server) with perl is easy, just read the
documentation that comes with perl (perlfaq got example). Finding out the
protocol the proxy has to follow is easy just look up the appropriate
specification.

If your friend has a more specific questions and a first bash at the code
then he should post here to ask any questions that he can not find in
the standard perl documentation, FAQs, and dejanews searches.


-- 
Sam

We prefer English to remain a rich language, quirky, sloppy, and full
of redundancy. Same for Perl. 
	--Larry Wall


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

Date: Sun, 02 May 1999 19:10:15 GMT
From: michael_13353@my-dejanews.com
Subject: I'm stuck- persistent connection wont quit!!
Message-Id: <7gi7um$a99$1@nnrp1.dejanews.com>

I have a great problem with a presistent-connection to a Web-Server using perl
and CGI!

On my Linux (and Netscape 4) the perl script quits 2 or 3 seconds after I quit
the Browser or go to another Page. That's just fine.

when accessing the same Page from a Win98 with either NetScape or MIE4 then
Skript stays alive forever!!

Is there a way how to figure out if the Browser/User ist still "there"?

Any suggestions?

Please I am desperate.

t.i.a.

Michael....

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Sun, 02 May 1999 21:26:28 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: I'm stuck- persistent connection wont quit!!
Message-Id: <7gifsf$nlb$2@xenon.inbe.net>

In article <7gi7um$a99$1@nnrp1.dejanews.com>, michael_13353@my-dejanews.com wrote:
>I have a great problem with a presistent-connection to a Web-Server using perl
>and CGI!
>
>On my Linux (and Netscape 4) the perl script quits 2 or 3 seconds after I quit
>the Browser or go to another Page. That's just fine.
>
>when accessing the same Page from a Win98 with either NetScape or MIE4 then
>Skript stays alive forever!!
>
>Is there a way how to figure out if the Browser/User ist still "there"?
>
>Any suggestions?

I don't get it. Keeping a connection "alive" is the business of the web-server
and the browser, not of individual scripts. Do you exit your script at all ?

Michel.


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

Date: Sun, 02 May 1999 19:31:19 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: is o'reilly auctioning off llama books?
Message-Id: <372ca745.900605@news.skynet.be>

Uri Guttman wrote:

>this article intrigued me. it says "llamas start at $500"!!

Sheesh. That's a lot of capturing parentheses.

	Bart.


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

Date: Sun, 02 May 1999 13:10:48 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Learning Perl for the first time
Message-Id: <372CB148.C53A7F65@mail.cor.epa.gov>

John Callender wrote:
> 
> [big snip]
> With that said, here are some suggestions:
> 
> * Limit your posting to comp.infosystems.www.authoring.cgi, at least
> for those questions that have any CGI component to them at all. The
> people there tend to be a bit less huffy about these issues.

Or rather, refrain from posting to c.l.p.misc when your problem
is tangential to Perl.  If your problem could be written in any
language at this point, then it is not a Perl problem.  If you have
Perl code for your website, and the code doesn't work as expected, 
then it could be a Perl problem.

> * Read the FAQs at www.perl.com.

More good advice.
 
> * Before posting a question, use www.dejanews.com to see if someone has
> already answered it. It's faster, and helps keep the obsessive types
> from blowing a gasket.

And learn to use perldoc, since it will similarly save you from
time-wasting and asbestos-suit-donning.

> * Visit my tutorial at:
> 
> http://www.lies.com/begperl/

Another good bit of advice.  But it might be valuable to point out
that a large amount of webwork can be done *before* touching Perl.
A true beginnner might want to try to get that part under his belt 
first...

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Sun, 02 May 1999 19:20:56 GMT
From: puffyz@my-dejanews.com
Subject: looking for a Perl Hosting Control Panel......
Message-Id: <7gi8im$ap2$1@nnrp1.dejanews.com>

Hello, I am the CEO of TelaWeb.com...A hosting and internet services company.
Anyways, I am developing a Perl Control Panel for my members to use and to be
able to log into.  So they can add pop3 accounts, forwarding emails, change
password, file manager, that sort of thing.  Anyone know of any scripts that
can do this even close or know any that just can do one of the things i said
or the other, if so you can email me at webmaster@telaweb.com or icq#6707316
and btw if you wnat great hosting at 8.99 a month with no traffic restriction
and 100 megs.......use us!!!!!	NT or UNIX!!!!!!

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Sun, 2 May 1999 13:12:48 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Question : Maybe I missed something about arrays, how do i clean up my code to get rid of those warningmessages?
Message-Id: <MPG.119651911bff86c0989996@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <7gi1t7$5l5$1@nnrp1.dejanews.com> on Sun, 02 May 1999 
17:26:46 GMT, Igor Berg Mogielnicki <iggepop@my-dejanews.com> says...
> open (APACHECONF,$_[0]) || die "couldent open Apache config file";

Don't forget to print the file name and $! in your error message.

  open(APACHECONF, $_[0]) ||
    die "Couldn't open Apache config file '$_[0]'.  $!\n";

> $order = 0;
> while (<APACHECONF>)
> 	{
> 	if (/^<VirtualHost.*>/i)
> 		{
> 		$hoststart[$order] = $.;

You forgot to bump '$order' here also.
See below for how to do it better in any case.

> 		}
> 	if (/<\/VirtualHost>/i)
> 		{
> 		$hostend[$order] = $.;
> 		$order++;

You could write that more succinctly as

            $hostend[$order++] = $.;

or, using Perl (;-):

            push @hostend, $.;

and forget all about $order.

> 		}
> 	}
> close(APACHECONF);

 ...

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 2 May 1999 21:34:46 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: RegEx for matching Mbx "From " delimeter
Message-Id: <7gigdm$c45$1@news.NERO.NET>

In article <1dr4kbj.p02djv49sz3aN@[207.60.170.250]>,
Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote:
>I think you would want to do this in separate steps.  Find the From line
>first, then parse out the pieces...

Just as easy to do it in one pass.

do {
	#start of new message
	$sender = $1;
	$date = $2;
	...
} if /^From\s+(\S+)\s+(.+)/;



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

Date: Sun, 02 May 1999 12:50:31 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: searching perl documentation
Message-Id: <372CAC87.6A28D73E@mail.cor.epa.gov>

lvirden@cas.org wrote:
> 
> According to David Cassell  <cassell@mail.cor.epa.gov>:
> :Ed Bogart wrote:
> :> physio% perldoc Term::Info
> :> No documentation found for "Term::Info".
> :perldoc Term::Info
> :
> :That's the way to use it.  But if your sysadmin [or you] hasn't
> :installed the module, you won't have any docs to be found.  Try
> 
> I have Term::Info installed on my SPARC Solaris system and I get the
> same "No documentation found" error msg myself...

Well, not only can things be `not installed', they can also be
installed in the wrong place, or in the wrong way.  Find where
the Term::Info pod is, so you know where perldoc *should* be
searching.  Then run

perldoc -v Term::Info

and watch where perldoc actually does the search.  Is @INC missing
a directory where things should be searched?  Or does the module
need to be installed so that it's in the right place?

HTH,
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Sun, 02 May 1999 13:56:06 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Throw a person a fish...
Message-Id: <372CBBE6.633E95A@mail.cor.epa.gov>

Uri Guttman wrote:
> 
> >>>>> "TC" == Tom Christiansen <tchrist@mox.perl.com> writes:
> 
>   TC>  [courtesy cc of this posting sent to cited author via email]
>   TC> In comp.lang.perl.misc, Jonathan Stowe <gellyfish@gellyfish.com> writes:
>   TC> :I'm glad I'm not the only one who gets unsolicited requests for help ...
> 
>   TC> You have *NO* *IDEA*. :-(
> 
> not nearly as much as tom but,
> 
> <aol>me too!</aol>

Durn!  That's exactly what I was going to say!

> it seems these types lurk and are to scared to post publicly so they
> pick an apparently nice (well maybe not tom :-) hacker to mail their
> problem directly to.

Exactly.  And since I've supposedly been nicer and more helpful than
some others here lately, I've been getting a few of these.
 
> tom probably get much more since his name is emblazoned on several
> relatively popular perl books. :-)

And even the clueless might realize deep in their brainstems that
a big-name author might know more than some twit they've never
heard of who has a .gov e-mail address.  :-)
 
> we should reply to them that the proper arena for their questions is
> usenet instead of private mail. that shares the load of replying RTFM
> and RTFFAQ to all of us.

I do.  We have to, or else we get more personal posts.  And more.
And *more*.  So I don't want to know how much junk mail Tom gets.
Not that I mind getting e-mail cc's or replies form this ng.  Not
at all.  Just no more of these "I see that you're a nice guy who 
won't sink his fangs into my throat like those *mean* people, so
could you tell me how to write my PERL [sic] code, and please
keep it under 300 lines while you're at it, and no modules because
my ISP is a creep, and ..."

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Sun, 2 May 1999 14:48:37 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Throw a person a fish...
Message-Id: <MPG.11966812578900a9989997@nntp.hpl.hp.com>

In article <372CBBE6.633E95A@mail.cor.epa.gov> on Sun, 02 May 1999 
13:56:06 -0700, David Cassell <cassell@mail.cor.epa.gov> says...
> Uri Guttman wrote:
> > >>>>> "TC" == Tom Christiansen <tchrist@mox.perl.com> writes:
> >   TC> In comp.lang.perl.misc, Jonathan Stowe <gellyfish@gellyfish.com> writes:
> >   TC> :I'm glad I'm not the only one who gets unsolicited requests for help ...
> > 
> >   TC> You have *NO* *IDEA*. :-(
> > 
> > not nearly as much as tom but,
> > 
> > <aol>me too!</aol>
> 
> Durn!  That's exactly what I was going to say!
> 
> > it seems these types lurk and are to scared to post publicly so they
> > pick an apparently nice (well maybe not tom :-) hacker to mail their
> > problem directly to.
> 
> Exactly.  And since I've supposedly been nicer and more helpful than
> some others here lately, I've been getting a few of these.

I get them too, though not many.  I usually suggest that they would get 
better responses by posting their questions.

But this thread has drifted away from the point.  The letter I posted 
was referring to an RTFFAQ response (about sorting) that I gave publicly 
to a post in the newsgroup, thanking me for *not* answering the 
question, because he profited more by reading the FAQ.

I get -- and appreciate -- many thank-you letters.  (Perhaps I am 
inviting them by often sending courtesy copies of public responses by 
email.)  This is the first time I've been thanked for not answering the 
question!

Frequent responders here should be heartened, and occasional submitters 
should be enlightened, by this poster's inquiring attitude.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sun, 02 May 1999 13:41:41 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: unos problemitas
Message-Id: <372CB885.40B980B1@mail.cor.epa.gov>

Tom Christiansen wrote:
> 
>  [courtesy cc of this posting sent to cited author via email]
> 
> In comp.lang.perl.misc, lr@hpl.hp.com (Larry Rosler) writes:
> :"No problemo!" is pure Simpson-speak.

As well as Ahnold-speak [from Terminator 2], and probably half a
dozen other pop-culture refs [and/or riffs].
 
> Hence my complaint.  It's not real.  Now and then I flail
> out at words ignorantly mutilated.  This is one such case.

But I think that in this case, given the context of the
original poster, this was a deliberate attempt at personal
programming entertainment, much like a chunk of [non-Perl] code 
I wrote which had the following error message before aborting:
"DANGER DANGER WILL ROBINSON!! {rest elided}"

I'm willing to cut the poster and subsequent copiers some slack 
on this one.  Or are you going to protest the next time Chip
uses the magic word "Hikeeba!" ?

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Sun, 02 May 1999 19:00:16 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Who is Just another Perl hacker?
Message-Id: <7gi7ac$hd2$1@xenon.inbe.net>

In article <m1hfpvh2jq.fsf@halfdome.holdit.com>, merlyn@stonehenge.com (Randal L. Schwartz) wrote:
[snip]
>So, in answer to your question, feel free to declare yourself a JAPH,
>but most of us around here agree that I'm JAPH # 0. :)

I'll agree with that as long as $[ is 0 :-)

Michel.


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 5544
**************************************

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