[19498] in Perl-Users-Digest
Perl-Users Digest, Issue: 1693 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 4 21:06:00 2001
Date: Tue, 4 Sep 2001 18:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <999651908-v10-i1693@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 4 Sep 2001 Volume: 10 Number: 1693
Today's topics:
Re: ActivePerl says Out of Memory, but I'm not out of m (Martien Verbruggen)
Re: Black Perl (Martien Verbruggen)
Re: Black Perl (Martien Verbruggen)
can this be done with regex? (stupid question probably) (crow)
Re: can this be done with regex? (stupid question proba <tinamue@zedat.fu-berlin.de>
Re: can this be done with regex? (stupid question proba (John J. Trammell)
Re: can this be done with regex? (stupid question proba <krahnj@acm.org>
Re: can this be done with regex? (stupid question proba <tinamue@zedat.fu-berlin.de>
Re: from .pl to .exe on Win2K (Helgi Briem)
Re: Godzilla Stomps Code Red (Helgi Briem)
Re: help with pipes please <soren.newsgroups@wonderstorm.com.INVALID>
help with this script-database column names (gnarasi)
Re: help with this script-database column names <pilsl_@goldfisch.at>
Re: Match starting from the nth occurrence of a charact (Benoit Gauthier)
Re: Match starting from the nth occurrence of a charact (Tad McClellan)
Re: Open 2 exes from Perl (Helgi Briem)
Re: OT: Re: Recommendations for a PERL editor (Tim Hammerquist)
Re: Problems writing to a file that already exists! (Tad McClellan)
Re: Recommendations for a PERL editor (Tim Hammerquist)
Re: Recommendations for a PERL editor (Malcolm Dew-Jones)
Re: Recommendations for a PERL editor (Helgi Briem)
Re: Recommendations for a PERL editor (nuk)
Re: Recommendations for a PERL editor <jurgenex@hotmail.com>
Re: Regular Express (Tad McClellan)
require and mod_perl <pilsl_@goldfisch.at>
Re: weird kind of eof (Helgi Briem)
Re: Why doesn't this regex work? (Martien Verbruggen)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 5 Sep 2001 09:14:10 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: ActivePerl says Out of Memory, but I'm not out of memory? Is this a limitation in the Perl build I have?
Message-Id: <slrn9pao22.7k6.mgjv@martien.heliotrope.home>
On Tue, 04 Sep 2001 14:37:26 GMT,
Jonadab the Unsightly One <jonadab@bright.net> wrote:
>
> To recap, what's happening is, Perl is using roughly 112MB
> of memory but I still have about 50MB free (as reported by
> mem) but ActivePerl says 'Out of memory!' and bails. What
> I want to know is why Perl can't use the other 50MB and/or
> the virtual memory Windoze provides, and whether using a
> different Perl binary will help me. Here's the script...";
It looks like you're working with a potentially very long string there.
When The string is, say, 30 MB, and Perl needs to allocate more memory
for it, say another 2 MB, It'll ask the system for 32 MB of _contiguous_
memory. Your system may have 50 MB left, in chunks, but not a block of
32 MB in one go.
Maybe you should reconsider your algorithm, or start using my, instead
of local() more. Or maybe try to solve this iteratively, instead of
recursively.
Martien
--
Martien Verbruggen |
Interactive Media Division | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
Date: Wed, 5 Sep 2001 09:01:29 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Black Perl
Message-Id: <slrn9pana9.7k6.mgjv@martien.heliotrope.home>
On 04 Sep 2001 07:05:44 -0700,
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>>>>>> "Martien" == Martien Verbruggen <mgjv@tradingpost.com.au> writes:
>
>Martien> The only source (on a site that was actually responding) that I could
>Martien> find was this one:
>
>Martien> http://internet.ls-la.net/comppoems/black-perl.html
>
>Martien> It attributes it to Sharon Hopkins, and states that it has been used
>Martien> with permission.
>
> Well, it attributes *that* poem to Larry, as taken from an article
> that Sharon wrote on the Perl poetry.
This was how I read it the first time, when I posted the article that
this is a followup to.
> Or are you reading this differently than I am? The presence of
> Larry's name immediately below the poem seems to attribute it
> (properly) to him.
Then, I reread it, and mentally divided the attribution up differently,
with commas, and I read it as if it was attributed to Sharon Hopkins,
and that Larry was just the 'publisher', the one who posted it.
But now that I look at it again, I think you're right.
> And using my Sekret Klub-Member Decoder Ring, I'd say that attribution
> is accurate. :)
Well, that clinches it :)
Martien
--
Martien Verbruggen | My friend has a baby. I'm writing
Interactive Media Division | down all the noises the baby makes so
Commercial Dynamics Pty. Ltd. | later I can ask him what he meant -
NSW, Australia | Steven Wright
------------------------------
Date: Wed, 5 Sep 2001 09:03:47 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Black Perl
Message-Id: <slrn9panej.7k6.mgjv@martien.heliotrope.home>
On Wed, 5 Sep 2001 07:53:29 +1000,
Tintin <somewhere@in.paradise.net> wrote:
>
> "Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
> news:slrn9p9meq.7k6.mgjv@martien.heliotrope.home...
>> The only source (on a site that was actually responding) that I could
>> find was this one:
>>
>> http://internet.ls-la.net/comppoems/black-perl.html
>>
>> It attributes it to Sharon Hopkins, and states that it has been used
>> with permission.
>
> What version of perl is it supposed to compile under?
The Camel says:
Larry is particularly relieved that "Black Perl", originally written
for Perl 3, no longer parses under Perl 5.
So, it certainly would parse under Perl 3, almost certainly under Perl
4, and not under Perl 5.
Martien
--
Martien Verbruggen |
Interactive Media Division |
Commercial Dynamics Pty. Ltd. | Curiouser and curiouser, said Alice.
NSW, Australia |
------------------------------
Date: Tue, 04 Sep 2001 22:39:37 GMT
From: kick.me@love.me (crow)
Subject: can this be done with regex? (stupid question probably)
Message-Id: <Xns9113732D92F7kickmeloveme@195.130.132.65>
if this is an easy one then just tell me to go read some manual but for now
i couldn't solve it. just got some basic knowledge.
suppose you have a string like this "6542{"
now the last character (always the last one) needs to be substituted.
{ to 0, A to 1, B to 2 and so on.
i was thinking of
s/[{ABCDEFGH]$/[0123456789]/
but of course that doesn't work. the last char will be mapped but replaced
by [0123456789].
i tested many things but no luck so far.
--
crow
------------------------------
Date: 4 Sep 2001 22:54:29 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: can this be done with regex? (stupid question probably)
Message-Id: <9n3m35$4r0bm$1@fu-berlin.de>
crow <kick.me@love.me> wrote:
> if this is an easy one then just tell me to go read some manual but for now
> i couldn't solve it. just got some basic knowledge.
> suppose you have a string like this "6542{"
> now the last character (always the last one) needs to be substituted.
> { to 0, A to 1, B to 2 and so on.
> i was thinking of
> s/[{ABCDEFGH]$/[0123456789]/
> but of course that doesn't work. the last char will be mapped but replaced
> by [0123456789].
> i tested many things but no luck so far.
did you read perldoc perlop | perlfunc?
substr($_,-1,1) =~ tr/{ABCDEFGH]/0123456789/;
hth, tina
--
http://www.tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: 04 Sep 2001 22:57:20 GMT
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: can this be done with regex? (stupid question probably)
Message-Id: <slrn9pb67o.f4m.trammell@haqq.hypersloth.net>
On Tue, 04 Sep 2001 22:39:37 GMT, crow <kick.me@love.me> wrote:
> suppose you have a string like this "6542{"
> now the last character (always the last one) needs to be substituted.
> { to 0, A to 1, B to 2 and so on.
my %foo = map { $_, ord($_)-ord('A')+1 } 'A' .. 'H';
$foo{"{"} = 0;
$string =~ s/(.)$/$foo{$1}/e;
--
IAAMOAC.
------------------------------
Date: Tue, 04 Sep 2001 23:00:25 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: can this be done with regex? (stupid question probably)
Message-Id: <3B955D80.C5335516@acm.org>
crow wrote:
>
> if this is an easy one then just tell me to go read some manual but for now
> i couldn't solve it. just got some basic knowledge.
>
> suppose you have a string like this "6542{"
> now the last character (always the last one) needs to be substituted.
> { to 0, A to 1, B to 2 and so on.
>
> i was thinking of
> s/[{ABCDEFGH]$/[0123456789]/
> but of course that doesn't work. the last char will be mapped but replaced
> by [0123456789].
>
> i tested many things but no luck so far.
my $string = "6542{";
substr( $string, -1, 1 ) =~ tr/{ABCDEFGH/0123456789/;
John
--
use Perl;
program
fulfillment
------------------------------
Date: 4 Sep 2001 23:03:26 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: can this be done with regex? (stupid question probably)
Message-Id: <9n3mju$4r0bm$2@fu-berlin.de>
Tina Mueller <tinamue@zedat.fu-berlin.de> wrote:
>> s/[{ABCDEFGH]$/[0123456789]/
>> but of course that doesn't work. the last char will be mapped but replaced
>> by [0123456789].
> substr($_,-1,1) =~ tr/{ABCDEFGH]/0123456789/;
this shouldn't be there: ^^
if i understand you correctly, there should be an "I":
substr($_,-1,1) =~ tr/{ABCDEFGHI/0123456789/;
--
http://www.tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: Tue, 04 Sep 2001 12:02:15 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: from .pl to .exe on Win2K
Message-Id: <3b94c159.502227224@news.isholf.is>
On Tue, 04 Sep 2001 00:08:38 +0200, TM
<tm@kernelconsult.com> wrote:
>Hi,
>I'm very confused about getting an compiled version of a
>perl script on Win2K.
It seems a lot of people are.
>commands such
>perl -MO=CC,-ohi.c hi.pl or perlcc hi.pl abort.
This question has been asked and answered in excruciating
detail on this newsgroup about 84 times in the last month.
See
http://groups.google.com/groups?group=comp.lang.perl.misc
and search in comp.lang.perl.misc for compile and exe.
It is also dealt with less than satisfactorily in the
perlfaq, which of course you have read.
See perldoc -q compile if you like.
Use Perl2exe or PerlaApp if you really want
to do this for some reason. The perlcc method
hardly ever works.
Regards,
Helgi Briem
------------------------------
Date: Tue, 04 Sep 2001 09:27:51 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: Godzilla Stomps Code Red
Message-Id: <3b949da9.493089725@news.isholf.is>
On Mon, 03 Sep 2001 05:52:53 -0700, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote:
>> Frank??? Who's Frank?
>
>You, The CLPM Troll, of course.
Pot. Kettle. Black.
>Registrant:
>sfwest (SFWEST-DOM)
> 1278 E. Colorado Blvd.
> Pasadena, CA 91106
> US
>
> Domain Name: SFWEST.COM
>
> Administrative Contact, Billing Contact:
> Gostak, Frank (FG851) sfwest@SFWEST.COM
> SF west
> 639 Howard Street
> San Francisco, CA 94105
> 415-664-9449 (FAX) 415-882-9188
Sorry, I am an Icelander and I live in Reykjavik, Iceland.
I have only been to San Francisco once for a conference
in 1999 and I have never been to Pasadena. I have never
heard of Frank Gostak. I have never posted under any
name other than my own anywhere and probably never
will.
Regards,
Helgi Briem
------------------------------
Date: 4 Sep 2001 22:16:33 GMT
From: "Soren A." <soren.newsgroups@wonderstorm.com.INVALID>
Subject: Re: help with pipes please
Message-Id: <Xns9112B9E8C6349sorenngroupswonder@198.99.146.10>
> "Kevin" <khanrahan@cypresscom.net> wrote in message
> news:<totv4072nanud2@corp.supernews.com>...
>> I am trying to read log data, one line at a time as it comes in, and
>> then act upon it. If I use :
>>
>> $alertmsg = <STDIN>;
>> ......remainder of script....
>>
>> and feed it manually it works great but I want it to be fed
>> automatically so instaed of using <STDIN> I tried:
>>
>> $alertmsg = open(ALERT, "tail -f /opt/apps/logs/alarm.log|") or die
>> "Can't fork";
>>
>> while(<ALERT>)
>> {
>> .....remainder of script........
>>
>> and it dies when it gets new data! ....I am trying to take the result
>> of tail -f /opt/apps/logs/alarm.log and use it as input for the
>> script..
>> What have I done wrong? This is my first attempt at a script....
>> I am trying to understand the use of pipes.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
billy@arnis-bsl.com (Ilja Tabachniks) replied in
news:5d4a715a.0108310224.57a58ec8@posting.google.com on 31 Aug 2001:
> You do not need an external program and pipes to get tail(1)
> functionality in Perl.
> Just read the FAQ...
Going by this response, sometimes the *first thing* to pay attention to
is whether the person responding to the post has actually carefully read
the message, rather than worrying about whether the poster asking for
assistance has "read the FAQ." The original poster in this case has
*explicitly stated* that his *aim* is to aquire a greater understanding
of the use of pipes in Perl routines, through actually writing code,
which is the best way to learn. If anyone wants to render assistance then
it would seem that suggesting ways to accomplish his goal, rather than a
goal he isn't asking for help with, would be appropiate.
I cannot help much on testing code for the use of pipes, as i do most of
my Perl work on an OS that doesn't support pipes very well (and supports
fork() as UNI* folk understand it, not at all): Win32. But hopefully
you'll perservere, Kevin, and get the hang of it. Have you read the Perl
documentation for pipes: type `perldoc perlipc'? That could be of help.
Regards,
Soren Andersen
--
{{ please note the munged e-mail addy, apologies to those who find it
a moral atrocity .. remove the obvious parts to create the address:
"soren.newsgroups" AT "wonderstorm" DOT "com" }}
------------------------------
Date: 4 Sep 2001 15:09:14 -0700
From: gnarasi@hotmail.com (gnarasi)
Subject: help with this script-database column names
Message-Id: <138ef576.0109041409.61ace24@posting.google.com>
Please help out with this script. It works fine , all columns are
printed, but not the column names(headers). How are the column names
retrieved and printed? I am learning this and any help is welcome.
Thanks
++++++++++
#!/usr/bin/perl
print "Content-type: text/html\n\n";
use DBI;
use CGI;
{ $dbh = DBI->connect("dbi:mysql:gldb", 'root', '' ,
{ RaiseError => 1 });
$sth = $dbh->prepare("SELECT * FROM cia");
$sth->execute();
@dbRows = $sth->fetchall_arrayref();
{
print qq!
<HTML>
<HEAD>
<TITLE>SQL Statement
Results</TITLE>
</HEAD>
<BODY BGCOLOR = "#FFFFFF"
TEXT = "#000000">
<CENTER>
<TABLE BORDER = "1">!;
foreach $rowReference (@dbRows)
{
foreach $columnReference
(@$rowReference)
{
print qq!<TR>!;
foreach $column
(@$columnReference)
{
print qq!<TD>
$column
</TD>\n!;
}
print qq!</TR>!;
}
}
print qq!
</TABLE>
</CENTER>
</BODY>
</HTML>!;
exit;
}
}
------------------------------
Date: Wed, 5 Sep 2001 01:22:04 +0200
From: peter pilsl <pilsl_@goldfisch.at>
Subject: Re: help with this script-database column names
Message-Id: <3b95621e@e-post.inode.at>
gnarasi wrote:
> Please help out with this script. It works fine , all columns are
> printed, but not the column names(headers). How are the column names
> retrieved and printed? I am learning this and any help is welcome.
> Thanks
>
@namelist=@{$sth->{NAME}};
best,
peter
--
mag. peter pilsl
pilsl_@goldfisch.at
http://www.goldfisch.at
------------------------------
Date: Tue, 04 Sep 2001 23:03:18 GMT
From: gauthier@circum.com (Benoit Gauthier)
Subject: Re: Match starting from the nth occurrence of a character to the nth+1 occurrence
Message-Id: <3b955d7a.43507029@news.videotron.ca>
(2001.09.04, 19:02)
>> I have a line
>> eeeeeeeeee,adfgadvad,asdfvadfv,adfvadfva,advadvdav,advadfvdaffvadv
>> and i need a RE that matches all between the 3th and 4th comma.
>$string =
>"eeeeeeeeee,adfgadvad,asdfvadfv,adfvadfva,advadvdav,advadfvdaffvadv";
>$string =~ /\w+,\w+,\w+,(\w+),.+/;
>print $1;
Wouldn't
$string =~ /(\w+,){3}(\w+),.+/;
work?
Benoît Gauthier
gauthier@circum.com
------------------------------
Date: Tue, 04 Sep 2001 22:44:41 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Match starting from the nth occurrence of a character to the nth+1 occurrence
Message-Id: <slrn9pajkg.scn.tadmc@tadmc26.august.net>
Marc Schaefer <schaefer@pdtec.de> wrote:
>i've read the faq and some docs but apparently i need a function to do
>this or i'm to stupid to read.
perldoc -f split
>So here's my problem:
>
>I have a line
>
>eeeeeeeeee,adfgadvad,asdfvadfv,adfvadfva,advadvdav,advadfvdaffvadv
>
>and i need a RE that matches all between the 3th and 4th comma.
You can do it most easily without a pattern match:
my $fourth_field = (split /,/, $line)[3]; # List Slice
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 04 Sep 2001 09:22:36 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: Open 2 exes from Perl
Message-Id: <3b949cc6.492862739@news.isholf.is>
On Mon, 03 Sep 2001 15:36:10 GMT, Bart Lateur
<bart.lateur@skynet.be> wrote:
>Ilya Zakharevich wrote:
>
>>With the exception of legacy systems, you can put 1 as the first
>>argument to system() to start a program asyncroneously (retval is the PID).
>
>Hold it.
>
>I just tried this on Win32 (Indigoperl 5.6.1 on Win98), and it works:
>
> system(1, 'notepad');
>
>but htis does not:
>
> system('1 notepad');
>
>I can't find any mention in the docs (perldoc -f system). Is this one of
>those undocumented features, one that may disappear some time in the
>near future?
That's because it has nothing to do with perl.
It is a feature of the cmd.exe shell. I prefer
your way of system ("start notepad") for its
transparency.
To summarise, there are three ways:
system ('start notepad')
system(1, 'notepad');
use Win32::Process;
Regards,
Helgi Briem
------------------------------
Date: Tue, 04 Sep 2001 22:08:36 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: OT: Re: Recommendations for a PERL editor
Message-Id: <slrn9paktv.5ot.tim@vegeta.ath.cx>
Me parece que Jonadab the Unsightly One <jonadab@bright.net> dijo:
> tim@vegeta.ath.cx (Tim Hammerquist) wrote:
>
> > I usually have no more running than MSIE, Netscape, WS_FTP, (PWS ||
> > Apache), AIM, and.... well, you see why I had to switch. ;)
>
> In some ways I would like to switch, but I can't give up
> Pegasus Mail. I do have a linux box I can ssh into and
> do stuff, but if I need to use X I have to reboot my main
> system and run Linux there for however long I need X. I
> tried running pmail in WINE, and I had *some* success, but
> it just wasn't a workable solution for everyday.
One word: mutt. Forget WINE. Never got into Pegasus (though I did use
it for a bit). Used Netscape on Win98 and Linux until I worked out
config on mutt, and (with any luck) will never, ever, ever have to go
back.
http://www.mutt.org/
> > > Linux stability is compromised by (what I've discovered so far):
> > > - running out of swap space
> >
> > Never experienced this. What distro? Mine's Linux-Mandrake 7.1.
>
> At the time, RedHat 6.0. I only had 32MB of physical RAM,
> and only 32MB of swap, and I was trying to run Gnome and
> WINE, and it just wasn't working. (Ever see Enlightenment
> take an hour to close a window?) I redid a partition and
> made room for 128MB of swap space instead of 32, and that
> totally solved the problem. Since then I've added more
> RAM and picked up a newer distro...
No, I've never seen anything take that long to close a window since
Windows for Workgroups. (What was that, like, 3.11 or something?!)
Actually, my runaway logrotate process slowed down X that much, but it
was quite recoverable. (I have 128MB real RAM, 256MB swap.)
--
It is a fool's prerogative to utter
truths that no one else will speak.
-- Morpheus, The Sandman
------------------------------
Date: Tue, 04 Sep 2001 22:09:01 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Problems writing to a file that already exists!
Message-Id: <slrn9pahbe.s4u.tadmc@tadmc26.august.net>
Peter Mann <Pcmann1@btinternet.com> wrote:
>I am having difficulties writing to a file that already exists.
I do not see you attempting to do any writing below.
You are having difficulties with _opening_ a file, not with
writing to a file.
>From the
>books I have read relating to this problem, I can't determine the most
>suitable option to specifiy in the code extract below.
What books do you have? Titles please.
>For instance, I have opened the file for write only, and if it doesn't exist
>then create it. However, when the file does already exist (i.e. report.htm),
>it should delete it and create a new one.
Why?
Why can't it just delete the file's _contents_ and reuse the same inode?
If you really want a _new_ file (different inode), then you can
just unlink() and ignore the return value before your open().
(which will still be a "race", see below)
>But there doesn't appear
Where have you looked?
>to be a
>suitable 'option' to delete if already exists. Can someone please advise me
>if there is a simple option to do this.
Have you tried looking on your very own hard drive yet?
(rhetorical question, we can see that you didn't, else
you would already have your answer :-)
perldoc -q open
"How come when I open a file read-write it wipes it out?"
Hey! You _want_ it to wipe out the file. Maybe you should
read that Frequently Asked Question's answer:
--------------------------
...
To open file for writing, create new file if needed or
else truncate old file:
open(FH, "> $path") || die $!;
sysopen(FH, $path, O_WRONLY|O_TRUNC|O_CREAT) || die $!;
sysopen(FH, $path, O_WRONLY|O_TRUNC|O_CREAT, 0666) || die $!;
--------------------------
try O_TRUNC.
Use the docs Luke.
>The only other way I can think of is
>to check if the file exists, and if it does delete it before creating a new
>one. But this appears clumsy coding style.
It is far far worse than merely a "style issue". You have described
what is called a "race condition" where data can become corrupted
in multitasking environments (such as CGI stuff).
>Any suggestions would be much appreciated.
Please check the Perl FAQs *before* posting to the Perl newsgroup.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 04 Sep 2001 22:11:01 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: Recommendations for a PERL editor
Message-Id: <slrn9pal2g.5ot.tim@vegeta.ath.cx>
Me parece que Tad McClellan <tadmc@augustmail.com> dijo:
[ snippage ]
> With "#!/usr/bin/perl\r\n" it determines in step 1 that the
> processor's name is "/usr/bin/perl\r". You get "file not found"
> when there is not a file with that name.
>
> With "#!/usr/bin/perl -w\r\n", step 1 works fine (it stops
> at whitespace), and step 2 passes "-w\r" as an argument to perl,
> and _perl_ Does The Right Thing.
>
> When you add a switch, it is perl rather than the OS that
> gets to deal with the Carriage Return.
One more reason to use -Tw in CGI scripts, right? :)
--
"The Devil made me do it."
I have never made one of them do anything. They live their own tiny lives.
I do not live their lives for them.
-- Lucifer, The Sandman
------------------------------
Date: 4 Sep 2001 15:15:53 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Recommendations for a PERL editor
Message-Id: <3b955299@news.victoria.tc.ca>
RoJo (rojo@mindspring.com) wrote:
: I'm new to PERL. I keep getting "The page cannot be displayed" when I
: use Windows 2000's Notepad to edit my scripts. An ISP support person
: tells me it has syntax errors that are introduced by the editor.
: Can someone recommend to me a reliable Windows-based editor that WON'T
: create these problems for me ???
: My email address is rojo@mindspring.com
Coming from a VMS background, there are two editors I rather like to use
because they support EDT keypad layout. Both also support rectangle cut
and paste (essential in my opinion), and both support numerous platforms.
JED, http://space.mit.edu/~davis/jed/
and SEDT
http://www.ultranet.com/~anker/sedt/sedt.htm
--
Want to access the command line of your CGI account? Need to debug your
installed CGI scripts? Transfer and edit files right from your browser?
What you need is "ispy.cgi" - visit http://nisoftware.com/ispy.cgi
------------------------------
Date: Tue, 04 Sep 2001 12:06:15 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: Recommendations for a PERL editor
Message-Id: <3b94c2d5.502606760@news.isholf.is>
On Mon, 03 Sep 2001 22:50:14 GMT, tim@vegeta.ath.cx (Tim
Hammerquist) wrote:
>Me parece que Yves Orton <demerphq@hotmail.com> dijo:
>> "sabin" <sabin@cornhusker.net> wrote in message news:<3b928912_8@Usenet.com>...
>> > Its $30. I've used it. Its 'ok' but seems to crash on me about every hour
>> > or so.
>>
>> Thats weird Ive never experienced that and I use it all the time.
>> Maybe its just W9x thats the problem? That does have a habit of
>> BSODing you at the worst moment.
W9x crashes frequently, but it does not BSOD. The BSOD
is an NT program specifically designed to catch the stack
trace in the event of a crash, much like $! and $? in Perl.
>UltraEdit-32 never crashed my Win98SE system. It was possibly the most
>stable application I installed.
>
>I wish I could've said the same for MS Word...
Neither UltraEdit nor MS Word (since 97) have ever crashed
my system, neither NT4 nor Win2K. Older versions of Word
sometimes crashed.
UltraEdit is very good and I heartily recommend it.
Believe it or not, I also recommend MS Word.
Regards,
Helgi Briem
------------------------------
Date: 4 Sep 2001 23:41:26 GMT
From: nuk@panix.com (nuk)
Subject: Re: Recommendations for a PERL editor
Message-Id: <slrn9papm5.u7.nuk@panix1.panix.com>
In article <3b926160.358347636@news.mindspring.com>, RoJo wrote:
>I'm new to PERL. I keep getting "The page cannot be displayed" when I
>use Windows 2000's Notepad to edit my scripts. An ISP support person
>tells me it has syntax errors that are introduced by the editor.
>Can someone recommend to me a reliable Windows-based editor that WON'T
>create these problems for me ???
My first suggestion would be to download and learn the Win32 version of
vim. Next on my list would be NoteTab, which comes in a Pro version
(shareware) or a Light version (freeware). You can do some pretty
hardcore stuff (compared to the stock NotePad), even w/ the 'Light'
version.
nuk
------------------------------
Date: Tue, 4 Sep 2001 17:00:12 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Recommendations for a PERL editor
Message-Id: <3b956aff$1@news.microsoft.com>
"RoJo" <rojo@mindspring.com> wrote in message
news:3b926160.358347636@news.mindspring.com...
> I'm new to PERL. I keep getting "The page cannot be displayed" when I
> use Windows 2000's Notepad to edit my scripts. An ISP support person
> tells me it has syntax errors that are introduced by the editor.
Bullshit. An editor doesn't introduce 'syntax errors'.
You mentioned "an ISP support person". Are you talking about a
CGI/web-service scenario where you are editing your scripts locally (on
Win2k) and then upload them to a server (running some sort of Unix?). I that
case did you test your scripts locally on your W2k box? I bet they run just
fine.
Your problem is most likely that your ISPs web server can't handle the
EndOfLine 0x0A 0x0D used in the Windows world.
Trivial solution:
- upload the files in text mode instead of in binary mode (then the FTP
program should do the conversion automatically)
- or use dos2unix to change the lineEndMarkers from Windows to Unix
standards
> Can someone recommend to me a reliable Windows-based editor that WON'T
> create these problems for me ???
I could recommend a good editor, but it wouldn't solve your problem because
your problem is not caused by the editor.
jue
------------------------------
Date: Tue, 04 Sep 2001 22:09:00 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Regular Express
Message-Id: <slrn9paggh.s4u.tadmc@tadmc26.august.net>
Bart Lateur <bart.lateur@skynet.be> wrote:
>Stefan Adams wrote:
>
>>Subject: Regular Express
>
>Whauh, that one's original.
>
>> want to capture all text in between ...<BODY ...>(Capture all
>>this)</BODY>...
>>I assumed the RE /<BODY\s+.*?>(.*?)</BODY>/ would work, but it
>>doesn't. Any suggestions?
>
>First of all, you'll need to escape the slash. Second, /.*/ doesn't
>match newlines, so you'll need to add the /s modifier. And finally, it
^^^^^^^
But we are not even close to a robust solution yet :-(
>ight be a good idea to make the regex case-insensitive, using the /i
>modifier.
These are legal HTML but they don't match at all:
<BODY>no \s after BODY</BODY>
<BODY >stuff</BODY
>
<BODY
>stuff</BODY>
And this one matches, only it is the wrong characters:
<BODY >before<!-- superceded: <BODY>way before</BODY> --> after</BODY>
After torturiously discovering about 20 such strangocities, you:
Give up! And type:
perldoc -q HTML
There is a reason for the "F" in FAQ.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 5 Sep 2001 00:32:05 +0200
From: peter pilsl <pilsl_@goldfisch.at>
Subject: require and mod_perl
Message-Id: <3b955668@e-post.inode.at>
My mod_perl-scripts all follows the following scheme:
--main.pl---
use module;
require './main.lib.pl'
run();
--main.lib.pl
sub run
{
module_sub1();
module_sub2();
sub1();
sub2();
module_sub3();
}
sub1 { ...};
sub2 { ...};
I use this scheme to avoid the 'nested subroutine'-problems as recommended
in mod_perl doc at
http://perl.apache.org/guide/porting.html#The_First_Mystery
Now, in a thread on comp.lang.perl.modules I was told that this structure
makes the whole thing unrelieable, cause it ends up in using old
perl4-style libraries. To tell the truth, I dont understand what this
exactely means and I wonder if my scheme is something to be concerned about
or not.
thnx,
peter
--
mag. peter pilsl
pilsl_@goldfisch.at
http://www.goldfisch.at
------------------------------
Date: Tue, 04 Sep 2001 10:25:38 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: weird kind of eof
Message-Id: <3b94a968.496097680@news.isholf.is>
On Mon, 03 Sep 2001 21:08:47 GMT, "Bart Van der Donck"
<bart@nijlen.com> wrote:
>Hello,
>
>My string contains an eof that I cannot detect.
>The purpose is to delete the eof from my string.
>
>I tried about all to delete it:
>chop $a;
>chomp $a;
>$a=~s/\n\gi;
>$a=~s/\\n\gi;
>$a=~s/\^M//gi;
>and some others that I found in the docs.
>
>In notepad the string appears as a little square. On a unix prompt it has
>the same effect as pressing the "Return"-key.
>
>The question is:
>Is there a line that erases all kinds of eofs (DOS, Unix) from my string ?
Well, first of all it isn'ts an eof. That stands for
end-of-file which the line break character certainly
is not (eof is not a character, just the end of the file).
The line break on Unix is coded with an \n (ASCII 10, also
known as <LF> or linefeed, on Macs with an \r (ASCII 13,
<CR> or carriage return and on PCs with both or \n\r.
Most PC programs understand the Unix linefeed. About the
only one I have found that does not is Notepad. What you
see as black boxes in Notepad is the \n in a Unix text file
without the \r which Notepad needs to put in a proper
linebreak. Wordpad, Word, UltraEdit, TextPad, Notepad Plus
and many other programs do not suffer from this limitation.
Many allow you to select Unix style linebreaks as default
if you wish.
The most useful regex for the purpose of changing a Mac
or PC text file to Unix format is s/\r\n*/\n/g.
If you want to remove all line breaks use s/[\n|\r]//g.
Regards,
Helgi Briem
------------------------------
Date: Wed, 5 Sep 2001 09:21:58 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Why doesn't this regex work?
Message-Id: <slrn9paogm.7k6.mgjv@martien.heliotrope.home>
On Tue, 04 Sep 2001 19:46:46 GMT,
Bart Lateur <bart.lateur@skynet.be> wrote:
> Benoit Gauthier wrote:
>
>>$data =~ /(.{0-20})/;
>>$data = $1;
>
> Of course, once the same error is fixed (comma not hyphen), this one
> will work. But so does this:
>
> $data =~ s/(.{0,20}).*/$1/s;
And this:
$data = sprintf "%.20", $data;
or
$data = pack "a20", $data;
Martien
--
Martien Verbruggen |
Interactive Media Division | The world is complex; sendmail.cf
Commercial Dynamics Pty. Ltd. | reflects this.
NSW, Australia |
------------------------------
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 1693
***************************************