[15446] in Perl-Users-Digest
Perl-Users Digest, Issue: 2856 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 24 21:05:29 2000
Date: Mon, 24 Apr 2000 18:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <956624709-v9-i2856@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 24 Apr 2000 Volume: 9 Number: 2856
Today's topics:
( free banner ads for resource sites and scripts ) <green_buck@yahoo.com>
[HD] Re: **Freelancer Required - UK** jvwright@my-deja.com
Re: Aborting a cycling batch program in Perl <rootbeer@redcat.com>
Re: Critique My Code <grichards@flashcom.net>
Re: Critique My Code <grichards@flashcom.net>
Re: Crypt module suggestions <rootbeer@redcat.com>
Re: Crypt module suggestions (Jerome O'Neil)
Re: DBM files and security on the web... <rootbeer@redcat.com>
Re: DBM files and security on the web... <calvsung@hotmail.com>
Re: emulate a browser <nomail@nomail.com>
Re: How to get from STDOUT to browser download? <flavell@mail.cern.ch>
I'm about to lose a client!!! SOMEBODY HELP ME!!! (Lobo)
Re: I'm about to lose a client!!! SOMEBODY HELP ME!!! <makarand_kulkarni@My-Deja.com>
man2html <idontlikespam_jcman@worldnet.att.net>
Re: man2html <rootbeer@redcat.com>
Re: min/max <aqumsieh@hyperchip.com>
Need Help testing a webboard <green_buck@yahoo.com>
Re: Need Help testing a webboard <tony_curtis32@yahoo.com>
Re: Need Help testing a webboard <green_buck@yahoo.com>
Re: Oracle DBI DBM memory leak <rootbeer@redcat.com>
Re: Out of memory! <rootbeer@redcat.com>
Perl grammar? <Tom_Roche@ncsu.edu>
Re: Problem with getting return value from a function c <rootbeer@redcat.com>
SQL get values by column name? (Ken Williams)
Re: URGENT help needed (Ton Hospel)
www.perlmonks.org <makarand_kulkarni@My-Deja.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 24 Apr 2000 19:01:50 -0400
From: "--- CGI Forum ---" <green_buck@yahoo.com>
Subject: ( free banner ads for resource sites and scripts )
Message-Id: <Zp4N4.1625$sf5.58783@nntp0.chicago.il.ameritech.net>
we have built a search directory dedicated to scripts...CGI , MySQL, Java,
PHP and others.
Instead of selling the ad space on our directory, we thought giving it away
to sites that relate to our search categories would add more value to our
directory.
If you have a resource site or a script that you would like to advertise for
free then all you have to do is give us your site URL and your banner URL
and we will advertise it for free.
We will put your ad with 1 million impressions...this way it will rotate on
our directory for a long time.
you can sign up and get your ads running in 24 hours :
http://www.cgiforum.com/control/create.html
Take me serious on this offer I really mean it. Your site must be related
to our directory please do not submit sites that do not fit in. Thanks
--
Alex Cron
- http://www.cgiforum.com -
------------------------------
Date: Mon, 24 Apr 2000 22:58:29 GMT
From: jvwright@my-deja.com
Subject: [HD] Re: **Freelancer Required - UK**
Message-Id: <8e2jii$i6r$1@nnrp1.deja.com>
Hi Dave,
For urgent problems you need done quickly, you might consider
HotDispatch. HotDispatch is a marketplace for programmer expertise
where questions often receive responses in less than an hour, and
small programming projects are often completed in less than 24 hours.
From among the hundreds of Perl programmers that have already
signed up, someone is likely to be available to solve your problem
quickly.
HotDispatch includes an escrow service that takes care of the
accounting, so that you can pay for speedy solutions and tip for
heroic answers, without the overhead of getting physical addresses,
writing out a check, addressing an envelope, and finding a mailbox ---
all the things no one has time for during a time crunch.
HotDispatch: the Market for Technical Expertise
http://www.hotdispatch.com/home?aff=32819422
http://www.hotdispatch.com/IBM/home?aff=32819422
(...to solve problems quickly, offer quick rewards in return...:)
--- jvwright
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 24 Apr 2000 15:14:24 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Aborting a cycling batch program in Perl
Message-Id: <Pine.GSO.4.10.10004241511420.25963-100000@user2.teleport.com>
On Mon, 24 Apr 2000 iforsyth@my-deja.com wrote:
> What I would like to have is a way for a user to do a keyboard hit and
> stop the program. I checked the FAQ, and attempted to do a sysread
> after putting the PC in raw mode; however, I couldn't seem to detect
> the keyboard hit when I tested for it later in the program. I suspect
> this is due to the program cycling at such a fast rate, but I'm unsure.
Did you use Term::ReadKey? I think that should work. If it does work, it's
probably the best way. If it doesn't, well, maybe we should try to make it
work. :-) Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 24 Apr 2000 15:13:22 -0700
From: "Gabe" <grichards@flashcom.net>
Subject: Re: Critique My Code
Message-Id: <sg9hj7iccdo19@corp.supernews.com>
<nobull@mail.com> wrote in message news:u9g0sbml3f.fsf@wcl-l.bham.ac.uk...
> "Gabe" <grichards@flashcom.net> writes:
> > Are there better methods to do what I'm trying
> > to do?
>
> GCI.pm provides methods to compose HTML and I notice that you've not
> used them and generate HTML on-the-fly bit by bit in loops. Generally
> I prefer to build lists then use the fuctions in GCI.pm to build the
> HTML. Looks neater (runs slower).
I tried to get my mind around the CGI.pm HTML commands, but I gave up real
quickly and figured it would be easier to read it in from a file. Plus I had
already written the HTML, I didn't want to do it again in PERL.
> Spaces after the # make comments more readable.
Good call.
> > $request and $page.
>
> And keep lines down to about 70 characters - especially if you ever
> post code to Usenet.
I figured that would be a problem, didn't know how many characters was a
good number.
> > use lib '/home/mopicmag/www/modules';
>
> Usually better to manipulate PERL5LIB outside Perl if you can.
> Depends on you HTTP server s/w. If you can't manipulate PERL5LIB then
> "use lib" is the next best thing.
I didn't know you could manipulate PERL5LIB outside PERL.
> >
> > main: {
> > &event;
>
> It's generally considered better style to declare your subroutines
> before you use them rather than need to put in an explict & in the
> call.
How do I declare my subroutines before I use them? Once I declare them, how
do I use them without using &?
> What's that label for anyhow?
Honestly, I didn't know that's what it was. I saw it on an old program I
learned from, and have used that syntax to run my subprocedures.
> It's probably better to my() these within the loop -- loose the above
line.
Another good call.
> > #If $request matches, and there are more "pages" flag $more.
> > if ($dir eq $request) {
> > if ($loc == ($page+1)) { $more = 1;}
> > }
> >
> > #If 5 images have printed and there are more pages print the link and
exit
> > the loop.
> > if ($counter == 5) {
> > if ($more == 1) {
>
> As far as I can see $more is being treated as Boolean. If this is the
> case then it would be more readable to simply say:
> if ($more) {
You're right, I had thought about that, but was unsure of the syntax.
> Most people would say:
> my $img = "${path}a.jpg";
Cool. I was unfamiliar with that syntax.
Hey, thanks for your good response!
Gabe
------------------------------
Date: Mon, 24 Apr 2000 15:14:44 -0700
From: "Gabe" <grichards@flashcom.net>
Subject: Re: Critique My Code
Message-Id: <sg9hloi5cdo40@corp.supernews.com>
"Tom Briles" <sariq@texas.net> wrote in message
news:3904999C.821D0FA9@texas.net...
> You'll want to turn on warnings and taint checking here (-wT).
I've read the docs on the taint switch, but I don't understand it. What does
it do? Why is it useful?
Gabe
------------------------------
Date: Mon, 24 Apr 2000 15:32:28 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Crypt module suggestions
Message-Id: <Pine.GSO.4.10.10004241522130.25963-100000@user2.teleport.com>
On Mon, 24 Apr 2000, Veronica Adams wrote:
> I will be encryoting credit card information. Anybody have any suggestions
> on which of the various crypt modules to use? Which ones to avoid? or a
> favorite for any of you old hats?
These are good questions, but it's like saying, "I'm going to be fixing my
house up this weekend. Any ideas which tools I should use?" :-)
If you're wanting to encrypt these so that, in case someone hacks into
your machine, your customers' credit card numbers won't be revealed: Don't
do it that way. Put the secret information onto another machine, behind a
firewall which lets the data go through one-way only.
If you're wanting your users to be able to work with you over an encrypted
web connection, you should probably search for the docs, FAQs, and
newsgroups about web servers and how to make secure web connections.
If you're wondering, "How can I tell which encryption methods are just
snake oil?" you should probably find an encryption expert to advise you.
My favorite encryption module is, of course, Crypt::Rot13. What I like
most is the author's attempts to keep it up-to-date: It's already at
version 0.6!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 24 Apr 2000 23:09:09 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: Crypt module suggestions
Message-Id: <pu4N4.749$qg7.7107@news.uswest.net>
In article <Pine.GSO.4.10.10004241522130.25963-100000@user2.teleport.com>,
Tom Phoenix <rootbeer@redcat.com> writes:
> On Mon, 24 Apr 2000, Veronica Adams wrote:
> My favorite encryption module is, of course, Crypt::Rot13. What I like
> most is the author's attempts to keep it up-to-date: It's already at
> version 0.6!
Of course, all the real crypto experts are using ROT26 these days.
Another breakthrough from Redmond, I think.
------------------------------
Date: Mon, 24 Apr 2000 15:43:18 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: DBM files and security on the web...
Message-Id: <Pine.GSO.4.10.10004241537090.25963-100000@user2.teleport.com>
On Mon, 24 Apr 2000 but86@my-deja.com wrote:
> I am developing a larger web based system.
Larger? Larger than what? Larger than the web? :-)
> how can i prevent bad hackers from downloading the .dir and .pag
> files since they have to be readable/writable?
Don't give them to your webserver, if you don't want the webserver to give
them out. There are three categories of "stuff" for webservers to work
with:
1. Documents to serve. This includes HTML, text, images, and so on.
These things are never run as programs, and none should be secret,
since the server will gladly give them all away.
2. Programs. These are run, never served. (So, you know that your
source code isn't being given out.) Program files and
directories should not be writable by the webserver process.
3. Data. These are never accessed directly by the webserver, but
only by the programs. Data files and directories are generally
writable and readable by the webserver process.
Of course, this has nothing to do specifically with Perl; it's about how
to set up a webserver. So I've set follow-ups, in case there is any
Perl-specific follow up. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 25 Apr 2000 06:46:30 +0800
From: "Calvin" <calvsung@hotmail.com>
Subject: Re: DBM files and security on the web...
Message-Id: <8e2im1$524$1@eng-ser1.erg.cuhk.edu.hk>
You can place your data files in a directory that is not readable by web
server.
ie. not inside $home/public_html, htdocs, cgi-bin, .....
and then use absolute path in your perl program to access the data files.
Best regards,
Calvin Sung
> I am developing a larger web based system. In order to save
> configuration data, I would like to use the standard sdbm file class.
> but how can i prevent bad hackers from downloading the .dir and .pag
> files since they have to be readable/writable?
> requiring a normal file with a normal hash declaration would do the
> same, but that isn`t so nice.
------------------------------
Date: Mon, 24 Apr 2000 17:19:18 -0400
From: "Jonah" <nomail@nomail.com>
Subject: Re: emulate a browser
Message-Id: <8e2o71$2du0$1@onlink3.onlink.net>
Jeff Zucker <jeff@vpservices.com> wrote in message
news:39036D4D.8BA3DBDE@vpservices.com...
> Jonah wrote:
> >
> >Jeff Zucker wrote:
> > >
> > > Ignoring threading bad.
> > >
> >
> > should have read a faq on usenet, sorry.
>
> No probelm, was only pointing it out for future reference. (But reading
> a usenet faq *is* a good idea.)
>
> > But LWP returns the reponse, and I'm not sure if that would be ok if x
> > script happen to be processing an order....
> >
> > I just want to write data to a file before the form gets processed by x
> > script, without having
> > to interfere with the x script in any way.
>
> Ok, let me paraphrase:
>
> 1. user submits form
>
> 2. script A gets data from form
>
> 3. script A writes data from form to database
Actually I won't be processing the form data at all,
all I'm doing is recording that the form was filled out, like
a logfile of sorts.
>
> 4. script A sends data from form off to process B
>
> 5. process B processes data and returns a success or failure code to
> script A
>
> 6. based on the value of that code, script A writes a "request
> completed" or a "could not complete your request" message to user
>
> Several issues here: If process B is a CGI script that expects to
> recieve form data, then LWP is a good way to pass it information on step
> 4. If it is some other kind of process, then you may be better off
> decoding the form data in script A and passing it as parameters through
> one of Perl's system functions (exec, system, qx(), backticks, depending
> on your needs).
The script will expect form data. That's the only thing I know about it.
I don't know what language it will be in, or what it will do, but I know
it will be processing form data, doing something with it, then returning
a reponse to the user.
> If process B either doesn't return a sucess/failure
> code (how impolite)
>or if it is a process that runs a long time, you may
> not want to wait for it to complete and instead have script A just send
> the data to process B, write a "request submitted" message to the user,
> and end.
Process B has to return a response because that's what it does. Whatever
it is, I"m assuming that it works. If it's an order form, it will write a
"order submitted, blah blah"
message.
> > I don't like how it [LWP] returns ..... (control?) back to my
script....I want
> > to just do my thing then send the data from the form off on it's merry
way
> > I don't think I want my script to have control when it's an order
form...
> > it just doesn't seem like the right thing to do.
>
> When script A waits for an LWP response from process B, it does not
> "have control" over process B. It is just waiting until process B
> returns something.
Ok, I understand, but I want to make sure of something here.
let's take out script A for a second.
There's a form somewhere on someone's website, let's say it's an order form.
In normal circumstances..
1) customer fills out the form and presses submit
2) the script (whatever language) processes the order
3) the script writes a confirmation message to the customer, like an html
page.
Are you saying that I can use LWP to do the same thing?
example, with my script:
1) customer fills out the form and presses submit
2) my script writes data to a file
3) my script passes the orginal form data, untouched, as if it came straight
from the form (because that's what it
expects) to the other script
4) the script (whatever language) processes the order
5) the script returns the response, which, under normal circumstances, is a
confirmation
message as an html page to be viewed by the customer with a browser, but,
instead, it will return that same response
to my script and,
6) my script in turn, then receives and prints this response and everything
is fine?
If it can be that simple, I'm jumping up and down in excitement!
I'm asking because I can't go out and test every single order form that's on
the net.
(order forms worry me the most, can't you tell?) or test all mailing list
managers,
or whatever the script happens to be.
Basically, if it's a form and it runs a script and returns a response, I
want mine in there doing its thing
as an intervention to the original script that was there, whatever it is.
I've tested this on a simple form that prints out the form contents, and
that leads
me to conclude that LWP could work with practically anything, but I need to
be sure.
thanks very much for your help!
------------------------------
Date: Tue, 25 Apr 2000 00:32:01 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: How to get from STDOUT to browser download?
Message-Id: <Pine.GHP.4.21.0004250019020.21394-100000@hpplus01.cern.ch>
On Mon, 24 Apr 2000, Todd Bair wrote:
> How do I force a download without changing the page location?
Hold the shift key down when selecting the link?
Of course, "force" doesn't work on the WWW.
> So far I have...
OK, but the point is that your program executes, and writes a data
stream to the web server, which passes it using standard web
protocols, over the net to the client. It matters not whether you are
writing in COBOL, Perl or DOS Batch, as far as the client is
concerned - it only gets your HTTP protocol stream and content body.
So the answer to your question does not lie with the Perl language,
but with comp.infosystems.www.authoring.cgi. There are FAQs (e.g at
http://www.htmlhelp.org ) that can help you get up to speed on those
issues.
I would predict that you're going to conclude that if the document
would be otherwise displayed in the browser, and if the users don't
know how to tell the browser they want it in a disk file instead (then
what the heck use could such naive users have for a downloaded file
anyway, ferchrissake?), you're going to have to provide them with two
different URLs to the same data. And that's true with conforming WWW
clients just as much as it is for that protocol-violating browser-like
thing called Win IE. It's not a Good Thing in web terms, because of
cacheability, but if you really can't educate your users in such a
little thing, I suppose you have to do what you have to do.
all the best
------------------------------
Date: Tue, 25 Apr 2000 00:49:57 GMT
From: er@matrix.com.br (Lobo)
Subject: I'm about to lose a client!!! SOMEBODY HELP ME!!!
Message-Id: <3904e6ec.1931453@news.matrix.com.br>
Please, it can't be THAT hard...
I'm trying to display the contents of a Pipe Separeted Values TXT file
to a page, but I keep receiving Internal Server Errors!!!!
Here's my COMPLETE code:
#!/usr/bin/perl
$temp=$ENV{'QUERY_STRING'};
@pairs=split(/&/,$temp);
foreach $item(@pairs) {
($key,$content)=split (/=/,$item,2);
$content=~tr/+/ /;
$content=~ s/%(..)/pack("c",hex($1))/ge;
$fields{$key}=$content;
}
$txt = $fields{'file'}.".txt";
print "Content-type:text/html\n\n";
open (TXT, '$txt');
@array = <TXT>;
foreach $line(@array) {
chomp($line);
print "$line\n";
}
close (TXT);
This should, I guess, display the contents WITH the pipes... but it
doesn't work.
And please folks, if you cand be this kind to me, explain how to
remove the pipes too, PLEASE!
It has something to do with "=~tr/|/ /;", right???
PLEAAAASE!!!!!!!
------------------------------
Date: Mon, 24 Apr 2000 18:04:30 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: I'm about to lose a client!!! SOMEBODY HELP ME!!!
Message-Id: <3904EF1E.6F41284B@My-Deja.com>
> open (TXT, '$txt');
this line is suspicous.
Replace with
open ( TXT, $txt ) or die " cannot open this file " ;
drop the single quotes around $txt
--
------------------------------
Date: Mon, 24 Apr 2000 23:18:08 GMT
From: "Ira Weiner" <idontlikespam_jcman@worldnet.att.net>
Subject: man2html
Message-Id: <QC4N4.33179$WF.1531439@bgtnsc04-news.ops.worldnet.att.net>
I recently installed this on my linux machine to convert man pages to an
easily readable HTML doc. But I am unable to get it to work. I can run
other CGI scripts, so I don't think it is a web server or permissions
problem. Has anyone else gotten this perl script to work?
------------------------------
Date: Mon, 24 Apr 2000 17:17:22 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: man2html
Message-Id: <Pine.GSO.4.10.10004241717030.25963-100000@user2.teleport.com>
On Mon, 24 Apr 2000, Ira Weiner wrote:
> I recently installed this on my linux machine to convert man pages
> to an easily readable HTML doc. But I am unable to get it to work.
> I can run other CGI scripts, so I don't think it is a web server or
> permissions problem. Has anyone else gotten this perl script to work?
Is that a CGI program?
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.
http://www.perl.com/CPAN/
http://www.cpan.org/
http://www.cpan.org/doc/FAQs/cgi/idiots-guide.html
http://www.cpan.org/doc/manual/html/pod/
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 25 Apr 2000 00:15:45 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: min/max
Message-Id: <7a3dob9gsv.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>
"Dimitri Ostapenko" <dimitrio@perlnow.com> writes:
> is there a better (shorter) way to get min/max of 2/many values without
> loading any modules ?
>
> I use : $min = ($a>$b)?b:a; for 2 values
>
> and (sort {$a<=>$b} @nums)[0]; for many
>
> while 2-nd seems concise enough for what it does, I'm too lazy and curious
> about the 1st.
Here's a cool variant:
$min = [$a => $b] -> [$b <= $a];
--Ala
------------------------------
Date: Mon, 24 Apr 2000 18:45:38 -0400
From: "--- CGI Forum ---" <green_buck@yahoo.com>
Subject: Need Help testing a webboard
Message-Id: <Na4N4.1592$sf5.59789@nntp0.chicago.il.ameritech.net>
Need help testing this web board...I need to know if there is any
registration or posting errors...any feedback is appreciated
http://www.cgiforum.com/ubbcgi/Ultimate.cgi
--
Alex Cron
- http://www.cgiforum.com -
------------------------------
Date: 24 Apr 2000 17:50:36 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Need Help testing a webboard
Message-Id: <87r9bvqfk3.fsf@shleppie.uh.edu>
>> On Mon, 24 Apr 2000 18:45:38 -0400,
>> "--- CGI Forum ---" <green_buck@yahoo.com> said:
> Need help testing this web board...I need to know if
> there is any registration or posting errors...any
> feedback is appreciated
> http://www.cgiforum.com/ubbcgi/Ultimate.cgi
perl relevance = 0
Try comp.infosystems.www.authoring.cgi
t
------------------------------
Date: Mon, 24 Apr 2000 19:05:32 -0400
From: "--- CGI Forum ---" <green_buck@yahoo.com>
Subject: Re: Need Help testing a webboard
Message-Id: <pt4N4.1636$sf5.46659@nntp0.chicago.il.ameritech.net>
Sorry I will... thanks
Tony Curtis <tony_curtis32@yahoo.com> wrote in message
news:87r9bvqfk3.fsf@shleppie.uh.edu...
> >> On Mon, 24 Apr 2000 18:45:38 -0400,
> >> "--- CGI Forum ---" <green_buck@yahoo.com> said:
>
> > Need help testing this web board...I need to know if
> > there is any registration or posting errors...any
> > feedback is appreciated
>
> > http://www.cgiforum.com/ubbcgi/Ultimate.cgi
>
> perl relevance = 0
>
> Try comp.infosystems.www.authoring.cgi
>
> t
>
>
------------------------------
Date: Mon, 24 Apr 2000 15:35:29 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Oracle DBI DBM memory leak
Message-Id: <Pine.GSO.4.10.10004241533060.25963-100000@user2.teleport.com>
On Mon, 24 Apr 2000 taric@purpletunic.com wrote:
> I may have found a memory leak in DBI or DBM:Oracle
> My system is: DEC Alpha, Perl version 5.004_04, and
> Oracle 8.0.5.
> I am hoping to upgrade to Oracle 8i and the latest version of Perl
> early next year, perhaps that will fix it.
Why wait so long to use 5.6.0? Sure, I can understand if you're worried
about bugs that could imperil production. But you can (and probably
should) install it for testing without removing 5.004_04. If everything
works, of course, there's no reason to keep running 5.004_04 at that
point.
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 24 Apr 2000 16:01:56 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Out of memory!
Message-Id: <Pine.GSO.4.10.10004241550470.25963-100000@user2.teleport.com>
On Mon, 24 Apr 2000 vinman72@my-deja.com wrote:
> Having a big problem with this since it's incredibly frustrating! I get
> an "Out of memory!" by simply reading in a 35MB file into a variable.
Patient: I get shooting pains in my back whenever I stand up.
Doctor: Stop doing that, then.
Maybe you shouldn't be trying to read 35MB into a variable all at once, at
least maybe you shouldn't do that in Perl. Perl's general rule is to trade
memory for time, on the theory that you _can_ get more memory.
> 1) Initialize variables to null
> 2) I read in one file (35MB) into a variable
> 3) I do some parsing near the end of the file
> 4) I append (or create if non-existing) to another file
> 5) Process next file
If you're merely doing some work near the end of the file, do you really
need it all in memory at once? You may be able to do something simpler.
> open (OUTFILE, ">/collector/test.ver");
Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.
> $contents = \0;
> $newcontents = \0;
"I do not think that means what you think it means."
Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 24 Apr 2000 13:16:53 -0400
From: Tom Roche <Tom_Roche@ncsu.edu>
Subject: Perl grammar?
Message-Id: <39048185.B78D5F31@ncsu.edu>
Paul Kinnucan <paulk@mathworks.com> 4/24/00 12:33:10 PM >>>
> I am currently experimenting with the bovinator, Eric Ludlam's new
> parser generator for Emacs. The bovinator is conceptually similar to
> yacc and bison. It accepts a BNF grammar and outputs a parser for a
> language that conforms to that grammar. The beauty of the bovinator
> is that the parsers emitted by the bovinator are coded in Emacs Lisp
> rather than C. This means that Emacs can run the parser directly
Does anyone know where I might find a BNF (or other) grammar for Perl?
I see
http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html
> Can I get a BNF/yacc/RE for the Perl language?
> No, in the words of Chaim Frenkel: ``Perl's grammar can not be
> reduced to BNF. The work of parsing perl is distributed between
> yacc, the lexer, smoke and mirrors.''
OTOH, it also says
> perlfaq - frequently asked questions about Perl ($Date: 1997/03/17
> 22:17:56 $)
so I'm wondering if anything has changed in the past three years.
("Yes, it's gotten even more obtuse" :-)
I'm currently trying to defined the regexps to identify subroutine
calls in static sources, and this might help. Also, longer-term I'd
<cough><blush><feeling of complete inadequacy> like to work on a Perl
Development Environment for Emacs (a la Kinnucan's JDE).
TIA, Tom_Roche@ncsu.edu
------------------------------
Date: Mon, 24 Apr 2000 15:20:33 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Problem with getting return value from a function call
Message-Id: <Pine.GSO.4.10.10004241520070.25963-100000@user2.teleport.com>
On Mon, 24 Apr 2000, Chris Lacey wrote:
> I am having problems getting a value returned from the function.
Have you seen the perlsub manpage? Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 25 Apr 2000 00:57:23 GMT
From: tekkin@hotmail.com (Ken Williams)
Subject: SQL get values by column name?
Message-Id: <sg9rcf1ucdo15@corp.supernews.com>
The following is in PHP I think:
<?
$sql_result = mysql_query($sql,$connection)
or die("Couldn't execute query");
while ($row = mysql_fetch_array($sql_result)) {
// more code here
}
$coffee_name = $row["COFFEE_NAME"];
$roast_type = $row["ROAST_TYPE"];
$quantity = $row["QUANTITY"];
?>
How can I do the same in perl? Get the results from the select by column name
not $row[0] as I usually do.
Thanks.
------------------------------
Date: 24 Apr 2000 21:22:27 GMT
From: thospel@mail.dma.be (Ton Hospel)
Subject: Re: URGENT help needed
Message-Id: <8e2duj$ou1$1@post.home.lunix>
In article <8e0vr4$go$1@orpheus.gellyfish.com>,
Jonathan Stowe <gellyfish@gellyfish.com> writes:
> On Mon, 24 Apr 2000 07:15:45 GMT Lobo wrote:
>> Hi there.
>>
>> I'm trying to open a .shtml file from a perl script. The filename come
>> from a form, like this:
>>
>> <input type="hidden" name="file" value="foo">
>>
Also note that you are putting the filename under user control here.
You may be generating a neat form with a safe filename, but that is not
necessarily what your program will get back. The browser/hacker can return
any field values it damn well likes.
Your web server will probably make sure that the leak remains restricted
to the files in the browser tree the user was allowed to view anyways, but it's
not a good thing to depend on that kind of precission of all your tools.
(it's semi OK if you do (as proposed) a redirect, but if at some point
you decide to generate the page yourself, the hole suddenly widens).
You probably want to rethink the way your filename gets generated/passed.
--
Someday we'll all look back at this, laugh nervously and change the subject.
------------------------------
Date: Mon, 24 Apr 2000 17:59:25 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: www.perlmonks.org
Message-Id: <3904EDED.AC397DDA@My-Deja.com>
I came across this website
www.perlmonks.org
for the perl user. Worth a visit.
--
------------------------------
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 V9 Issue 2856
**************************************