[12376] in Perl-Users-Digest
Perl-Users Digest, Issue: 5976 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 13 07:07:24 1999
Date: Sun, 13 Jun 99 04:00:20 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 13 Jun 1999 Volume: 8 Number: 5976
Today's topics:
Re: 'data corruption' when forking. (??) <rootbeer@redcat.com>
(another) Newbie Question, <mark@spring-air.demon.nl>
Re: (another) Newbie Question, (Jim Britain)
[Perl] How to find the Perl FAQ <rootbeer&pfaq*finding*@redcat.com>
Re: \n doesn't work on NT4 SP4 (Martin Vorlaender)
Debugger <bie@connect.ab.ca>
Re: disalowing words (Larry Rosler)
Re: disalowing words (Ilya Zakharevich)
Re: disalowing words (Ilya Zakharevich)
Does Perl have a future? (Christian Ahkman)
Re: Does Perl have a future? <bill@fccj.org>
Re: Help on "while" behavior sought (Greg Andrews)
Re: help <bill@fccj.org>
Re: Need Help Anit-Back - Off-topic (Michel Dalle)
Need Help Anit-Back <bie@connect.ab.ca>
Re: Newbie Question (Michel Dalle)
Perl error: carriage returns ??? <q9822210@mail.NOSPAMconnect.usq.edu.au>
Re: PerlScript ... what features are missing? <bill@fccj.org>
PLZ HELP <bie@connect.ab.ca>
problem with BASE64 baga@gmx.de
Re: Problems with foreing characters (Michel Dalle)
Re: Very very short tutorial about modules <rpsavage@ozemail.com.au>
Re: whats wrong with this script? (David Efflandt)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 12 Jun 1999 23:48:52 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: 'data corruption' when forking. (??)
Message-Id: <Pine.GSO.4.02A.9906122339100.6999-100000@user2.teleport.com>
On Thu, 10 Jun 1999 leroy@mpi.com wrote:
> I have a program that does a great job, but does it slowly,
> so trying to speed it up by forking children processes,
Forking additionally processes won't necessarily speed things, of course;
it could easily make things worse! But I'll assume that it's the best
tactic for your situation.
> Looks like the children are sharing some part of their memory (or the
> whole), either between themselves, or with the parent. Nicely enough,
> the parent has no problem.
It is possible that you've found a bug in Perl, in your system, or in the
modules you're using, although none of these seems especially likely to
me. Can you make a small example program which demonstrates this behavior?
Ideally, it should avoid any modules which aren't really necessary for
showing the bug. (Of course, any module which is necessary for showing the
bug probably _contains_ the bug.)
> Thank you for any clue or advice (please no too-obvious advice, I've
> been on that the all day),
So you don't really want "any" clue or advice. :-) Well, I hope nothing
I've written was too obvious to you, although what's news to one person is
often obvious to another.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sun, 13 Jun 1999 09:34:02 +0200
From: "Mark Spring" <mark@spring-air.demon.nl>
Subject: (another) Newbie Question,
Message-Id: <7jvmt1$g3b$1@rots.aware.nl>
Hello everyone,
I recenty discovered Perl and what it could do,
scince I am currently migrating my network at home
to Solaris (from win***) I decided to intstall Perl and start learning it,
I am currently doing the online course at O''Reily and I am making
good progres but as usual I am trying out things that are way out of
my leuge (the best way to learn is trial and error) and I have a question.
I am setting up a company site in two languages but on two different
servers,
what I want is a (perl) cgi script that, when someone visits the website and
requests the index.html (I read somewhere that I can actually use index.cgi
- but I cannot remember where) a cgi script is called that checks the client
IP address,
If a certain IP address or range is found then the browser will
automatically redirect
to either the server in the states or the one in Europe.
Is this possible ? or am I dreaming again ??
TIA,
Mark Spring
------------------------------
Date: Sun, 13 Jun 1999 10:22:52 GMT
From: jbritain@home.com (Jim Britain)
Subject: Re: (another) Newbie Question,
Message-Id: <37638569.53574958@news>
[mailed & posted]
On Sun, 13 Jun 1999 09:34:02 +0200, "Mark Spring"
<mark@spring-air.demon.nl> wrote:
>If a certain IP address or range is found then the browser will
>automatically redirect
>to either the server in the states or the one in Europe.
>
>Is this possible ? or am I dreaming again ??
This is off topic in this newsgroup, however;
There is no way to tell, based upon IP address the location of the
server, or the user.
There is also no way to tell the user's preferred language, without
asking..
So, simply give the user a choice..
------------------------------
Date: Sun, 13 Jun 1999 10:24:02 GMT
From: Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
Subject: [Perl] How to find the Perl FAQ
Message-Id: <pfaqmessage929269442.15885@news.teleport.com>
Archive-name: perl-faq/finding-perl-faq
Posting-Frequency: weekly
Last-modified: 10 Sep 1998
[ That "Last-modified:" date above refers to this document, not to the
Perl FAQ itself! The last major update of the Perl FAQ was in Summer of
1998; of course, ongoing updates are made as needed. ]
For most people, this URL should be all you need in order to find Perl's
Frequently Asked Questions (and answers).
http://cpan.perl.org/doc/FAQs/
Please look over (but never overlook!) the FAQ and related docs before
posting anything to the comp.lang.perl.* family of newsgroups.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Beginning with Perl version 5.004, the Perl distribution itself includes
the Perl FAQ. If everything is pro-Perl-y installed on your system, the
FAQ will be stored alongside the rest of Perl's documentation, and one
of these commands (or your local equivalents) should let you read the FAQ.
perldoc perlfaq
man perlfaq
If a recent version of Perl is not properly installed on your system,
you should ask your system administrator or local expert to help. If you
find that a recent Perl distribution is lacking the FAQ or other important
documentation, be sure to complain to that distribution's author.
If you have a web connection, the first and foremost source for all things
Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
CPAN also includes the Perl source code, pre-compiled binaries for many
platforms, and a large collection of freely usable modules, among its
560_986_526 bytes (give or take a little) of super-cool (give or take
a little) Perl resources.
http://cpan.perl.org/
http://www.perl.com/CPAN/
http://cpan.perl.org/doc/FAQs/FAQ/html/
http://www.perl.com/CPAN/doc/FAQs/FAQ/html/
You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
selected FTP sites is especially good for you, a full list of CPAN sites
is in the SITES file within CPAN.)
California ftp://ftp.cdrom.com/pub/perl/CPAN/
Texas ftp://ftp.metronet.com/pub/perl/
South Africa ftp://ftp.is.co.za/programming/perl/CPAN/
Japan ftp://ftp.dti.ad.jp/pub/lang/CPAN/
Australia ftp://cpan.topend.com.au/pub/CPAN/
Netherlands ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
Switzerland ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
Chile ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/
If you have no connection to the Internet at all (so sad!) you may wish
to purchase one of the commercial Perl distributions on CD-Rom or other
media. Your local bookstore should be able to help you to find one.
Another possibility is to use one of the FTP-via-email services; for
more information on doing that, send mail to <mail-server@rtfm.mit.edu>
(not to me!) with these lines in the body of the message, flush left:
setdir usenet-by-group/news.announce.newusers
send Anonymous_FTP:_Frequently_Asked_Questions_(FAQ)_List
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Comments and suggestions on the contents of this document
are always welcome. Please send them to the author at
<pfaq&finding*comments*@redcat.com>. Of course, comments on
the docs and FAQs mentioned here should go to their respective
maintainers.
Have fun with Perl!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sun, 13 Jun 1999 09:58:21 +0200
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: \n doesn't work on NT4 SP4
Message-Id: <3763649d.524144494f47414741@radiogaga.harz.de>
Amonotod (amonotod@netscape.net) wrote:
: As for my script, it does all work
: except for the "lc $user;". That should have been
: "$user =~ tr/A-Z/a-z/;", which works just fine.
Arrggghhh... and if some european perler tries to run that script, he'll
wonder why his usernames (that could include umlauts) are not properly
lowercased...
There's noting wrong with the lc() function. Please write it as
$user = lc $user;
and it'll work -- for umlauts, too.
cu,
Martin
--
| Martin Vorlaender | VMS & WNT programmer
VMS is today what | work: mv@pdv-systeme.de
Microsoft wants | http://www.pdv-systeme.de/users/martinv/
Windows NT 8.0 to be! | home: martin@radiogaga.harz.de
------------------------------
Date: Sat, 12 Jun 1999 15:29:28 -0600
From: Tim <bie@connect.ab.ca>
Subject: Debugger
Message-Id: <3762D138.194F@connect.ab.ca>
Hello,
I am looking some a program that will find type-o errors with my cgi
script so I don't have to go crazy looking for them
--
-------------------------------------------------------
| TBE: http://tbe.virtualave.net |
| * 3:2 Ratio + 100 Free credits! * |
| Tim's Chat Doors: http://www.connect.ab.ca/~mundy/ |
-------------------------------------------------------
------------------------------
Date: Sat, 12 Jun 1999 23:27:23 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: disalowing words
Message-Id: <MPG.11ccef17e970e0af989bd5@nntp.hpl.hp.com>
In article <7jubfj$od7$1@mathserv.mps.ohio-state.edu> on 12 Jun 1999
19:12:51 GMT, Ilya Zakharevich <ilya@math.ohio-state.edu> says...
> [A complimentary Cc of this posting was sent to Larry Rosler
> <lr@hpl.hp.com>],
> who wrote in article <MPG.11cc1988b278fae3989bd1@nntp.hpl.hp.com>:
> > <SNIP> of method described in that FAQ as 'extremely inefficient'. The
> > following is efficient.
>
> [Using split and hash lookup].
>
> I do not believe you. Not that I trust the FAQ a tiny bit, but your
> method should be *much* slower than matching 7 RExen.
>
> Hope this helps,
> Ilya
Err, no. Unless my benchmark is very wrong, which I'm sure you'll tell
me.
Not only is the FAQ method slower for 7 words, it scales horribly. The
single regex with alternation is faster than the FAQ too.
If N is the number of bad words and M the number of data words, the hash
is O(N + M) including the hash setup time; the regex methods are each
O(N * M). For large M, the O(1) behavior of the single hash access per
word dominates, so the complexity is O(M).
N = 100
Benchmark: timing 1024 iterations of FAQ0, FAQ1, Hash0, Hash1, Reg0,
Reg1...
FAQ0: 77 wallclock secs (77.88 usr + 0.00 sys = 77.88 CPU)
FAQ1: 43 wallclock secs (43.50 usr + 0.00 sys = 43.50 CPU)
Hash0: 3 wallclock secs ( 2.41 usr + 0.00 sys = 2.41 CPU)
Hash1: 2 wallclock secs ( 2.02 usr + 0.00 sys = 2.02 CPU)
Reg0: 4 wallclock secs ( 3.51 usr + 0.00 sys = 3.51 CPU)
Reg1: 10 wallclock secs ( 9.50 usr + 0.00 sys = 9.50 CPU)
N = 7
Benchmark: timing 1024 iterations of FAQ0, FAQ1, Hash0, Hash1, Reg0,
Reg1...
FAQ0: 10 wallclock secs ( 9.12 usr + 0.00 sys = 9.12 CPU)
FAQ1: 3 wallclock secs ( 2.85 usr + 0.00 sys = 2.85 CPU)
Hash0: 0 wallclock secs ( 0.27 usr + 0.00 sys = 0.27 CPU)
Hash1: 2 wallclock secs ( 2.19 usr + 0.00 sys = 2.19 CPU)
Reg0: 1 wallclock secs ( 0.93 usr + 0.00 sys = 0.93 CPU)
Reg1: 1 wallclock secs ( 1.32 usr + 0.00 sys = 1.32 CPU)
#!/usr/local/bin/perl -w
use strict;
use Benchmark;
my $line =
'This line has Badword5 and badword3 in it but not badword6a.';
my $n = shift || 0;
my @words = map "badword$_" => 0 .. 99;
time_sub();
$#words = 6;
time_sub();
sub time_sub {
print "\nN = ", scalar @words, "\n";
my (@regexes, %words, $regex, $matches);
timethese(1 << $n, {
FAQ0 => sub { @regexes = map qr/\b$_\b/i => @words },
FAQ1 => sub { $line =~ /$_/ and ++$matches for @regexes },
Hash0 => sub { @words{@words} = () },
Hash1 => sub { exists $words{+lc} and ++$matches
for split /\W+/ => $line },
Reg0 => sub { $_ = join '|' => @words;
$regex = qr/\b(?:$_)\b/i },
Reg1 => sub { ++$matches while $line =~ /$regex/g },
});
}
__END__
To test the benchmark, I put capturing parentheses in the regexes and
replaced the '++$matches' by 'print "$1\n"' (or 'print "$_\n"' for the
hash), and ran one iteration.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 13 Jun 1999 09:00:09 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: disalowing words
Message-Id: <7jvrup$a5t$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Larry Rosler
<lr@hpl.hp.com>],
who wrote in article <MPG.11ccef17e970e0af989bd5@nntp.hpl.hp.com>:
> timethese(1 << $n, {
> FAQ0 => sub { @regexes = map qr/\b$_\b/i => @words },
Why are you recompiling the things in the loop?
> FAQ1 => sub { $line =~ /$_/ and ++$matches for @regexes },
Why do not you shortcut?
Ilya
------------------------------
Date: 13 Jun 1999 09:05:43 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: disalowing words
Message-Id: <7jvs97$aea$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Larry Rosler
<lr@hpl.hp.com>],
who wrote in article <MPG.11ccef17e970e0af989bd5@nntp.hpl.hp.com>:
> Err, no. Unless my benchmark is very wrong, which I'm sure you'll tell
> me.
>
> Not only is the FAQ method slower for 7 words, it scales horribly. The
> single regex with alternation is faster than the FAQ too.
What you see looks like a bug in REx engine optimizer. Observe output
from -Mre=debugcolor:
Compiling RE `\bbadword74\b'
size 7 first at 1
1: BOUND(2)
2: EXACTF <badword74>(6)
6: BOUND(7)
7: END(0)
stclass `BOUND' minlen 9
As you see, it did not indicate that to match this REx the string
should contain a substr "badword74". Thus the match is not optimized,
which explains why it is not much quickier than badword74|badword75|badword76
etc.
Ilya
------------------------------
Date: Sun, 13 Jun 1999 07:15:52 GMT
From: tchristian7@yahoo.com (Christian Ahkman)
Subject: Does Perl have a future?
Message-Id: <376357a4.30579140@news.earthlink.net>
This may be a loaded question for a Perl ng, but ....
Perl obviously "has a future" for many tasks, so let me be more
specific. Does perl have a future on the web server? I used to write
perl/CGI stuff but have been out of the perl world for the past year
or so. Just as scripting languages like VBScript and JavaScript are
being ursurped by ActiveX COM on IIS, I am wondering if JavaBeans and
servlets are really going to ursurp Perl/CGI on UNIX??
Of course, Sun claims that Perl/CGI is dead and that JavaBeans is the
future of server side web development for UNIX. Are people seeing
this happen? Java's slow death on the client side of the web has
really forced Sun to try to make Java viable on the server (esp. in
the face of ActiveX from M$).
Where does perl stand in all of this?
Thanks,
Christian Ahkman
------------------------------
Date: Sun, 13 Jun 1999 06:48:48 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: Does Perl have a future?
Message-Id: <37638c38.0@usenet.fccj.cc.fl.us>
In article <376357a4.30579140@news.earthlink.net>, tchristian7@yahoo.com
(Christian Ahkman) wrote:
>
> This may be a loaded question for a Perl ng, but ....
>
> Perl obviously "has a future" for many tasks, so let me be more
> specific. Does perl have a future on the web server? I used to write
> perl/CGI stuff but have been out of the perl world for the past year
> or so. Just as scripting languages like VBScript and JavaScript are
> being ursurped by ActiveX COM on IIS, I am wondering if JavaBeans and
> servlets are really going to ursurp Perl/CGI on UNIX??
I don't see that.
>
> Of course, Sun claims that Perl/CGI is dead and that JavaBeans is the
> future of server side web development for UNIX. Are people seeing
> this happen? Java's slow death on the client side of the web has
> really forced Sun to try to make Java viable on the server (esp. in
> the face of ActiveX from M$).
Sun is just worried...
(Especially since JO (TCL God) left them to form Scriptics.)
>
> Where does perl stand in all of this?
Perl has a 'neutral' standing. It will evolve where
these other operating systems will not...
If you really knew how to program in perl, you would be asking -
"Does the WWW server have a future?" instead.
(Apache aside, WWW servers pretty much suck.)
Perl is slowly replacing the standard WWW functions
more and more each day...
I wouldn't worry about Sun, as Linux gets better
corporate support each week, Sun WILL start
sounding like M$ more each day.
I would say don't worry about M$ either, but
they've proven to be a pain in the past, and
will do so again ...
seek DATA,0,1;print<DATA>;
__DATA__ -Sneex- :]
Just Another Perl Monger...
_________________________________________________________________________
Bill Jones | Data Security Specialist | http://www.fccj.org/cgi/mail?dss
FCCJ | 501 W State St | Jacksonville, FL 32202 | 1 (904) 632-3089
$_="JOIN THE JAX PERL MONGERS J zbjrnmuhkkd Pdqk Mnmfdqr J\n";
tr/za-y/a-z/; / ((.)) /; do { print substr($_,25); }
while ( s/((.).{23}) $2 (.)(.*) (.)$/$1$5 $2 $4 $3/ )
------------------------------
Date: 13 Jun 1999 00:31:22 -0700
From: gerg@shell.ncal.verio.com (Greg Andrews)
Subject: Re: Help on "while" behavior sought
Message-Id: <7jvmoa$6j1$1@shell1.ncal.verio.com>
"Not So Newbie"<onecor@hotmail.com> writes:
>
>I've been trying to write an elementary program to
>put two lines of an input file into one line of the
>output (variants, three lines into one, etc.)
>
>I've done it, using a for loop.
>I first tried:
>
> while (<INPUT>) {
> $one = <INPUT>; chomp $one;
> $two = <INPUT>; chomp $two;
> print " $one $two \n";
> }
>
>But this skips the first line and every third line
>afterwards. I'm missing something. I can't find it
>in the books I have. TIA.
>
the line that reads "while (<INPUT>) {" is reading a line
into the $_ variable, which you don't check. This isn't
the most elegant method of doing what you want, but it
requires minimal changes to your code:
while (<INPUT>) {
chomp($one = $_);
chomp($two = <INPUT>);
print " $one $two\n";
}
-Greg
------------------------------
Date: Sun, 13 Jun 1999 06:52:33 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: help
Message-Id: <37638d13.0@usenet.fccj.cc.fl.us>
In article <6yC83.13996$6y2.178142@storm.twcol.com>, "Chuck Smith"
<csmith10@columbus.rr.com> wrote:
> I need to create a Perl program that will add code to the HTML files that
> are uploaded to the server, such as what happens on Free Host services
> where the banners are added after you upload.
Here ya go -
s{</BODY>} {<P>See my Ad!</P></BODY>}i;
Enjoy!
seek DATA,0,1;print<DATA>;
__DATA__ -Sneex- :]
Just Another Perl Monger...
------------------------------
Date: Sun, 13 Jun 1999 10:18:53 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Need Help Anit-Back - Off-topic
Message-Id: <7k00gp$fp1$1@xenon.inbe.net>
In article <3762AEA7.1A26@connect.ab.ca>, Tim <bie@connect.ab.ca> wrote:
>Hello,
>
>
>I am making a game & I want to be able to stop the user from simply
>pushing back on their browser and trying again. How can I do this?
>
You can't.
You could TRY, by :
- opening a new window without a menu-bar and buttons, or
- inserting some JavaScript to intercept the onunload (?) event, or
- using cookies or session IDs and checking them on the server side, or
- even worse, checking the referring page and/or IP address, or
- ...
AFAIK, all of them can be by-passed if necessary. Of course, you
could make your game un-playable by anyone who has disabled
JavaScript, for instance...
Check with one of the comp.infosystems.www.authoring.* groups,
or comp.lang.javascript.
Oh, and what was your Perl question again ?
Michel.
------------------------------
Date: Sat, 12 Jun 1999 13:01:59 -0600
From: Tim <bie@connect.ab.ca>
Subject: Need Help Anit-Back
Message-Id: <3762AEA7.1A26@connect.ab.ca>
Hello,
I am making a game & I want to be able to stop the user from simply
pushing back on their browser and trying again. How can I do this?
Tim
--
-------------------------------------------------------
| TBE: http://tbe.virtualave.net |
| * 3:2 Ratio + 100 Free credits! * |
| Tim's Chat Doors: http://www.connect.ab.ca/~mundy/ |
-------------------------------------------------------
------------------------------
Date: Sun, 13 Jun 1999 10:24:56 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Newbie Question
Message-Id: <7k00s4$fp1$2@xenon.inbe.net>
In article <7jv65u$bp6$1@clematis.singnet.com.sg>, "Deep Throat" <hanafi@magix.com.sg> wrote:
>Hi,
>
>I wanted to learn Perl ,how do I get started ?
Go to www.perl.com and browse around.
You'll find the software version for your OS, the documentation,
the FAQs, the books you should read, etc.
After having played around for a week or so, come back here if you
have specific questions - but make sure you read the documentation
first, and try it out yourself !
Have fun,
Michel.
------------------------------
Date: Sun, 13 Jun 1999 19:31:23 +1000
From: Ian B <q9822210@mail.NOSPAMconnect.usq.edu.au>
Subject: Perl error: carriage returns ???
Message-Id: <37637A6B.2D97@mail.NOSPAMconnect.usq.edu.au>
Hi,
I'm using Perl to run CGI programs on a web server. A couple of scripts
I am trying to setup are giving the following error:
"Illegal character \015 (carriage return) at perlscript.cgi line x.
(Maybe you didn't strip carriage returns after a network transfer?)"
The scripts come straight off the Internet in ZIP form into a Win95 then
I transfer them over to Linux using FTP and uncompress them there.
Why are carriage returns causing a problem? How can I fix this without
having to edit the file manually?
Thanks,
Ian.
------------------------------
Date: Sun, 13 Jun 1999 06:15:55 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: PerlScript ... what features are missing?
Message-Id: <376384d4.0@usenet.fccj.cc.fl.us>
In article <fGD83.607$u43.131950@typhoon-sf.snfc21.pbi.net>, "Ken Snyder"
<ksnyde@msn.com> wrote:
> When using "PerlScript" under ASP I noticed that assigning a variable like
> this:
>
> $myVariable << 'END_OF_HTML';
> <html>
> hello world
> </html>
> END_OF_HTML
> print $myVariable;
>
> Doesn't work. It works fine under just Perl. Anyone have an idea how I can
> get this to work under PerlScript? Anyone know the functional list of
> things that don't work under PerlScript?
Just wondering here, but ...
did you print the http headers first?
Or did you just print the $var?
seek DATA,0,1;print<DATA>;
__DATA__ -Sneex- :]
Just Another Perl Monger...
_________________________________________________________________________
Bill Jones | Data Security Specialist | http://www.fccj.org/cgi/mail?dss
FCCJ | 501 W State St | Jacksonville, FL 32202 | 1 (904) 632-3089
$_="JOIN THE JAX PERL MONGERS J zbjrnmuhkkd Pdqk Mnmfdqr J\n";
tr/za-y/a-z/; / ((.)) /; do { print substr($_,25); }
while ( s/((.).{23}) $2 (.)(.*) (.)$/$1$5 $2 $4 $3/ )
------------------------------
Date: Sat, 12 Jun 1999 15:28:47 -0600
From: Tim <bie@connect.ab.ca>
Subject: PLZ HELP
Message-Id: <3762D10F.6A2E@connect.ab.ca>
Hello,
What is wrong with this?
#!/usr/local/bin/perl
require "subparseform.lib";
&Parse_Form;
print "Content-type: text/html\n\n";
if ($ENV{'QUERY_STRING'} eq "new") {
&newuser;
}
sub newuser {
$user = $formdata{'user'};
$email = $formdata{'email'};
$password = $formdata{'password'};
$money = "100";
$ufile = $user . ".txt";
if (-e /members/$ufile) {
print "Sorry, Someone already has registered the username :
$user";
}
else {
# CREATE NEW USER'S FILE
OPEN (NEW,">>/members/$user.txt") || &Error;
PRINT NEW "$user\n";
PRINT NEW "$email\n";
PRINT NEW "$password\n";
PRINT NEW "$money\n";
CLOSE (NEW);
# SEND NEW USER A EMAIL MESSAGE
OPEN (NEWMAIL, "|/usr/sbin/sendmail -t") || &Error;
print NEWMAIL "To: $email\nFrom: ADMIN\n";
print NEWMAIL "Subject: Your new Account\n";
print NEWMAIL "Thanks for signing up";
CLOSE (NEWMAIL);
print "You are in";
}
}
sub Error {
print "The Error is with the status of the files , or senmdmail";
}
--
-------------------------------------------------------
| TBE: http://tbe.virtualave.net |
| * 3:2 Ratio + 100 Free credits! * |
| Tim's Chat Doors: http://www.connect.ab.ca/~mundy/ |
-------------------------------------------------------
------------------------------
Date: Sun, 13 Jun 1999 10:20:36 GMT
From: baga@gmx.de
Subject: problem with BASE64
Message-Id: <376385cb.6578379@news.techfak.uni-kiel.de>
I found that nice program in my perl book to for reading a base64
file:
while (<>) {
tr#A-Za-z0-9+/##cd;
tr#A-Za-z0-9+/# -_#;
$len = pack("c", 32 + 0.75*length);
print unpack("u", $len . $_);
}
and it works great with linux but not with windows nt (only with text
messages but not with more complicate files like graphics).
Does someone know a solution or why that happens?
Thanks,
Hans
baga@gmx.net
------------------------------
Date: Sun, 13 Jun 1999 10:38:03 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Problems with foreing characters
Message-Id: <7k01kn$fp1$3@xenon.inbe.net>
In article <01beb54b$266ffa40$34a6eccd@ruth>, "Jean-Philippe Robichaud" <jphilrob@axess.com> wrote:
>Hi, I'm writting code with perl 5 for win32... I have a script who retreive
>the path of a specific file and print it into a plain text file.
>
>Here is my problem : if the path contain a character like 'i' ascii=136,
>it will be printed as |, which is not really what I want... In fact, the
>string
> E:\mp3files\Bichard Mix\
> become :
> E:\mp3files\B|chard Mix\
>
> What can I do (except rename the directories !) ?
I'll ask the question differently : with what editor are you looking at your
'plain text file' ? If you use EDIT in a DOS box, you may end up seeing
strange characters, but if you use notepad (or a decent editor like PFE),
you'll see the right characters appear again (at least on my PC).
WYSInWYG in DOS...
Hope this helps,
Michel.
------------------------------
Date: Sun, 13 Jun 1999 17:32:02 +1000
From: "Pen and Ron Savage" <rpsavage@ozemail.com.au>
Subject: Re: Very very short tutorial about modules
Message-Id: <MaJ83.780$fR5.4386@ozemail.com.au>
See below
--
Cheers
Pen and Ron Savage
rpsavage@ozemail.com.au
http://www.ozemail.com.au/~rpsavage
Mark-Jason Dominus wrote in message <3758579c.648f$205@news.op.net>...
>
[snip]
> 1. Provide the simplest possible example for people who aren't
> sure where to start. At present, this example did not
> exist anywhere.
What? On my web site there has been a demo for a few short months.
If it's defective, please let me know.
>
[snip]
------------------------------
Date: 13 Jun 1999 06:10:47 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: whats wrong with this script?
Message-Id: <slrn7m6igj.21i.efflandt@efflandt.xnet.com>
On Sat, 05 Jun 1999 14:41:56 GMT, Cybernetic Bear
<cybear_x-nospam@geocities.com> wrote:
>I am trying to limit access to a script by IP address. My gameplan is
>to compare the IP of the user to a hosts.allow file. if it matches,
>the rest of the script runs, if it doesn't match, a die() gets called
>and the script ends.
>
>my code to check the IP is:
>$iphost= $ENV{'REMOTE_ADDR'}; #read in IP address of remote host
>open (HOSTFILE, "<$docroot./hosts.allow");#read in hosts.allow file
>@ipallow=<HOSTFILE>;
>close (HOSTFILE);
>$deny=1;
>print "$iphost";
>foreach $ip (@ipallow){ #compare host IP with hosts.allow
> if ($iphost == $ip) {$deny=0;}
> print "$iphost $ip $deny<br>";
>}
>print $deny;
>if ($deny == 1){print ("We will kill script");}
>else {print"allow script: $iphost";}
>
>Note: the print statements are for troubleshooting purposes.
>
>my hosts.allow file basically looks like:
>192.168.0.1
>192.169.0.5
>etc...
>
>when the script runs, the output of the IPs suggest that both the
>users IP and one of the hosts.allow IP's are the same, but the if()
>that compares them seems to fail to see it. I'm sure I'm missing
>something simple.
Appearances can be deceiving, you fail to see (literally) the line endings
in the lines from the file. Also == is for numeric comparison so that
may trip you up. You either need to "chomp $ip;" and change == to eq, or
try something like "if ($iphost =~ /^$ip\s/) ..." instead.
On the other hand, have you looked at webserver directives that can do
this for you (subject for another newsgroup).
--
David Efflandt efflandt@xnet.com
http://www.xnet.com/~efflandt/
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 5976
**************************************