[19772] in Perl-Users-Digest
Perl-Users Digest, Issue: 1967 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 20 11:05:48 2001
Date: Sat, 20 Oct 2001 08:05:10 -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: <1003590310-v10-i1967@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 20 Oct 2001 Volume: 10 Number: 1967
Today's topics:
(Perl) WWW-Authenticate: NTLM using LWP::* or Net::* ?? <sneex@fccj.org>
Re: [NEWBIE] How to work with a FoxPro database with Pe <kharrison@icshq.com>
Re: Attach a file to email (BUCK NAKED1)
Re: Can't get the output for shell command from CGI <goldbb2@earthlink.net>
Re: Config data not as text file but as module code -- <markus.cl@gmx.de>
Re: Config data not as text file but as module code -- <comdog@panix.com>
Config data not as text file but as module code <markus.cl@gmx.de>
Re: Config data not as text file but as module code <comdog@panix.com>
Edit In-Place Help <busterb@hotmail.com>
Re: Fork messes up parent file handle? <je@brighton.ac.uk>
Re: Fork messes up parent file handle? <je@brighton.ac.uk>
GD::Graph <rgaray@devetel.cl.nospam>
good or bad code? <jens@irs-net.com>
Re: good or bad code? (Stephen Patterson)
Re: good or bad code? <jens@irs-net.com>
Help please with formmail <angusmann@pobox.com>
Re: Help please with formmail <tintin@snowy.calculus>
Re: Help please with formmail <matthew@perthonline.net>
Re: How can you sort a CSV file by diffrent fields ?? <goldbb2@earthlink.net>
Re: How to display text file in cgi-bin? <please@no.spam>
Re: How to display text file in cgi-bin? (Mark Taylor)
Re: How to display text file in cgi-bin? <mail@mail.com>
Re: How to display text file in cgi-bin? <mail@mail.com>
How to use a hash in the value field of a hash? <penton@hyperformix.com>
Re: How to use a hash in the value field of a hash? <joe+usenet@sunstarsys.com>
Re: How to use a hash in the value field of a hash? <comdog@panix.com>
How to using Perl to kill Cookie on website ? <peter.cch@lycos.com>
Re: How to using Perl to kill Cookie on website ? <comdog@panix.com>
Re: need Regular Expression help <brian@jankoNOnet.SPAMcom.INVALID>
Re: Opening files... <tintin@snowy.calculus>
Pls, help me with XML parser!!! <viphub@hotmail.com>
Re: putting $1..$9 into a replacement string such as $r <pne-news-20011020@newton.digitalspace.net>
Re: regexp : "x or nothing" <goldbb2@earthlink.net>
Re: SOAP Web Services Mailing List <dh801@gmx.net>
Vcard <sean@industrial.bc.ca>
Re: what happened to (BUCK NAKED1)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 20 Oct 2001 14:01:38 GMT
From: Bill Jones <sneex@fccj.org>
Subject: (Perl) WWW-Authenticate: NTLM using LWP::* or Net::* ???
Message-Id: <B7F6FC63.3DEC%sneex@fccj.org>
Subject: (Perl) WWW-Authenticate: NTLM using LWP::* or Net::* ????
Is there a way to perform NTLM WWW-Authentication via LWP::* or Net::* ???
I am on Solaris 8 talking to IIS/5.0 w/WebServices; I've been trying (Perl)
LWP::* with Soap::Lite; but I keep getting the following error:
GET
http://207.203.95.95/bill/BrokerEmployee.asmx/ClassRoster?strBrokerID=ETB251
&strClassReferenceNumber=138887&strTerm=20021 --> 401 Access Denied
Connection: close
Date: Sat, 20 Oct 2001 04:10:10 GMT
Server: Microsoft-IIS/5.0
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
Content-Length: 3643
Content-Type: text/html
Content-Type: text-html; charset=Windows-1252
Client-Date: Sat, 20 Oct 2001 04:08:53 GMT
Client-Request-Num: 1
Client-Warning: Unsupported authentication scheme 'ntlm'
Title: You are not authorized to view this page
X-Meta-ROBOTS: NOINDEX
<HTML>
<HEAD><TITLE>An Error Occurred</TITLE></HEAD>
<BODY>
<H1>An Error Occurred</H1>
401 Access Denied
</BODY>
</HTML>
I need to pass three things: UID, PWD, and Domain/Realm as MD5/Digest (not
sure about that.) I've found very little in the way of either discussion or
documentation.
Also, I guess ultimately, I want to talk to it via SSL (if I ever get into
production :( Anyhow, any insight, thoughts, or comments would be most
welcome :)
Thx!
-Sx- :]
------------------------------
Date: Sat, 20 Oct 2001 09:54:19 -0400
From: Keith Harrison <kharrison@icshq.com>
Subject: Re: [NEWBIE] How to work with a FoxPro database with Perl ?...
Message-Id: <MPG.163b4c18260fbf798968f@msunews.cl.msu.edu>
Check out the book Programming the Perl DBI by Descartes & Bunce.
> Hello,
>
> Does anyone over here know how (if it's possible) to work with FoxPro
> databases with Perl ?... Every suggestion is welcome.
>
> Thanks and Regards,
>
> KR
> ==
>
>
------------------------------
Date: Sat, 20 Oct 2001 02:02:33 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Attach a file to email
Message-Id: <9020-3BD12189-4@storefull-248.iap.bryant.webtv.net>
andrew.hutchinson@mcmail.vanderbilt.edu (Andrew=A0Hutchinson)
Hi Andrew,
Vanderbilt, eh? I was wondering if there were any other perlers in
Nashville.
--Dennis (aka whataman@home.com)
------------------------------
Date: Sat, 20 Oct 2001 00:26:54 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Can't get the output for shell command from CGI
Message-Id: <3BD0FD0E.B5DF995B@earthlink.net>
Carfield Yim wrote:
>
> > Try the code above, and tell me what your results are.
>
> A blank page with no warning, I think replace exec() to system() might
> help. Anyway, thx for your help
What do you mean "no warning?" Is there nothing at all in the error
log?
And the exec() is there for a reason. Learn what that reason is before
you go and change it to a system(). A tiny miniscule amount of applied
thought shows what the problem is:
exec( qw( /usr/local/bin/java2html
--title "powered by java2html from gun.org"
) );
Should be:
exec( qw( /usr/local/bin/java2html
--title ), "powered by java2html from gun.org"
);
Changing from exec to system would not have fixed this.
--
"What does stupid old man mean pidgin talk?
Shampoo does not talk like a bird."
------------------------------
Date: Sat, 20 Oct 2001 12:12:53 +0200
From: "Markus Dehmann" <markus.cl@gmx.de>
Subject: Re: Config data not as text file but as module code -- Oops!
Message-Id: <9qrirr$qjmr4$1@ID-101658.news.dfncis.de>
> Now I rewrote my data in the config file directly as a perl hash
structure.
> I turned my config file directly into a perl module that exports a hash
with
> the certain data stored. My config file (now "Data.pm") looks like this:
> package Data;
> ... Exporter...
> %hash = ( key1=>[[1,2],[3,4],[4,5]], key2=>... );
> 1;
Oops, now I saw when my module Data.pm is about 20MB, it can't be used. My
script with "use Data;" is killed by the system.
Why this? It shouldn't be a problem for the interpreter to read 20 MB,
right?
My first method (just to use a data file with 20 MB) works. Why doesn't the
module work, then, that stores the same amount of data??? Because I used
"Exporter" to export the hash from the module?
------------------------------
Date: Sat, 20 Oct 2001 10:49:57 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: Config data not as text file but as module code -- Oops!
Message-Id: <comdog-0DE686.10495720102001@news.panix.com>
In article <9qrirr$qjmr4$1@ID-101658.news.dfncis.de>, "Markus Dehmann"
<markus.cl@gmx.de> wrote:
> Oops, now I saw when my module Data.pm is about 20MB, it can't be used. My
> script with "use Data;" is killed by the system.
what do you mean "killed by the system". you'll need to speak in
something other than metaphors to help us help you. ;)
> Why this? It shouldn't be a problem for the interpreter to read 20 MB,
> right?
maybe. there are a variety of things that could be causing problems,
including quotas, available memory, and so on.
> My first method (just to use a data file with 20 MB) works. Why doesn't the
> module work, then, that stores the same amount of data??? Because I used
> "Exporter" to export the hash from the module?
it's time for the nitty gritty debugging. go through everything
methodically and see what you find. :)
--
brian d foy <comdog@panix.com> - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: Sat, 20 Oct 2001 11:42:51 +0200
From: "Markus Dehmann" <markus.cl@gmx.de>
Subject: Config data not as text file but as module code
Message-Id: <9qrh3h$poj5d$1@ID-101658.news.dfncis.de>
I have several MB of data for a perl script. At first, I stored it in a
config file and let my script read it into a hash while runtime.
Config File:
key1;1/2,3/4,4/5 ...
Built hash in script:
%hash = ( key1=>[[1,2],[3,4],[4,5]], key2=>... );
This works but access to this hash is slow.
Now I rewrote my data in the config file directly as a perl hash structure.
I turned my config file directly into a perl module that exports a hash with
the certain data stored. My config file (now "Data.pm") looks like this:
package Data;
... Exporter...
%hash = ( key1=>[[1,2],[3,4],[4,5]], key2=>... );
1;
Using this module the access to data is twice as fast cmopared with using
the simple config file and building a hash from the data while runtime.
But why? I thought, in the end, the data is stored the same way in both
methods and uses the same amount of memory...
------------------------------
Date: Sat, 20 Oct 2001 10:47:13 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: Config data not as text file but as module code
Message-Id: <comdog-4C388E.10471320102001@news.panix.com>
In article <9qrh3h$poj5d$1@ID-101658.news.dfncis.de>, "Markus Dehmann"
<markus.cl@gmx.de> wrote:
> I have several MB of data for a perl script. At first, I stored it in a
> config file and let my script read it into a hash while runtime.
> This works but access to this hash is slow.
you're parsing several MBs of data.
> Now I rewrote my data in the config file directly as a perl hash structure.
> Using this module the access to data is twice as fast cmopared with using
> the simple config file and building a hash from the data while runtime.
you don't have to parse the data this way.
> But why? I thought, in the end, the data is stored the same way in both
> methods and uses the same amount of memory...
but the first way does a lot more work.
if you want to see where all of the time is spent you can use
a Perl profiler.
http://www.ddj.com/columns/perl/2001/0104pl001/0104pl001.htm
--
brian d foy <comdog@panix.com> - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: Sat, 20 Oct 2001 10:53:00 GMT
From: "Buster Bunker" <busterb@hotmail.com>
Subject: Edit In-Place Help
Message-Id: <gIcA7.21868$%B6.6460307@typhoon.southeast.rr.com>
I am trying to write a simple in-place edit of some files (e.g.
*.txt), but I am having trouble getting the part where it writes the
file. I can only get it to write to the screen. Can someone suggest
to me a method to do this?
Much appreciated.
use strict;
use warnings;
my @args = splice(@ARGV,0);
my $previous_file = "";
$/ = undef;
foreach my $arg (@args) {
push(@ARGV,glob($arg));
}
my $mcount = 0;
while (<>) {
my $s = <>;
$mcount += ($s =~ s/XYZ/ABC/ig);
if ($ARGV ne $previous_file) {
print "File: $ARGV $mcount \n" ;
}
print $s; # Print this to file ?
$previous_file = $ARGV;
}
------------------------------
Date: Sat, 20 Oct 2001 15:05:13 +0100
From: John English <je@brighton.ac.uk>
Subject: Re: Fork messes up parent file handle?
Message-Id: <3BD18499.47A5308D@brighton.ac.uk>
Chris Fedde wrote:
>
> In article <3BD073A8.59553E8@brighton.ac.uk>,
> John English <je@brighton.ac.uk> wrote:
> >I have a script which reads lines from a config file and forks off
> >a seaparate child process for each line:
> >
> > while (<IN>) {
> > $pid = fork;
> > if ($pid) {
> > &do_parent_stuff;
> > }
> > elsif (defined($pid)) {
> > &do_child_stuff;
> > last;
> > }
> > else {
> > die "horribly";
> > }
> > }
> > close IN;
> >
> >(Other stuff, like zombie reaping, is done but not shown here...)
> >
>
> You probably want the child to exit(0) after the do_child_stuff rather than
> last.
When it falls out of the loop there's some common cleanup for both
parent and child (close IN; a few other details; then exit), so I
was trying to avoid code duplication. However, I did try putting all
the cleanup stuff (and exit) inside do_child_stuff, and it makes no
difference at all.
The child is not the problem here. The children all work fine. It's
the parent's copy of the file handle that gets messed up while the
parent is going round the loop. It only happens when forking >2-ish
children. Why should forking a child affect the parent's copy of a
file handle?
Thanks anyway, and it's good to know it's not just me missing something
obvious to everyone else...
-----------------------------------------------------------------
John English | mailto:je@brighton.ac.uk
Senior Lecturer | http://www.comp.it.bton.ac.uk/je
Dept. of Computing | ** NON-PROFIT CD FOR CS STUDENTS **
University of Brighton | -- see http://burks.bton.ac.uk
-----------------------------------------------------------------
------------------------------
Date: Sat, 20 Oct 2001 14:59:37 +0100
From: John English <je@brighton.ac.uk>
Subject: Re: Fork messes up parent file handle?
Message-Id: <3BD18349.10CFBCAE@brighton.ac.uk>
Joe Smith wrote:
> $|++; # Must flush output buffers whenever doing fork()
OK, but there's no output involved (the child creates its own logfile).
The input file is only used by the parent. And it's the parent's copy
of the filehandle that gets mangled -- the child works fine!
> > while (<IN>) {
> > $pid = fork;
> > if ($pid) {
> > &do_parent_stuff;
> > }
> > elsif (defined($pid)) {
> > &do_child_stuff;
> > last;
>
> Those two lines should be
> close IN; # Child has no business with this file handle
Tried that, makes no difference. The child doesn't use this handle anyway...
> &do_child_stuff;
> exit; # Forked child needs to exit when done
...and when it falls out of the loop with "last" it close the file and
then exits (but the exit wasn't shown in my snippet).
> See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
OK... Anyway, it's good to know this isn't something blindingly
obvious to everyone except me... :-)
-----------------------------------------------------------------
John English | mailto:je@brighton.ac.uk
Senior Lecturer | http://www.comp.it.bton.ac.uk/je
Dept. of Computing | ** NON-PROFIT CD FOR CS STUDENTS **
University of Brighton | -- see http://burks.bton.ac.uk
-----------------------------------------------------------------
------------------------------
Date: Fri, 19 Oct 2001 17:02:48 -0400
From: "Ronny Garay" <rgaray@devetel.cl.nospam>
Subject: GD::Graph
Message-Id: <3bd0833f$1@news.psinet.cl>
Quien hable espaņol plis
Si me pueden ayudar con graficos en perl......necesito un grafico apilado
con series
R.Garay
Santiago Chile
------------------------------
Date: Sat, 20 Oct 2001 13:07:46 +0200
From: Jens Luedicke <jens@irs-net.com>
Subject: good or bad code?
Message-Id: <9qrm1r$ef1$00$1@news.t-online.com>
hi ...
is this rather good or bad code?
($mails_sth,$filters_sth)->finish;
--
Jens Luedicke
jens@irs-net.com
------------------------------
Date: Sat, 20 Oct 2001 14:52:32 BST
From: spam@freeuk.com (Stephen Patterson)
Subject: Re: good or bad code?
Message-Id: <slrn9t30e0.n7.spam@localhost.localdomain>
On Sat, 20 Oct 2001 13:07:46 +0200, Jens Luedicke wrote:
> hi ...
>
> is this rather good or bad code?
>
> ($mails_sth,$filters_sth)->finish;
Does it work?
--
Stephen Patterson http://home.freeuk.net/s.patterson/
s.patterson@SPAM.freeuk.com (remove spam to reply)
ICBM address 54-22-0N 0-28-0W
------------------------------
Date: Sat, 20 Oct 2001 16:52:16 +0200
From: Jens Luedicke <jens@irs-net.com>
Subject: Re: good or bad code?
Message-Id: <9qs36p$g8c$06$1@news.t-online.com>
Stephen Patterson wrote:
> On Sat, 20 Oct 2001 13:07:46 +0200, Jens Luedicke wrote:
>> hi ...
>>
>> is this rather good or bad code?
>>
>> ($mails_sth,$filters_sth)->finish;
>
> Does it work?
>
>
yes. I hacked it up as a replacement for
}
$mails_sth->finish;
}
$filters_sth->finish;
--
Jens Luedicke
jens@irs-net.com
------------------------------
Date: Sat, 20 Oct 2001 17:02:13 +1000
From: Angus <angusmann@pobox.com>
Subject: Help please with formmail
Message-Id: <3BD12175.BA28F49E@pobox.com>
Sorry to be so confused about the simplest-to-use script in the world,
but this problem has me beat !
My form submission at :
http://www.australian-anaesthesia.com/contact.shtml
does not result in an email being sent. It seems to work OK - the
redirection works etc. but no email is sent. I have checked the syntax a
thousand times !
In comparison, this one does -
http://www.australian-anaesthesia.com/form.html
If you check the source for each of these pages they are not
significantly different.
I'm using FormMail 1.6 from Matt's script archive and have set up
sendmail, referrers etc all properly (as evidenced by the success of the
second form)
If any kind folk can see a flaw in the first form, please let me know !
I'm going nuts.
------------------------------
Date: Sat, 20 Oct 2001 20:13:08 +1000
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: Help please with formmail
Message-Id: <68cA7.13$xz4.508022@news.interact.net.au>
"Angus" <angusmann@pobox.com> wrote in message
news:3BD12175.BA28F49E@pobox.com...
> Sorry to be so confused about the simplest-to-use script in the world,
> but this problem has me beat !
It also happens to be one of the bugiest and insecure.
------------------------------
Date: Sat, 20 Oct 2001 23:06:39 +0900
From: "Matthew Lock" <matthew@perthonline.net>
Subject: Re: Help please with formmail
Message-Id: <9qs0g6$q8n$1@newsflood.tokyo.att.ne.jp>
Check that you have the correct path to sendmail, the program that formmail
uses to send the email.
Read more here http://worldwidemart.com/scripts/faq/formmail/q1.shtml
"Angus" <angusmann@pobox.com> wrote in message
news:3BD12175.BA28F49E@pobox.com...
> Sorry to be so confused about the simplest-to-use script in the world,
> but this problem has me beat !
>
> My form submission at :
> http://www.australian-anaesthesia.com/contact.shtml
> does not result in an email being sent. It seems to work OK - the
> redirection works etc. but no email is sent. I have checked the syntax a
> thousand times !
>
> In comparison, this one does -
> http://www.australian-anaesthesia.com/form.html
>
> If you check the source for each of these pages they are not
> significantly different.
>
> I'm using FormMail 1.6 from Matt's script archive and have set up
> sendmail, referrers etc all properly (as evidenced by the success of the
> second form)
>
> If any kind folk can see a flaw in the first form, please let me know !
> I'm going nuts.
>
------------------------------
Date: Sat, 20 Oct 2001 00:19:02 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: How can you sort a CSV file by diffrent fields ??
Message-Id: <3BD0FB36.C67CEAA@earthlink.net>
Scott wrote:
>
> Hi,
>
> I have a CSV file database that i am reading into @DATA and then doing
>
> foreach $rec (@DATA)
> {
> chomp($rec);
> ($a,$b,$c)=split(/\,/,$rec);
> print "$a,$b,$c\n";
>
> }
>
> I would like to be able to sort them by each field but by using
> @sorted = sort @DATA; it just sorts based on the first field.
>
> Can anyone suggest away of specifiying field a,b or c and then sorting
> the data based on that.
use Text::CSV_XS;
my $csv = Text::CSV_XS->new();
my @fieldnames = $csv->getline(*HANDLE_TO_CSVFILE);
# my @fieldnames = qw(a b c);
my %numeric = map +($_ => 1), @fieldnames;
my @data;
while( my $row = $csv->getline(*HANDLE_TO_CSVFILE) ) {
# foreach my $row (@DATA) {
for( 0 .. $#fieldnames ) {
$numeric{$fieldnames[$_]} &&= $row->[$_] =~ m[^\s*
[-+]? (?:\d+\.?\d*|\.\d+) (?:[eE][-+]?\d+)?
\s*\z]x;
}
push @data, {map +($_ => shift @$row), @fieldnames};
}
print "Sort data based on [@fieldnames]: ";
chomp( my $sorton = <STDIN> );
if( $numeric{$sorton} ) {
print "Sorting numerically by column $sorton\n";
print "@{$_}{@fieldnames}\n"
for sort { $a->{$sorton} <=> $b->{$sorton} } @data;
} else {
print "Sorting lexigraphically by column $sorton\n";
print "@{$_}{@fieldnames}\n"
for sort { $a->{$sorton} cmp $b->{$sorton} } @data;
}
NB: This code is untested.
PS: Does anyone know a shorter word for lexigraphically? [Other than
alphabetically, which doesn't *quite* mean the same thing]
--
"What does stupid old man mean pidgin talk?
Shampoo does not talk like a bird."
------------------------------
Date: Sat, 20 Oct 2001 05:07:51 GMT
From: Andrew Cady <please@no.spam>
Subject: Re: How to display text file in cgi-bin?
Message-Id: <87k7xqkijp.fsf@homer.cghm>
Jerry McEwen <mail@mail.com> writes:
> I have a shopping cart several levels deep in my cgi-bin directory
> and orders get written to a file in a sub-folder. We have SSL and I
> want my client to be able to access orders.txt via https, but Perl
> (or maybe the server's config?) prevents the file from being
> displayed.
>
> My host tells me that I will have to get a script to display it, but
> I can't find one. Any thoughts? Thanks!
You can use this one, which I haven't tested:
#!/usr/bin/perl -w
use strict;
my $filename = "/full/path/to/orders.txt";
$|++;
print("Content-type: text/plain\n\n");
open(F, "<$filename") or die("Can't open $filename: $!");
print while (<F>);
close(F) or die("Error closing $filename: $!");
# EOF
Frankly you might as well use a shell script (cat might even handle
the buffering better):
#!/bin/sh
printf "Content-type: text/plain\n\n";
cat "/full/path/to/orders.txt";
# EOF
------------------------------
Date: 20 Oct 2001 07:00:33 -0500
From: mtaylor@lrim.com (Mark Taylor)
Subject: Re: How to display text file in cgi-bin?
Message-Id: <Xns914049DAA9ED0maintainersetifaqorg@128.242.171.114>
Jerry McEwen <mail@mail.com> wrote in
<ggp1ttsppuvef1ofkpeijqf64q15mfpnnt@4ax.com>:
>I have a shopping cart several levels deep in my cgi-bin directory and
>orders get written to a file in a sub-folder. We have SSL and I want
>my client to be able to access orders.txt via https, but Perl (or
>maybe the server's config?) prevents the file from being displayed.
>
>My host tells me that I will have to get a script to display it, but I
>can't find one. Any thoughts? Thanks!
This is a limitation of the web server. If the cgi-bin directory is
configured as a 'ScriptAlias' directory then Apache will allways attempt to
execute files regardless of the extention. If the cgi-bin directory is a
normal 'Alias' then Apache will happily serve up a text file from there.
If you have admin rights simply edit the httpd.conf file and change the
cgi-bin from a ScriptAlias to a normal Alias.
A simple script can easily display a text file in about 5 lines though.
Mark
______________________________________________________________________________
Posted Via Binaries.net = SPEED+RETENTION+COMPLETION = http://www.binaries.net
------------------------------
Date: Sat, 20 Oct 2001 08:57:39 -0500
From: Jerry McEwen <mail@mail.com>
Subject: Re: How to display text file in cgi-bin?
Message-Id: <cb03ttg88atak6vcqprd241g4n2pnohcig@4ax.com>
Gee, I can't get this to work. I understand the difference between
full and local path, but do I need the actual local path on the
server, or is it more like this?
domainname.com/cgi-bin/shop/protected/orders.txt
THANKS!
On Sat, 20 Oct 2001 05:07:51 GMT, Andrew Cady <please@no.spam> wrote:
>Jerry McEwen <mail@mail.com> writes:
>
>> I have a shopping cart several levels deep in my cgi-bin directory
>> and orders get written to a file in a sub-folder. We have SSL and I
>> want my client to be able to access orders.txt via https, but Perl
>> (or maybe the server's config?) prevents the file from being
>> displayed.
>>
>> My host tells me that I will have to get a script to display it, but
>> I can't find one. Any thoughts? Thanks!
>
>You can use this one, which I haven't tested:
>
>#!/usr/bin/perl -w
>use strict;
>
>my $filename = "/full/path/to/orders.txt";
>
>$|++;
>print("Content-type: text/plain\n\n");
>open(F, "<$filename") or die("Can't open $filename: $!");
>print while (<F>);
>close(F) or die("Error closing $filename: $!");
># EOF
>
>Frankly you might as well use a shell script (cat might even handle
>the buffering better):
>
>#!/bin/sh
>printf "Content-type: text/plain\n\n";
>cat "/full/path/to/orders.txt";
># EOF
------------------------------
Date: Sat, 20 Oct 2001 08:59:02 -0500
From: Jerry McEwen <mail@mail.com>
Subject: Re: How to display text file in cgi-bin?
Message-Id: <qm03ttk8n4r6d1teup6pu7t1gn5basa9at@4ax.com>
My host already told me that anything in the cgi-bin folder will have
to be a cgi. Sure, I could change this (now that you have told me
how), but I assume it is this way for security reasons. What is your
thought on this?
Thanks!
On 20 Oct 2001 07:00:33 -0500, mtaylor@lrim.com (Mark Taylor) wrote:
>Jerry McEwen <mail@mail.com> wrote in
><ggp1ttsppuvef1ofkpeijqf64q15mfpnnt@4ax.com>:
>
>>I have a shopping cart several levels deep in my cgi-bin directory and
>>orders get written to a file in a sub-folder. We have SSL and I want
>>my client to be able to access orders.txt via https, but Perl (or
>>maybe the server's config?) prevents the file from being displayed.
>>
>>My host tells me that I will have to get a script to display it, but I
>>can't find one. Any thoughts? Thanks!
>
>This is a limitation of the web server. If the cgi-bin directory is
>configured as a 'ScriptAlias' directory then Apache will allways attempt to
>execute files regardless of the extention. If the cgi-bin directory is a
>normal 'Alias' then Apache will happily serve up a text file from there.
>
>If you have admin rights simply edit the httpd.conf file and change the
>cgi-bin from a ScriptAlias to a normal Alias.
>
>A simple script can easily display a text file in about 5 lines though.
>
>Mark
>______________________________________________________________________________
>Posted Via Binaries.net = SPEED+RETENTION+COMPLETION = http://www.binaries.net
------------------------------
Date: Sat, 20 Oct 2001 11:01:37 GMT
From: "Perry Penton" <penton@hyperformix.com>
Subject: How to use a hash in the value field of a hash?
Message-Id: <lQcA7.9687$jq6.3693944@typhoon.southeast.rr.com>
I'm a newbie Perl programmer and can't find a good tutorial/example on how
to use a hash as the value field in a hash. For example, I would like to
have a hash of multiple sets with the value of each set being a hash. The
following represents the type of structure I'm looking for:
%sets = {"set_1", {"feature_1", 333,
"feature_2", 444,
"feature_3", 555},
"set_2", {"feature_1", 666,
"feature_2", 777}
} ;
Any help would be appreciated. Especially any pointers to books/tutorials
that address this subject in detail.
------------------------------
Date: 20 Oct 2001 07:45:31 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: How to use a hash in the value field of a hash?
Message-Id: <m3y9m68rhg.fsf@mumonkan.sunstarsys.com>
"Perry Penton" <penton@hyperformix.com> writes:
> %sets = {"set_1", {"feature_1", 333,
> "feature_2", 444,
> "feature_3", 555},
> "set_2", {"feature_1", 666,
> "feature_2", 777}
> } ;
>
my %sets = (
set_1 => {
feature_1 => 333,
feature_2 => 444,
feature_3 => 555,
},
set_2 => {
feature_1 => 666,
feature_2 => 777,
},
);
Hash entries *must* be Perl scalars. What's happening here
is that the curlie braces {} create an anonymous hash and return a
scalar reference to it. The right side is an even-numbered list that
looks like
( "set_1", $ANONHASH_REF1, "set_2", $ANONHASH_REF2 )
which ultimately populates %sets with the key-value pairs from the
list. "=>" is just a "fat comma" which autoquotes the left side for
you. It reduces clutter and is more expressive of the "key-value"
relationship than an ordinary comma is.
> Any help would be appreciated. Especially any pointers to
> books/tutorials that address this subject in detail.
There's a whole bunch of good ones that are bundled with perl.
For a HASH OF HASHES check out
% perldoc perlreftut
% perldoc perldsc
--
Joe Schaefer "The man who sets out to carry a cat by its tail learns
something that will always be useful and which never will grow
dim or doubtful."
--Mark Twain
------------------------------
Date: Sat, 20 Oct 2001 10:39:33 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: How to use a hash in the value field of a hash?
Message-Id: <comdog-E20DEF.10393320102001@news.panix.com>
In article <lQcA7.9687$jq6.3693944@typhoon.southeast.rr.com>, "Perry
Penton" <penton@hyperformix.com> wrote:
> I'm a newbie Perl programmer and can't find a good tutorial/example on how
> to use a hash as the value field in a hash. For example, I would like to
> have a hash of multiple sets with the value of each set being a hash. The
> following represents the type of structure I'm looking for:
the Perl Data Structure Cookbook has a section titled
"Hashes of Hashes". have you tried that yet? :)
http://www.perldoc.com/perl5.6.1/pod/perldsc.html
--
brian d foy <comdog@panix.com> - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: Sat, 20 Oct 2001 21:11:03 +0800
From: "Peter CCH" <peter.cch@lycos.com>
Subject: How to using Perl to kill Cookie on website ?
Message-Id: <3bd17840_1@news.tm.net.my>
I had create a cookie with my script.
But after that I wish to kill it (delete it / make it unable) .....
So, which command or syntax should i use ?
Thanks
By Peter
------------------------------
Date: Sat, 20 Oct 2001 10:42:01 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: How to using Perl to kill Cookie on website ?
Message-Id: <comdog-A942E3.10420120102001@news.panix.com>
In article <3bd17840_1@news.tm.net.my>, "Peter CCH"
<peter.cch@lycos.com> wrote:
> I had create a cookie with my script.
>
> But after that I wish to kill it (delete it / make it unable) .....
>
> So, which command or syntax should i use ?
see my answer to your duplicate post in comp.lang.perl.modules.
it's better to cross-post than multiply post. :)
--
brian d foy <comdog@panix.com> - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: Sat, 20 Oct 2001 06:01:11 GMT
From: "Brian Janko" <brian@jankoNOnet.SPAMcom.INVALID>
Subject: Re: need Regular Expression help
Message-Id: <Gq8A7.818602$NK1.73767685@bin3.nnrp.aus1.giganews.com>
Thanks!
-- Brian
"Dave Tweed" <dtweed@acm.org> wrote in message
news:3BD0F532.6C8805EC@acm.org...
> Brian Janko wrote:
> > However, you bring up a good point. I did not know there was an
"official"
> > standard for valid email addresses. Where would I find that spec? I
would
> > be very interested.
>
> It's called RFC822. Any search engine should be able to dig up a copy for
you.
>
> -- Dave Tweed
>
------------------------------
Date: Sat, 20 Oct 2001 20:07:07 +1000
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: Opening files...
Message-Id: <t2cA7.12$Vz4.522342@news.interact.net.au>
"Nathan Randle" <nathan.randle@ntlworld.com> wrote in message
news:pan.2001.10.19.19.13.03.61.2034@ntlworld.com...
> I have started a script recently that uses the open command as shown
> below:
>
> open(FILE,$file) or die("Can't open the file: $!");
>
> $file is the name of a file that I wish to open. the problem is with
> using a variable like that. I have tried without the variable and it
> works fine but once it is added the server can't find the file.
And how is the "server" (whatever sort of server that is) looking for the
file? Is it blind?
------------------------------
Date: Sat, 20 Oct 2001 16:50:46 +0400
From: "Master Vip" <viphub@hotmail.com>
Subject: Pls, help me with XML parser!!!
Message-Id: <3bd17fd9@digi8.pi.net.ua>
Greetz!
Why XML::Parser::Expat doesn't recognize windows-1251 encoding?
I have Active Perl Build 509. Should I install a newer version?
Or maybe someone can tell me where I can find xml parser without
this disadvantage.
Thanx.
------------------------------
Date: Sat, 20 Oct 2001 09:28:25 +0200
From: Philip Newton <pne-news-20011020@newton.digitalspace.net>
Subject: Re: putting $1..$9 into a replacement string such as $repl="=csinfo$1$2^$3"
Message-Id: <6382tt0r0jcvtumsl7ii72e2ind00n573r@4ax.com>
On Thu, 18 Oct 2001 21:31:03 +0000 (UTC), inwap@best.com (Joe Smith)
wrote:
> $a = {$_};
> is not the same as
> $a = "$_";
> since the former makes a verbatim copy of the variable (or object)
> while the latter executes a "stringify" operation on the double quoted
> string.
Either you've been programming too much Tcl, or you made a typo for ${_}
(or you forgot a 'do'). In any event, $_ is the usual spelling for
dollar-underscore:
$a = $_;
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Sat, 20 Oct 2001 00:47:39 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: regexp : "x or nothing"
Message-Id: <3BD101EB.18351BAB@earthlink.net>
Wyzelli wrote:
>
> "peter pilsl" <pilsl_@goldfisch.at> wrote in message
> news:3bd0ba36$1@e-post.inode.at...
> >
> > To parse a weird string I need the following statement
> >
> > $permstring=~/(^|,)A:\((\d*-|)$_(-|\))/;
> >
> > This should check if a string of the form A:(x1-x2-x3) contains $_,
> > where x1,x2... are integers (with 1 to 5 digits) and there can be
> > zero to infinite values.
The above doesn't check for the number of digits, and it will
incorrectly accept things like "A:(--"
I would do it as:
$permstring =~ m[(^|,) A:\(
(?: \d{1,5} (?: - \d{1,5} )* )?
\)]x;
--
"What does stupid old man mean pidgin talk?
Shampoo does not talk like a bird."
------------------------------
Date: Sat, 20 Oct 2001 15:47:35 +0200
From: Marcus Przyklink <dh801@gmx.net>
Subject: Re: SOAP Web Services Mailing List
Message-Id: <9qrv9n$cr0$05$1@news.t-online.com>
Bill Leigh <bill.leigh@leighly.fsnet.co.uk> wrote:
>
> The following mailing list sends out a weekly email
> about web services you can use within any of the
> following languages: Delphi, ASP.NET,VB, C++,
> ASP, Perl, Linux, Unix, Windows, Cobol, Fortran,
> Paradox: ^^^^^^^^^^^^^^^^^^^^^
These aren't languages, these are OS's. Please be
correct next time. With that fault it doesn't look
very serious.
> [..]
------------------------------
Date: Fri, 19 Oct 2001 22:18:23 -0700
From: "Sean Cramb" <sean@industrial.bc.ca>
Subject: Vcard
Message-Id: <9qr1dr01ohe@enews2.newsguy.com>
Has anyone tried to take data from a html form, and format it as a 'Vcard'
then attach it to email?
I can't find a module for this.
Sean Cramb
------------------------------
Date: Sat, 20 Oct 2001 01:43:42 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: what happened to
Message-Id: <9020-3BD11D1E-2@storefull-248.iap.bryant.webtv.net>
> Abigail...
I think she killfiled everyone, so now she has no reason to post. [ grin
]
--Dennis
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 1967
***************************************