[15932] in Perl-Users-Digest
Perl-Users Digest, Issue: 3345 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 13 18:06:15 2000
Date: Tue, 13 Jun 2000 15:05:33 -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: <960933932-v9-i3345@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 13 Jun 2000 Volume: 9 Number: 3345
Today's topics:
Another Regular Expression Question <wonderland@141.com>
Re: Another Regular Expression Question (Alan Curry)
Re: Another Regular Expression Question <rootbeer@redcat.com>
Re: ANSI Perl: No Way !!! (Philip 'Yes, that's my address' Newton)
Re: ANSI Perl: No Way !!! <aqumsieh@hyperchip.com>
Re: ANSI Perl: No Way !!! (Neil Kandalgaonkar)
Re: Appending and View with Perl? <Jonathan.L.Ericson@jpl.nasa.gov>
Re: ASP and Perl <kperrier@blkbox.com>
Re: Attempting to parse malformed XML (Randal L. Schwartz)
Re: Attempting to parse malformed XML <trevor@trevorsky.com>
Re: Can't split correctly! <lr@hpl.hp.com>
Re: Content-type: text/html with ActivePerl <Jonathan.L.Ericson@jpl.nasa.gov>
default shell for 'backtick' commands duckjibe@my-deja.com
Re: default shell for 'backtick' commands <rootbeer@redcat.com>
Re: default shell for 'backtick' commands <care227@attglobal.net>
Re: each not looping on a hash <trw@uakron.edu>
Re: Easy CGI question (Tad McClellan)
Re: Easy CGI question (Tad McClellan)
Re: Easy CGI question <dan@tuatha.sidhe.org>
Re: Easy CGI question <lr@hpl.hp.com>
Re: Easy CGI question <flavell@mail.cern.ch>
Re: Easy CGI question <flavell@mail.cern.ch>
Re: Encrypting / decrypting. <godzilla@stomp.stomp.tokyo>
File I/O problems pratickm@my-deja.com
Re: File I/O problems <lr@hpl.hp.com>
Re: How do I... (Tad McClellan)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 13 Jun 2000 13:13:41 -0700
From: Wonderland Enterprises <wonderland@141.com>
Subject: Another Regular Expression Question
Message-Id: <s85dkss9f5ovkulu69lr74l2k4f3rt04rp@4ax.com>
Is there a simple regular expression that would do the following?
I want to replace any multiple appearance (more than three) of an
individual character with three of that character.
example:
"Helloooo world!!!!!!"
is replaced with:
"Hellooo world!!!"
Dan
------------------------------
Date: Tue, 13 Jun 2000 20:16:44 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: Another Regular Expression Question
Message-Id: <MEw15.10338$pd4.232528@news-east.usenetserver.com>
In article <s85dkss9f5ovkulu69lr74l2k4f3rt04rp@4ax.com>,
Wonderland Enterprises <wonderland@141.com> wrote:
>I want to replace any multiple appearance (more than three) of an
>individual character with three of that character.
s/(.)\1{2,}/$1$1$1/gs;
--
Alan Curry |Declaration of | _../\. ./\.._ ____. ____.
pacman@cqc.com|bigotries (should| [ | | ] / _> / _>
--------------+save some time): | \__/ \__/ \___: \___:
Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman
------------------------------
Date: Tue, 13 Jun 2000 13:21:30 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Another Regular Expression Question
Message-Id: <Pine.GSO.4.10.10006131319510.18837-100000@user2.teleport.com>
On Tue, 13 Jun 2000, Wonderland Enterprises wrote:
> Subject: Another Regular Expression Question
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> Is there a simple regular expression that would do the following?
>
> I want to replace any multiple appearance (more than three) of an
> individual character with three of that character.
Not a regular expression, but a substitution (s///). If you can't see how
to craft it after reading the docs, check back here - someone will have
posted it by then. :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 13 Jun 2000 19:12:44 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: ANSI Perl: No Way !!!
Message-Id: <39468557.132123149@news.nikoma.de>
On 13 Jun 2000 09:00:39 -0400, catfood@apk.net (Mark W. Schumann) wrote:
> Can't she find the number "two" interesting?
This reminds me of a theorem: there are no uninteresting numbers. The
proof is trivial and is left as an exercise to the reader.
Cheers,
Philip
[F'up2p]
--
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Tue, 13 Jun 2000 19:34:25 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: ANSI Perl: No Way !!!
Message-Id: <7apupl9xz1.fsf@merlin.hyperchip.com>
elaine@chaos.wustl.edu (Elaine -HFB- Ashton) writes:
> In article <7asnuha91d.fsf@merlin.hyperchip.com>, Ala Qumsieh wrote:
> >
> >And some people dare to call him a visionary and a pioneer! How
> >ignorant people can be!
>
> He's didn't need to be right to laugh all the way to the bank now.
>
> Lots of people throughout history have been made to eat their words.
And money has nothing to do with it. Many of history's geniuses died
pennyless.
--Ala
------------------------------
Date: 13 Jun 2000 20:40:59 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: ANSI Perl: No Way !!!
Message-Id: <8i668r$2o8$1@newsflash.concordia.ca>
In article <3945D06E.F489ACB5@stomp.stomp.tokyo>,
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
>Consider, worthless -w warnings. Ain't good for nothing
>but annoying the heck out of you and confusing newbies
>till they scream along with wasting a lot space in core.
>
>Envision -w with DOS like switches:
>
>-w /l (check lexical scoping)
>-w /d (check dynamic scoping)
>-w /my (check my usage of my)
>-w /local (check my usage of local)
>-w /anon (check my anon references)
Some of what you suggest was always available as options to use strict.
-w warnings were never useless, IMO, but you have a point.
In Perl 5.6, we finally have more fine-grained warnings pragma. I don't
see the docs on the web so snarf yourself a copy of 5.6 and check out
perldoc perllexwarn.
>Documentation could afford
>paragraph length explanations with internal
>links to expanded information and examples.
I think it's clear that many pages of the docs are not for new users.
This does suck. I was all set to write an easier guide to regexes, but
Mark Kvale scooped me by a couple of weeks, so the next version of
perl will hopefully include his perlrequick and perlretut.
My favorite example is that a typical perl idiom is:
while (<FILE>) {
print if /regex/;
}
You would have to search many different pages of the manual to even begin
to understand what this does. And people wonder why newbies persist
in writing the @file = <FILE> stuff.
>I am not talking about just warnings, but rather
>all pragma hints and whatever else could be jerked
>out of core and made into a series of specialized
>modules with greatly expanded functions.
Hmmm. Perhaps you would prefer python, this is basically their philosophy.
However, you have to pull in a lot of modules (? not sure if that's the same
word in python) before you can do anything at all. OTOH some people think
that's better since the documentation is automatically split into chunks with
obvious names.
P.S. Ms. Schilitubi, I have been one of your vocal critics, and IMO you still
have a long record of anti-social behaviour in this newsgroup. But this
posting strikes me as actually constructive criticism. My approval is surely
meaningless to you, but I wish more of your postings were like this.
--
Neil Kandalgaonkar
neil@brevity.org
------------------------------
Date: Tue, 13 Jun 2000 14:46:08 -0700
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: Appending and View with Perl?
Message-Id: <3946ABA0.E2845883@jpl.nasa.gov>
[Jeopardy quote fixed]
Raphael Pirker wrote:
> vivekvp <vivekvp@spliced.com> wrote in message
> news:8i56k5$p40$1@nnrp1.deja.com...
> > I have files that come in as a feed - a.html, b.html, c.html, d.html
> >
> > How do i append them all together and display them on one page and make
> > it viewable on the web - since they are html - in perl?
>
> Actually I haven't checked to see whether it works, but it "should"... :-)
You have done (at least) four things that warn me that you may be giving
bad advice: 1) you jeopardy quoted the entire message you are responding
to, 2) you posted untested code, 3) you aren't using strict or warnings,
and 4) you don't check the success or failure of system calls.
> $/ = undef;
> open FILE, "a.html";
> $a_html = <FILE>;
> close FILE;
> $/ = "\n";
>
> $/ = undef;
> open FILE, "b.html";
> $b_html = <FILE>;
> close FILE;
> $/ = "\n";
>
> $/ = undef;
> open FILE, "c.html";
> $c_html = <FILE>;
> close FILE;
> $/ = "\n";
>
> $/ = undef;
> open FILE, "d.html";
> $d_html = <FILE>;
> close FILE;
> $/ = "\n";
>
> $all_together = $a_html.$b_html.$c_html.$c_html;
>
> print "Content-type: text/html\n\n";
> print "$all_together;"
Doesn't this seem repetitive? Here is how the above code can be
simplified:
#/usr/bin/perl -w
use strict;
my $all_together;
{
local undef $/; # in this block, read the entire file
for ('a'..'d'){ # execute this block with $_ = 'a'..'d'
# Always check for open failures:
open FILE, "$_.html" or die "can't open $_.html: $!";
$all_together .= <FILE>; # catinate each file
close FILE or die "can't close $_.html: $!";
};
};
print "Content-type: text/html\n\n";
print $all_together;
or (using a little Perl magic and processing line-by-line):
#/usr/bin/perl -w
use strict;
for ('a'..'d'){
push @ARGV, "$_.html";
};
print "Content-type: text/html\n\n";
while(<>){ # Very magical (see perlop/'I/O Operators')
print;
};
But this isn't a complete solution because these are html files and
can't be catinated blindly. Chances are the OP will want to print one
html header section and cat the bodies of the input files into the body
of the output. This may require HTML::Parser (though a simple regex
might work depending on the contents of the files).
Jon
--
Knowledge is that which remains when what is
learned is forgotten. - Mr. King
------------------------------
Date: 13 Jun 2000 16:11:57 -0500
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: ASP and Perl
Message-Id: <C92A8408527A53F0.88E5A75724D87A7E.D79D18A3F054F375@lp.airnews.net>
Samay <samay1NOsaSPAM@hotmail.com.invalid> writes:
> No, I am not talking CGI.
> I am talking about PerlScript which should be handled by ASP.
Maybe you should ask the kind folks over at Activestate, or maybe look
in a newsgroup that talks about configuring IIS. This newsgroup is
about programming in perl.
It is not about configuring web servers, solving cgi problems, or a place
to ask people to program your script for free.
Your question is most definately not a programming problem. It is a
server configuration issue, which is outside the scope of this newsgroup.
Kent
--
"I will tell you the secret of getting rich on Wall Street... You try
to be greedy when others are fearful, and you try to be very fearful
when others are greedy."
-- Warren Buffett
------------------------------
Date: 13 Jun 2000 11:08:36 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Attempting to parse malformed XML
Message-Id: <m1zoop8ndn.fsf@halfdome.holdit.com>
>>>>> "Charles" == Charles Capps <capps@solareclipse.net> writes:
Charles> Does anyone have any recommendations, pointers, hints, URLs, or
Charles> perldoc/manpages? ;)
If you're looking for a powerful "match anything" uber-regex system,
take a long strong look at Parse::RecDescent in the CPAN. I'm sure I
could construct a parser for your language in an hour or less, given
enough of it as a sample to test against. However, you'd probably
have to add the 5 to 10 hours of playing with the module ahead of that
to duplicate my level of understanding first. :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Tue, 13 Jun 2000 11:11:14 -0700
From: "Trevor Sky Garside" <trevor@trevorsky.com>
Subject: Re: Attempting to parse malformed XML
Message-Id: <sNu15.6805$qp.167640@nntp1.onemain.com>
I was right - I munged the RegEx... leave out those .'s... it should just
be
/\w*?/
--Trevor [kicking himself]
"Trevor Sky Garside" <trevor@trevorsky.com> wrote in message
news:e0u15.6598$PZ5.169660@nntp3.onemain.com...
> Just an idea here...
>
> The data you are getting *looks* like XML, apart from the occasionally
left
> off quotes, right?
>
> Well, why don't you toss each line into a RE that corrects that small
> oversight... something that does something like this:
>
> =~ s/ (\w.*?)=(\w.*?)([\s>])/ $1="$2"$3/;
>
> Now, I just threw that together, and I might have munged my RegEx logic,
but
> I think that would take care of it, assuming the unquoted elements do not
> contain spaces (it would be VERY bad if they did anyways).
>
> Let me know if that helps you out.
>
> --Trevor
>
> "Charles Capps" <capps@solareclipse.net> wrote in message
> news:3945F5C4.750FC54@solareclipse.net...
> > I've been given the job of taking exported data from a certain extremely
> > brain-damaged and poorly designed application and rewriting it into a
> format
> > that an in-house application can read.
> >
> > The only form of exported data is XML. The XML that it produces has
> > *CERTAIN* tag elements unquoted. Example:
> > <message body="Laa dee daa" number=000001 author="Lame dude">
> >
> > Unfortunately, nothing will parse it. Expat (XML::Parser, etc) chokes
and
> > dies when it comes across the unquoted elements.
> >
> > I'm very reluctant to attempt to write my own parsing routine. I'm
> currently
> > using a series of regexes to split apart the tag, but it's difficult,
> tedious
> > work due to the randomness of the element locations, values, and
lengths,
> as
> > well as tags.
> >
> > Does anyone have any recommendations, pointers, hints, URLs, or
> > perldoc/manpages? ;)
> >
> > (Sigh, why can't this be like LAST week's XML project! That was easy
once
> I
> > found the documentation. Blech!)
> > --
> > Charles Capps
>
>
------------------------------
Date: Tue, 13 Jun 2000 11:03:25 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Can't split correctly!
Message-Id: <MPG.13b01749b63d4a3f98ab68@nntp.hpl.hp.com>
In article <8i5nt6$kne$1@news.online.de> on Tue, 13 Jun 2000 18:35:28
+0200, Raphael Pirker <raphaelp@nr1webresource.com> says...
...
> shows even Matt Wright can be wrong... (the code-snippled was taken of the
> "famous" FormMailer.pl) :-)
s/ even / especially /; # He would agree! :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 13 Jun 2000 11:29:58 -0700
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: Content-type: text/html with ActivePerl
Message-Id: <39467DA6.D69B6154@jpl.nasa.gov>
braccobaldo.xyz@hotmail.com wrote:
> I'm configuring a Perl counter (gcount.pl - Author: Yutung Liu - web
> site: http://www.cgi-factory.com). It works fine in my web site
> (http://baravalle.co.uk). I'm using it by a a few months.
For an example of a non-visitor counter visit:
http://www.stonehenge.com/merlyn/WebTechniques/col13.html
> Today I decided to install ActivePerl in my home computer, to test
> some scripts in local, without having all times to connect to internet
> ($$$).
This is a good idea. You can even test scripts in action by installing
a free web server (such as Apache) to simulate the CGI environment.
> I have a win2000 sistem. Il looks more or less fine, but in front of
> the digits I have the words "Content-type: text/html".
> Why? In internet I don't have them.
This is the MIME type. It allows browers to know how to display your
page. But this is not a Perl question.
Jon
--
Knowledge is that which remains when what is
learned is forgotten. - Mr. King
------------------------------
Date: Tue, 13 Jun 2000 18:08:58 GMT
From: duckjibe@my-deja.com
Subject: default shell for 'backtick' commands
Message-Id: <8i5tbd$9n2$1@nnrp1.deja.com>
Is it possible to change the shell used for `backtick` commands?
It uses sh and I need to use ksh.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 13 Jun 2000 12:26:29 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: default shell for 'backtick' commands
Message-Id: <Pine.GSO.4.10.10006131220450.18837-100000@user2.teleport.com>
On Tue, 13 Jun 2000 duckjibe@my-deja.com wrote:
> Is it possible to change the shell used for `backtick` commands?
Sure; patch the perl source. :-)
> It uses sh and I need to use ksh.
Maybe something like this?
my $output = `/bin/ksh -c 'whatever...'`;
You'll need to supply your own ksh syntax, of course. Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 13 Jun 2000 15:47:06 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: default shell for 'backtick' commands
Message-Id: <39468FBA.D3BD0BA5@attglobal.net>
duckjibe@my-deja.com wrote:
>
> Is it possible to change the shell used for `backtick` commands?
> It uses sh and I need to use ksh.
Better question is what are you doing with backticks, and could
that task be better accomplished. Its usually a better idea to
call external programs in other ways.
------------------------------
Date: Tue, 13 Jun 2000 14:45:37 -0400
From: "Todd W" <trw@uakron.edu>
Subject: Re: each not looping on a hash
Message-Id: <8i5vm4$2qt$1@kira.cc.uakron.edu>
Ala Qumsieh wrote in message <7a7lc1seqs.fsf@merlin.hyperchip.com>...
>You probably iterate through the same hash somewhere else in your
>program, and exit that loop via a 'last' call. Iterating again will
>simply continue where the last each() left off. This is explained in
>perlfunc:
>
> There is a single iterator for each hash, shared by all
> C<each()>, C<keys()>, and C<values()> function calls in the
> program; it can be reset by reading all the elements from the
> hash, or by evaluating C<keys HASH> or C<values HASH>.
>
>Now, if your first loop ended at the last key-value pair of the hash,
>the next call to each() will return false.
heres a post that will save me a headache or two .... great info
------------------------------
Date: Tue, 13 Jun 2000 13:28:33 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Easy CGI question
Message-Id: <slrn8kcrq1.2oo.tadmc@magna.metronet.com>
On Tue, 13 Jun 2000 18:43:28 +0200, Raphael Pirker <raphaelp@nr1webresource.com> wrote:
>> But it could go like:
>>
>> print "Content-Type: text/html\n";
>> print "\n";
>But then there are still 2 \n\n\ at the end! This is the same code!
No it isn't.
It is 2 statements. Your's was 1 statement.
"code" ne "output"
>> print <<EH-OH;
>> Content-Type: text/html
>>
>> EH-OH
>inside those <<START; until START; thingies (I don't know how to call them
>in Perl :-)
What _do_ you call them then?
The shell calls them "here-docs", and so does Perl.
>line-breaks are treated the same as \n, right? Which gives us
>again 2 times "\n" and the "same" code as mine:
"code" ne "output"
>print <<EH-OH;
>Content-Type: text/html #\n
># \n
>EH-OH
>
>I know there are about 10 different ways of writing this line (how about
>$header = "Content-Type: text/html\n\n"; print "$header"? :) but no-one in
>his right mind would try any of the approaches mentioned by you for a code
>which has a max. of 20 lines! (why buy the whole shop if you only want the
>candy?)
You said it _must_ be _exactly_ the way you have shown.
It does NOT have to be done exactly the way you have shown.
[ snip another bunch of Jeopardy-quoted crap. ]
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 13 Jun 2000 13:24:27 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Easy CGI question
Message-Id: <slrn8kcrib.2oo.tadmc@magna.metronet.com>
On Tue, 13 Jun 2000 17:22:20 +0200, Raphael Pirker <raphaelp@nr1webresource.com> wrote:
>in his case it "must" be "exactly" like that!
No it doesn't.
>It couldn't go like:
>print "Content-type: text/html\n";
No, but it _could_ go like:
print "Content-type: text/html\n";
print "\n";
or
print <<ENDHEADER:
Content-type: text/html
ENDHEADER
or
print 'C';
print 'o';
print 'n';
print 't';
...
print 'h';
print 't';
print 'm';
print 'l';
print "\n";
print "\n";
All of those work.
None of those is exactly as you said it must be.
It _can_ be as you have shown, not _must_ be.
[ nobody takes what you say seriously anyway when you quote in
backwards time order like that, so no harm done. :-)
]
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 13 Jun 2000 19:28:41 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Easy CGI question
Message-Id: <JXv15.1436$My2.2834@news1.rdc1.ct.home.com>
Alan J. Flavell <flavell@mail.cern.ch> wrote:
> First of all, CGI is not on-topic here. Any answers offered
> should be treated with additional scepticism.
> On Tue, 13 Jun 2000, Raphael Pirker wrote:
>> The heading (content-type...) must be exactly as follows:
> "must"? "exactly"??
>> print "Content-type: text/html\n\n";
> CA-2000-02 says no. Every text content-type needs a charset
> explicitly specified in order to conform with this security advisory.
The line endings are also wrong--per the HTTP spec it's supposed to be
CRLF pairs, not bare linefeeds.
Dan
------------------------------
Date: Tue, 13 Jun 2000 12:33:20 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Easy CGI question
Message-Id: <MPG.13b02c59458636ff98ab6a@nntp.hpl.hp.com>
In article <JXv15.1436$My2.2834@news1.rdc1.ct.home.com> on Tue, 13 Jun
2000 19:28:41 GMT, Dan Sugalski <dan@tuatha.sidhe.org> says...
> Alan J. Flavell <flavell@mail.cern.ch> wrote:
...
> > On Tue, 13 Jun 2000, Raphael Pirker wrote:
>
> >> The heading (content-type...) must be exactly as follows:
>
> > "must"? "exactly"??
>
> >> print "Content-type: text/html\n\n";
>
> > CA-2000-02 says no. Every text content-type needs a charset
> > explicitly specified in order to conform with this security advisory.
>
> The line endings are also wrong--per the HTTP spec it's supposed to be
> CRLF pairs, not bare linefeeds.
That should be taken care of by the server, when transmitting the header
to the client.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 13 Jun 2000 21:29:52 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Easy CGI question
Message-Id: <Pine.GHP.4.21.0006132120370.10517-100000@hpplus03.cern.ch>
On Tue, 13 Jun 2000, Raphael Pirker wrote:
> > But then it would still violate CA-2000-02, which you quoted but
> > failed to take into accout
> I never quoted CA-2000-02 (whatever that is)
Oh, you did.
> - you did.
No, I cited it. You quoted me citing it, in spite of the fact that it
now transpires you didn't even know what it was.
> Please tell me the
> place where I failed to take your quote into account!
The place where you repeated a Content-type: text/html without
specifying a charset. After you've consulted the Usenet new users
guide on news.announce.newusers to help you with your Jeopardy
problem, you might care to mosey on over to:
http://www.cert.org/advisories/CA-2000-02.html
CA-2000-02 Malicious HTML Tags Embedded in Client Requests
http://www.cert.org/tech_tips/malicious_code_mitigation.html/#3
Have fun. [well, the appropriate amount.]
------------------------------
Date: Tue, 13 Jun 2000 21:37:19 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Easy CGI question
Message-Id: <Pine.GHP.4.21.0006132131480.10517-100000@hpplus03.cern.ch>
On Tue, 13 Jun 2000, Dan Sugalski wrote:
> The line endings are also wrong--per the HTTP spec it's supposed to be
> CRLF pairs, not bare linefeeds.
But it was a CGI question, not an HTTP question.
With respect, might I refer to hon usenaut to the discussion at
http://ppewww.ph.gla.ac.uk/~flavell/www/perlcgifaq.html
"\n" is entirely acceptable in a parsed-headers CGI response. It's the
server's job to ensure that a complete and accurate HTTP response is
returned to the client, based on parsing the CGI response which the
script passes across the CGI.out interface to the server (that's why
it's called a "parsed-headers" script).
cheers
------------------------------
Date: Tue, 13 Jun 2000 11:19:11 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Encrypting / decrypting.
Message-Id: <39467B1F.A59C1D5B@stomp.stomp.tokyo>
"Godzilla!" wrote:
> Matt King wrote:
> > I have your script working. And I have made some
> > changes to it to make the output more the I want
> > it to be, however, the decryption process is not
> > 100% relyable...
I need to better qualify my previous thoughts
for you Matt. I am thinking by using HEX for
encoding, you are generating some selected
hex encoded characters which are being modified
upon read and parse:
$key =~ s/%(..)/pack("c",hex($1))/ge;
$value =~ s/%(..)/pack("c",hex($1))/ge;
It might be you need to change your order
of events so your encoded string does
have any "HEX like" characters included
when it hits your read and parse routine.
Your read and parse will modify these HEX
like characters into something they should
not be for your decoding process.
Changing a percentage sign ( % ) to some
other character would help out on this bug.
Maybe %xx could become §xx to avoid a bug.
I'm betting a buck this is why this bug
is appearing under certain circumstances.
A test print of your encoding string,
without any parsing, under plain text
conditions would reveal if your encoding
process is creating HEX like characters
for your output ( %xx ).
Understand?
Another bug might be in attaching your
random number key generator, then encoding.
Your random number key generator should
be the very last event, so your number
is not altered during encoding. Clearly,
grabbing this key number would be your
first event for decoding.
Godzilla!
------------------------------
Date: Tue, 13 Jun 2000 20:31:53 GMT
From: pratickm@my-deja.com
Subject: File I/O problems
Message-Id: <8i65np$g7k$1@nnrp1.deja.com>
Hello everyone,
I am writing a simple PERL program (platform:Win2000 Advanced Server,
IIS 5.0, ActiveState ActivePERL).
I am having problems opening, reading and writing files.
I am using the following statements to open a file in read mode and
read data from it:
my $file='e:\\inetpub\\wwwroot\\cgi-bin\\counter.txt';
open(INFILE,"<$file");
$num=<INFILE>;
print "<br>Num is: $num";
This does not print anything.
I've also tried using read:
read(INFILE, $num, 2);
that doesn't work either.
The only syntax that is working is:
while($num=<INFILE>)
{
last;
}
After this, I am able to get the data from the file.
The file is a simple text file having just one character (0-9).
Can anyone help?
Thanks and regards,
Pratick
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 13 Jun 2000 14:19:49 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: File I/O problems
Message-Id: <MPG.13b0454df854350f98ab6d@nntp.hpl.hp.com>
In article <8i65np$g7k$1@nnrp1.deja.com> on Tue, 13 Jun 2000 20:31:53
GMT, pratickm@my-deja.com <pratickm@my-deja.com> says...
> I am writing a simple PERL program (platform:Win2000 Advanced Server,
That's Perl, not PERL. See perlfaq1.
> IIS 5.0, ActiveState ActivePERL).
> I am having problems opening, reading and writing files.
> I am using the following statements to open a file in read mode and
> read data from it:
>
> my $file='e:\\inetpub\\wwwroot\\cgi-bin\\counter.txt';
You can save typing by using single backslashes within those single
quotes, and you can save mental strain by using forward slashes.
> open(INFILE,"<$file");
You should ALWAYS check for the success of an open() request.
open INFILE, $file or die "Couldn't open '$file'. $!\n";
> $num=<INFILE>;
That should read one 'line' from the file (i.e., up to and including the
contents of $/, which is "\n" by default) into $num.
> print "<br>Num is: $num";
>
> This does not print anything.
> I've also tried using read:
> read(INFILE, $num, 2);
> that doesn't work either.
That should read two bytes from the file into $num.
> The only syntax that is working is:
> while($num=<INFILE>)
> {
> last;
> }
That too should read one 'line' from the file into $num, and exit the
loop.
> After this, I am able to get the data from the file.
That is, $num now has a value, when in the other cases it didn't?
Hmmm...
> The file is a simple text file having just one character (0-9).
>
> Can anyone help?
No, I can't help, so maybe I shouldn't even respond. But I can't
resist, because your problem is incomprehensible and, I dare say, not
reproducible.
I assume you have tried it from the command line (but you mentioned IIS,
which should be irrelevant). And I assume you use '-w' and 'use
strict;' to help locate any typos. Other than that, who knows?
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 13 Jun 2000 13:33:35 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How do I...
Message-Id: <slrn8kcs3f.2oo.tadmc@magna.metronet.com>
On Tue, 13 Jun 2000 06:34:24 -0700, Agentkhaki <altavistaNOalSPAM@agentkhaki.com.invalid> wrote:
> Subject: How do I...
The Subject header is meant to contain the subject of your
post. Please use it for that.
>I'm pretty much a newbie when it comes to CGI scripts.
That's nice, but we do not care what application area you
are going to use Perl in.
There are newsgroups where your application area are
discussed:
comp.infosystems.www.advocacy
comp.infosystems.www.announce
comp.infosystems.www.authoring.cgi
comp.infosystems.www.authoring.html
comp.infosystems.www.authoring.images
comp.infosystems.www.authoring.misc
comp.infosystems.www.authoring.site-design
comp.infosystems.www.authoring.stylesheets
comp.infosystems.www.authoring.tools
comp.infosystems.www.browsers.mac
comp.infosystems.www.browsers.misc
comp.infosystems.www.browsers.ms-windows
comp.infosystems.www.browsers.x
comp.infosystems.www.misc
comp.infosystems.www.servers.mac
comp.infosystems.www.servers.misc
comp.infosystems.www.servers.ms-windows
comp.infosystems.www.servers.unix
>1) If I want users to log into a website, or log into a
>specific area (say a portal page, that would remember their
>settings) how would I do this?
Learn to program, then write a program that will do that.
>It seems that I would use
>htaccess but I can't figure out how to interact with this
>file using forms on a page (ie, I don't want the stupid
>little box popping up asking for a username and password).
>Maybe I'm completely off base...
There is no Perl question there.
Please ask only Perl questions here in the Perl newsgroup.
Ask server setup questions in a newsgroup about servers.
>2) This is a little up in the air, but how do services like
>ZDNetmail check other POP3 mail accounts. They ask for the
>mail server address, user name and password, and then
>BLAMO! they can check your email for you... I would imagine
>this is a complicated script of some sort... any ideas?
There is no Perl question there either.
Please stop abusing Usenet with off-topic postings.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
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 3345
**************************************