[19941] in Perl-Users-Digest
Perl-Users Digest, Issue: 2136 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 15 06:07:06 2001
Date: Thu, 15 Nov 2001 03:05:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1005822312-v10-i2136@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 15 Nov 2001 Volume: 10 Number: 2136
Today's topics:
Re: a good perl editor - know one?? <nospam_kingony@yahoo.com>
Re: a good perl editor - know one?? (zaltais)
Re: Accessing NT Network Neighbourhood <s.i.warhurst@rl.ac.uk>
ANNOUNCE: Text::Balanced 1.87 (Damian Conway)
Re: backward compatible? <robert@context.nl>
Re: backward compatible? <Tassilo.Parseval@post.rwth-aachen.de>
Re: Can not create new HTML page with cgi.pm (Wiliam Stephens)
Re: Can this be done without having to spoof IP's ?? <postmaster@[127.0.0.1]>
Re: DBI changing from CSV to mySQL probs (Garry Williams)
is there a function... <sidarous@isr6132.urh.uiuc.edu>
Re: is there a function... <echang@netstorm.net>
Re: is there a function... <mgjv@tradingpost.com.au>
Re: is there a function... (Garry Williams)
Re: is there a function... <bart.lateur@skynet.be>
Re: nested foreach - how to speed up or optimize ? <goldbb2@earthlink.net>
Re: ranged arrays (Anno Siegel)
Regular Expression Madness <slaterm@trinetdigital.com.au>
Re: Regular Expression Madness <bernard.el-hagin@lido-tech.net>
Re: Regular Expression Madness <sh@planetquake.com>
Re: Regular Expression Madness <tylercruz@home.com>
Re: Regular Expression Madness <bart.lateur@skynet.be>
Re: Regular Expression Madness <bernard.el-hagin@lido-tech.net>
Re: repeated string <goldbb2@earthlink.net>
Re: setuid cgi? (Garry Williams)
Re: Simple Question: use variable in regexp (joes)
Re: Simple Question: use variable in regexp (Anno Siegel)
Re: Simple Question: use variable in regexp <bart.lateur@skynet.be>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 15 Nov 2001 04:48:16 GMT
From: "Aaron Dancygier" <nospam_kingony@yahoo.com>
Subject: Re: a good perl editor - know one??
Message-Id: <kOHI7.106609$n5.13225420@typhoon.nyc.rr.com>
Gvim is available for windows. I does color coding.
"Chris Russell" <C.G.Russell@bradford.ac.uk> wrote in message
news:3bebf58f.711304872@news.brad.ac.uk...
> On Mon, 5 Nov 2001 21:01:17 +0000 (UTC), Louis Erickson
> <wwonko@rdwarf.com> wrote:
>
> >Paul Spitalny <pauls@cascadelinear.com> wrote:
> >: Hi,
> >: Anyone know of a text editor (For a windows platform) specifically
> >: targeted to PERL that has features like color coding of key works and
> >: other nice development aids?
> >
> >Once again, I'll reccomend Komodo by ActiveState. If I recall properly
> >there is a "personal use" version which is free, but the others cost
>
> It's a "non-commercial use" license rather than just "personal use".
> Working in education it suits my needs just fine but for other kinds
> of non-government or non-education projects you might need to check
> whether the license covers you or not.
>
> I downloaded it when I got my copy of ActiveState Perl and whilst I
> wouldn't say it's great I have yet to find a big enough reason to
> change now that I'm used to it and familar with it. The major
> annoyances for me are the Word style highlighting of grammar/synatax
> errors that it picks up and these you can turn off if you don't want
> them.
>
> >The only problems
> >I'm aware with it are that it's based on Mozilla, and therefore a little
> >slow, and a little disc-hungry.
>
> More memory than disc I would have said with it's Mozilla-ness. I have
> 128Mb here at work and it's a little slow. Back home I have half a gig
> with a similar spec processor (Celery 533) and it goes like the
> proverbials off a shiny shovel.
>
------------------------------
Date: 15 Nov 2001 02:49:51 -0800
From: zaltais@oceanfree.net (zaltais)
Subject: Re: a good perl editor - know one??
Message-Id: <919d9cd5.0111150249.714c920e@posting.google.com>
I use PerlIDE on windows available here
http://open-perl-ide.sourceforge.net/
It's quite similar to Komodo, but it's fast, free and supports MDI,
and has a highly configurable interface. Loads of other nifty
features...
Cheers,
Zaltais
"Daniel Berger" <djberg96@hotmail.com> wrote in message news:<ehJF7.26852$CN5.1821104@typhoon.mn.mediaone.net>...
>
<snip>
>
> Actually, the 1.2 Beta is out now, and it's at least usable on Windows. 1.1
> was a miserable piece of dung, IMO. RAM hungry, slow, the cursor sometimes
> randomly disappeared and the debugger flat out *just didn't work*. 1.2
> seems to have fixed the big issues, but it's still kinda slow. But, hey,
> it's free.
>
> Not really "cross-platform", though. It works on Windows and Linux only
> (i.e. there's no Solaris or FreeBSD version). Last time I tried it, the
> Linux version was even clunkier than the windows version (though I haven't
> tried the latest). I also don't like any program that forces me to manually
> dump errors to /dev/null when I start it from the command line. Puke.
>
> Regards,
>
> Dan
------------------------------
Date: Thu, 15 Nov 2001 10:33:52 -0000
From: "S Warhurst" <s.i.warhurst@rl.ac.uk>
Subject: Re: Accessing NT Network Neighbourhood
Message-Id: <9t05mg$mva@newton.cc.rl.ac.uk>
<nobull@mail.com> wrote in message news:u91yj1kvil.fsf@wcl-l.bham.ac.uk...
> > How am I supposed to know that?
>
> You just are. In the same way as you are supposed to intuatively know
> that the route from Birmingham to London does not depend on if you are
> driving a Volvo or a BMW (although it may be different if you are
> driving an 18-wheeler rather than a car).
I already cited an example of how one's reasoning could lead an uninformed
person to think that maybe there is still something that needs to be done in
Perl.
> Yes of course they have. As have poeple writing programs that run in
> background on NT servers (or indeed VMS and Unix) in other languages
> and in contexts other than Web servers. However posting to a
> newsgroup because the people who frequent it are likely know the
> answer to a question that's not related to the subject of the
> newsgroup is very poor form.
It wasn't my original intention to do that, and at the end of the day I had
a problem that was either going to be Perl, Perl CGI, Apache, or NT. I was
exploring many avenues at the same time as posting that, but until I knew
the answer I couldn't say for sure it wasn't Perl, so why should I not post
here?
If someone went to alt.doors and said "I can't open my door", some would say
"have you tried the lock?" and others would say "what the hell are you doing
posting here, you clearly need to go to alt.locks". A somewhat blinkered
approach, I feel. The lock is still connected to the overall functionality
of the door, in those cases where a door has a lock, so for those who have
experience with locks it wouldn't really be putting them out to help the
guy, would it?
> There's a very high denisity of
> Unix/NT/CGI/Apache/HTTP/HTML/SMTP gurus 'round here (beause these are
> the sort of people who use Perl). You'll find that we do usually
> answer such questions - but we generally make a point of saying that
> you are in the wrong place.
Yes, I've been here several times and most ppl are extremely helpful and
knowledgable. I have no objection at all to ppl suggesting other avenues of
research/other NGs where the question might be more appropriate, but to get
on a high-horse or adopt "a tone" it not called for, and given that I think
I have the right to defend myself.
> The point is that in general programs that get called outside of your
> current interactive login session (for any purpose, in any language,
> on any OS) may run with different credentials from ones that run
> inside your current interactive login session.
>
> How to influence the these credentials will have a lot more to do with
> the OS with and what's calling the program than it will to do with the
> choice of programming language. To people who've been programming for
> years (or even decades) (not necessarily in Perl) this seems as
> blindingly obvious as my car manufacturer analogy above. It's very
> hard for us to remember what it was like not to know these things
> intuatively.
Point taken.. thanks to a guy who just replied out of the NG, the problem
was the account the Apache service was running on, under NT. I couldn't find
an account in User manager because it was using the System Account! It
needed to run on a user account. It's all clear now! If only I could unpost
my original request for help.
> Actually I do take you seriously. You'd definitely be scored-up in my
> score file if I used one. If you carry on being defensive I may need
> to revise my oppinion.
Well, sorry if you feel that way. Go ahead and revise, but I do not
deliberately post off-topic and spent alot of time looking into this problem
before posting here and genuinely needed help. Maybe there are glaring gaps
in my knowledge and understanding, or flaws in my powers of lateral
thinking, but I don't go round chastising ppl with less knowledge than
myself, so I don't expect it in return.
Regards
Spencer
------------------------------
Date: 15 Nov 2001 10:26:16 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: ANNOUNCE: Text::Balanced 1.87
Message-Id: <9t0588$e2s$1@towncrier.cc.monash.edu.au>
Keywords: perl, module, release
==============================================================================
Release of version 1.87 of Text::Balanced
==============================================================================
NAME
Text::Balanced - Extract delimited text sequences from strings.
SUMMARY (see Balanced.pod for full details)
Text::Balanced::extract_delimited
`extract_delimited' extracts the initial substring of a string
which is delimited by a user-specified set of single-character
delimiters, whilst ignoring any backslash-escaped delimiter
characters.
Text::Balanced::extract_bracketed
`extract_bracketed' extracts a balanced-bracket-delimited substring
(using any one (or more) of the user-specified delimiter brackets:
'(..)', '{..}', '[..]', or '<..>').
Text::Balanced::extract_quotelike
`extract_quotelike' attempts to recognize and extract any one of the
various Perl quote and quotelike operators (see "perlop(3)"). Embedded
backslashed delimiters, nested bracket delimiters (for the
quotelike operators), and trailing modifiers are all correctly handled.
Text::Balanced::extract_codeblock
`extract_codeblock' attempts to recognize and extract a
balanced bracket-delimited substring which may also contain
unbalanced brackets inside Perl quotes or quotelike
operations. That is, `extract_codeblock' is like a combination
of `extract_bracketed' and `extract_quotelike'.
Text::Balanced::extract_tagged
`extract_tagged' attempts to recognize and extract a
substring between two arbitrary "tag" patterns (a start tag
and an end tag).
INSTALLATION
It's all pure Perl, so just put the .pm file in its appropriate
local Perl subdirectory.
AUTHOR
Damian Conway (damian@cs.monash.edu.au)
COPYRIGHT
Copyright (c) 1997-2001, Damian Conway. All Rights Reserved.
This module is free software. It may be used, redistributed
and/or modified under the same terms as Perl itself.
==============================================================================
CHANGES IN VERSION 1.87
- Made extract_multiple aware of skipped prefixes returned
by subroutine extractors (such as extract_quotelike, etc.)
- Made extract_variable aware of punctuation variables
- Corified tests
==============================================================================
AVAILABILITY
Text::Balanced has been uploaded to the CPAN
and is also available from:
http://www.csse.monash.edu.au/~damian/CPAN/Text-Balanced.tar.gz
==============================================================================
------------------------------
Date: Thu, 15 Nov 2001 09:31:15 +0100
From: "Fringel" <robert@context.nl>
Subject: Re: backward compatible?
Message-Id: <9svugr$ch0$1@news.hccnet.nl>
Can someone provide me with an URL where I can find the major changes
between these Perl versions?
<nobull@mail.com> wrote in message news:u9wv0tjg3h.fsf@wcl-l.bham.ac.uk...
> "Fringel" <robert@context.nl> writes:
>
> > Is the new version of Perl 5.6 backward compatible with the script
written
> > for Perl 5.005.
> >
> > Or are there cases known for wich I have to edit my script in order to
run
> > them in v5.6.
>
> In general no. Actually there were quite a few problem with 5.6.0 but
> these were largely fixed by 5.6.1.
>
> Eg. in 5.6.0 v65 is treated as 'A' even if it appears in a context
> where words are usually implicitly quoted (such as the subscript of a
> hash or the LHS of a fat comma). I recall this broke at least one of
> my scripts.
>
> Obviously any code written in 5.5 that only works because it exploits
> bugs in 5.5 that were subequently fixed won't work in 5.6.x!
>
> Another obvious[1] case is if you had any subroutines called CHECK.
>
> [1] Obvious that is having just read 'perldoc perldelta'.
>
> --
> \\ ( )
> . _\\__[oo
> .__/ \\ /\@
> . l___\\
> # ll l\\
> ###LL LL\\
------------------------------
Date: Thu, 15 Nov 2001 10:10:56 +0100
From: "Tassilo v. Parseval" <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: backward compatible?
Message-Id: <9t00r0$rcp$02$1@news.t-online.com>
[
Please put your comments below the suitably trimmed text
that you quote.
]
On Thu, 15 Nov 2001 09:31:15 +0100, Fringel wrote:
> Can someone provide me with an URL where I can find the major changes
> between these Perl versions?
It is probably on your harddrive: 'perldoc perldelta'
Tassilo
--
One family builds a wall, two families enjoy it.
------------------------------
Date: 15 Nov 2001 02:57:44 -0800
From: wil@fbagroup.co.uk (Wiliam Stephens)
Subject: Re: Can not create new HTML page with cgi.pm
Message-Id: <39e3e00a.0111150257.3d5613de@posting.google.com>
Patrick Bennett <pbennett@mills.edu> wrote in message news:<3BF2F2F9.760D644@mills.edu>...
> Created a simple enter information and then print results script using
> cgi.pm.
> The results page is appended to the bottom of the original enter your
> information page.
> This behavior causes the results page not to be shown without scrolling
> down, if a
> user is not aware of this behavior it seems as the page is doing
> nothing. I have tried
> many things... can not get the results page to reprint. New to cgi...
> thanks in advance,
> please reply to pbennett@mills.edu .
> --
Have you looked at the CGI.pm pages on the WWW?
http://stein.cshl.org/WWW/software/CGI/
Should help to get you started. I haven't looked at this site for a
while, but I believe there are a few example script there including
source code. One of which shows an example of using CGI.pm to handle
forms.
Cheers
Wiliam Stephens
------------------------------
Date: Thu, 15 Nov 2001 07:34:55 +0000
From: Tony Evans <postmaster@[127.0.0.1]>
Subject: Re: Can this be done without having to spoof IP's ??
Message-Id: <3bf3701f$1@hoth.darkstorm.local>
In ntl.discussion.linux, "Scott" <thechile@ntlworld.com> wrote:
>At the moment request's for the web server go to the IP of the first DSL
>line which also serves the content. What I want to do though is have
>requests come in on first DSL line and then served by apache via the second
>DSL line. Kind of like the request is looped.
>
>client-request --> DSL1/NIC1 ----
>>APACHE -->DSL2/NIC2 ---->data-to-clients-browser
What is the default route on the machine?
Surely, traffic leaves the box over the default route[1], regardless of
which interface it arrives on?
[1] unless there is a more specific route of course.
--
Tony Evans (ICQ : 170850)
GCv312 GCS d s+:++ a C+++ UAL++++$ P+ L++ E W(++) N+++(N--) w++$ R+ tv-- b++
Seduced by the chocolate side of the force.
Homepage : http://www.darkstorm.org
------------------------------
Date: Thu, 15 Nov 2001 04:25:57 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: DBI changing from CSV to mySQL probs
Message-Id: <slrn9v6guo.3r8.garry@zfw.zvolve.net>
On Wed, 14 Nov 2001 17:16:24 -0700, Michael Cook <mikecook@cigarpool.com> wrote:
> Hi folks!
> I am successfully running DBI using CSV files and am changing over to a
> mySQL DB. Below is the code I am trying to use to insert test data and I get
> the error:
>
> var=|| Content-type: text/html
> Software error:
> Can't call method "do" on an undefined value at addpipe.pl line 188.
>
> Can anyone point me in the right direction?
> Thx a million!!!
> Michael
>
> $db = 'pipes';
> $dbuser='user';
> $dbpasswd='password';
> $dbh = DBI->connect("DBI:mysql:$db:host.domain.com", $dbuser, $dbpasswd);
Change this last statement to
my $dbh = DBI->connect("DBI:mysql:$db:host.domain.com", $dbuser,
$dbpasswd, { RaiseError => 1,
PrintError => 1 });
and all will be revealed.
See the DBI manual page.
--
Garry Williams
------------------------------
Date: Wed, 14 Nov 2001 21:02:36 -0600
From: Mark Sidarous <sidarous@isr6132.urh.uiuc.edu>
Subject: is there a function...
Message-Id: <Pine.LNX.4.33.0111142101160.25477-100000@isr6132.urh.uiuc.edu>
is there a function that can insert some variable in the middle
of an array and shift everything that comes after over to make room for
it?
--
------------------------------
Date: Thu, 15 Nov 2001 03:12:37 GMT
From: "E.Chang" <echang@netstorm.net>
Subject: Re: is there a function...
Message-Id: <Xns9159E2FA192A6echangnetstormnet@207.106.93.86>
Mark Sidarous <sidarous@isr6132.urh.uiuc.edu> wrote in
news:Pine.LNX.4.33.0111142101160.25477-100000@isr6132.urh.uiuc.edu:
> is there a function that can insert some variable in the middle
> of an array and shift everything that comes after over to make room
> for it?
splice
--
EBC
------------------------------
Date: Thu, 15 Nov 2001 03:50:13 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: is there a function...
Message-Id: <slrn9v6esg.dv2.mgjv@verbruggen.comdyn.com.au>
On Wed, 14 Nov 2001 21:02:36 -0600,
Mark Sidarous <sidarous@isr6132.urh.uiuc.edu> wrote:
> is there a function that can insert some variable in the middle
> of an array and shift everything that comes after over to make room for
> it?
splice
Documentation on splice can be found in the perlfunc documentation,
which you can access with man on Unices, perldoc on many platforms,
and Shuck on Macs.
Martien
--
|
Martien Verbruggen | The world is complex; sendmail.cf
Trading Post Australia Pty Ltd | reflects this.
|
------------------------------
Date: Thu, 15 Nov 2001 04:32:50 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: is there a function...
Message-Id: <slrn9v6hbl.3r8.garry@zfw.zvolve.net>
On Wed, 14 Nov 2001 21:02:36 -0600, Mark Sidarous
<sidarous@isr6132.urh.uiuc.edu> wrote:
> is there a function that can insert some variable in the middle of
> an array and shift everything that comes after over to make room for
> it?
The manual is your friend! :-)
Look at the "Perl Functions by Category" section of perlfunc:
Functions for real @ARRAYs
"pop", "push", "shift", "splice", "unshift"
^^^^^^
That one looks promising, eh?
perldoc -f splice
--
Garry Williams
------------------------------
Date: Thu, 15 Nov 2001 10:54:38 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: is there a function...
Message-Id: <b277vtg4ddkj0hk65ailflijtcj9tc9ai5@4ax.com>
Mark Sidarous wrote:
>is there a function that can insert some variable in the middle
>of an array and shift everything that comes after over to make room for
>it?
splice(). See the docs (perlfunc) for the description. But using it the
first time might be daunting. So here are some examples:
@a = qw(a b c d);
@b = splice @a, 1, 2, "x", "y", "z";
This will replace 2 items starting at position 1 (thus "b" and "c", as
the "a" is at position 0), with the three items "x", "y" and "z", and
stuff the old items in @b. You can see the results with this snippet:
$" = ', ';
print "\@@ = (@a); \@b = (@b)\n";
Now for some variations, replacing the splice() call in the above code:
@b = splice @a, 1, 0, "x", "y", "z";
# doesn't delete anything, just makes room for these 3 items
@b = splice @a, 1, 2;
# just deletes the "b" and "c"
@b = splice @a, 2;
# deletes everything leaving just the first 2 items
@b = splice @a, -3;
# deletes the last 3 items
@b = splice @a, -3, 3, "x";
# replaces the last 3 items with one, an "x".
--
Bart.
------------------------------
Date: Thu, 15 Nov 2001 02:32:16 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: nested foreach - how to speed up or optimize ?
Message-Id: <3BF36F7F.D930E67@earthlink.net>
Grzegorz Goryszewski wrote:
[snip]
Your code looks to me like:
foreach $luser (keys %users) {
foreach $zak (keys %zakoncz) {
foreach $rozp (keys %rozpocz) {
print "stuff"
if ($zak eq $rozp && $luser eq $zakoncz{$zak}[2]);
}
}
}
You should be able to reduce this to:
foreach my $zak (keys %zakoncz) {
my ($ropz, $luser) = ($zak, $zakoncz{$zak}[2]);
print "stuff"
if exists $rozpocs{$ropz} && exists $users{$luser};
}
--
Klein bottle for rent - inquire within.
------------------------------
Date: 15 Nov 2001 10:08:16 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: ranged arrays
Message-Id: <9t046g$5fg$1@mamenchi.zrz.TU-Berlin.DE>
According to Steffen Müller <tsee@gmx.net>:
> "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> schrieb im Newsbeitrag
> news:9su5qe$4pd$1@mamenchi.zrz.TU-Berlin.DE...
> | According to Steffen Müller <tsee@gmx.net>:
>
> [...]
>
> | > If perl passed the negative index values to the custom methods, I
> could
> | > map them to the upper range of the array myself so that I could test for
> | > indices to be within $lower_limit < $index < $upper_limit instead of
> | > $lower_limit < $index < $#{$self->{ARRAY}}!
> | > Does anybody have a workaround for this?
> |
> | Rearrange storage accordingly. In your -5 .. 50 example, store elements
> | 0 .. 50 under indices 0 .. 50, then -5 .. -1 under 51 .. 55. Well,
> | actually this will happen all by itself when you initialize the actual
> | array to [ ( undef ) x ( $upper - $lower)]. The drawback is that you
> | cannot tell the user in an error message whether they have violated the
> | upper or the lower limit, you'll only know they're out of range.
>
> I did that initialization for just that reason. I can't even warn the users
> that they've violated any limit in *all* cases. The problem is that my
> FETCH/STORE methods never see the original negative value. In my example,
> Perl automatically maps -5..-1 to 51..55, so I must not warn if the users
> access 51..55 because I don't want to warn if they access -5..-1 (because
> for my method, it looks exactly the same).
>
> Seems kind of hopeless to get it working *this* way. *sigh*
True, you can't even detect all cases of range violation. If that is
essential, I see only one vague possibility: Trying to detect if
FETCHSIZE has been called before FETCH/STORE and concluding that the
original index was negative if it was. Perhaps caller() (called from
FETCHSIZE) can distinguish calls that are made on behalf of FETCH/
STORE from others, but I doubt it. In any case, this approach is
rather hackish; I don't really recommend it even if it should work.
Anno
------------------------------
Date: Thu, 15 Nov 2001 16:41:00 +0800
From: "Michael Slater" <slaterm@trinetdigital.com.au>
Subject: Regular Expression Madness
Message-Id: <3bf37f81$1@usenet.per.paradox.net.au>
Hi..
I am having a heck of a time with a particular regular expression, that
should be very simple..
$text !~ s/<%.*%>//s;
what the above regex is supposed to do, is strip all asp tags and code out
of a block of html code.. but it does not do the job.
any ideas ?
regards,
Michael
------------------------------
Date: Thu, 15 Nov 2001 09:04:08 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
Subject: Re: Regular Expression Madness
Message-Id: <slrn9v748r.3il.bernard.el-hagin@gdndev25.lido-tech>
On Thu, 15 Nov 2001 16:41:00 +0800, Michael Slater
<slaterm@trinetdigital.com.au> wrote:
> Hi..
> I am having a heck of a time with a particular regular expression, that
> should be very simple..
>
> $text !~ s/<%.*%>//s;
>
> what the above regex is supposed to do, is strip all asp tags and code out
> of a block of html code.. but it does not do the job.
>
> any ideas ?
Yup, use an HTML parser to parse HTML. I suggest HTML::Parser available
at http://www.cpan.org/
Cheers,
Bernard
------------------------------
Date: Thu, 15 Nov 2001 09:10:57 GMT
From: "Sean Hamilton" <sh@planetquake.com>
Subject: Re: Regular Expression Madness
Message-Id: <BELI7.5108$c4.959629@news0.telusplanet.net>
> $text !~ s/<%.*%>//s;
Try:
$text =~ s/<%.*?%>//sg;
One of us is confused on the function of !~.
sh
------------------------------
Date: Thu, 15 Nov 2001 10:03:51 GMT
From: "Tyler Cruz" <tylercruz@home.com>
Subject: Re: Regular Expression Madness
Message-Id: <bqMI7.91766$Gh2.28970177@news2.rdc1.bc.home.com>
I'm a Perl newbie so I'm not sure about this, but other than switching to
=~, doesn't the RegEx parameters have to be in parethethis?:
$text =~ s/<%(.*?)%>//sg;
Tyler Cruz
"Sean Hamilton" <sh@planetquake.com> wrote in message
news:BELI7.5108$c4.959629@news0.telusplanet.net...
> > $text !~ s/<%.*%>//s;
>
> Try:
>
> $text =~ s/<%.*?%>//sg;
>
> One of us is confused on the function of !~.
>
> sh
>
>
------------------------------
Date: Thu, 15 Nov 2001 10:07:01 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Regular Expression Madness
Message-Id: <gq47vt0pegj87l78ld7su0dqi9h3gc6iip@4ax.com>
Michael Slater wrote:
>I am having a heck of a time with a particular regular expression, that
>should be very simple..
>
>$text !~ s/<%.*%>//s;
>
>what the above regex is supposed to do, is strip all asp tags and code out
>of a block of html code.. but it does not do the job.
>
>any ideas ?
Greediness. It will eat anything from the first opening marker till the
last closing marker. Try this instead:
$text =~ s/<%.*?%>//sg;
I'm assuming that the whole document is one string.
--
Bart.
------------------------------
Date: Thu, 15 Nov 2001 10:07:54 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
Subject: Re: Regular Expression Madness
Message-Id: <slrn9v780c.3il.bernard.el-hagin@gdndev25.lido-tech>
On Thu, 15 Nov 2001 10:03:51 GMT, Tyler Cruz <tylercruz@home.com> wrote:
> I'm a Perl newbie so I'm not sure about this, but other than switching to
>=~, doesn't the RegEx parameters have to be in parethethis?:
>
> $text =~ s/<%(.*?)%>//sg;
The parentheses are only necessary if you want to use what ".*?"
captures. It will be stored in the special $1 variable if the
()s are present. Read more in perlre.
But again, I have to warn you that you can't parse HTML with a regex.
Unless you're really sure of your input HTML you should be using
a parser. Don't say you weren't warned when you get burned.
Cheers,
Bernard
------------------------------
Date: Thu, 15 Nov 2001 02:02:07 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: repeated string
Message-Id: <3BF3686F.97577E15@earthlink.net>
Houda Araj wrote:
>
> > Are you sure you mean *all* repeated strings?
> No, I may say better repeated words, repeated phrases.
>
> Suppose a text
>
> Your words text appear on search result pages for the keywords you
> buy, and can be by language and country. So, to reach toy collector of
> tin toys you might buy word text the keywords toy collector toys.
>
> toy collector (repeated twice verbatim)
> word text (repeated plural and singular)
> toys is repeated
So not only do you need to check for repeats, but you also need to make
it so that singular and plural versions of the same word compare as
equal. You probably also want comparison to be case insensitive.
The normal solution for case insensitivity is to lowercase all the words
before doing anything else. A variant of this would likely work for
singular/plural, too, *if* you had a module which will convert the
plurality of a word, taking into account it's current plurality. Sadly,
Lingua::EN::Inflect will only convert *from* singular, and it can't
detect if a word is already plural. Afaik, there is no module which
will, given a word, detect if that word is singular or plural.
So here's a partial solution; it does case-insensitive matching, but it
does not take into account singular/plural:
my @words;
while( <FILE> ) {
push @words, map lc, m/(\w+)/g);
}
my %phrases;
for my $begin ( 0 .. $#words ) {
for my $end ( $begin .. $#words ) {
++$phrases{join " ", @words[$begin .. $end]};
}
}
while( my ($phrase, $count) = each %phrases ) {
next unless $count > 1;
print "<$phrase> occured $count times\n";
}
NB: This code is untested.
--
Klein bottle for rent - inquire within.
------------------------------
Date: Thu, 15 Nov 2001 04:16:42 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: setuid cgi?
Message-Id: <slrn9v6gdd.3r8.garry@zfw.zvolve.net>
On Thu, 15 Nov 2001 01:09:48 +0000 (UTC), David Efflandt
<efflandt@xnet.com> wrote:
> On Wed, 14 Nov 2001 07:42:28 GMT, Sean Hamilton <sh@planetquake.com> wrote:
>>> Err, that should read:
>>> Try an ISP with a cgi wrapper. Cobalt Linux comes with it built in.
>>
>> Geez, how did you manage to do that?
>>
>> I have root to this box, it's mine. Is it at all possible to do this with
>> just configuration, no special installations? Ideally I could just set the
>> setuid bit on the script, but then I just get "can't do setuid" in my Apache
>> logs. (/usr/bin/suidperl is chmod 6555)
>>
>> Running FreeBSD 4.4R.
>
> What is 6555. I believe suidperl should be 4755 in order to work, or at
> least that worked for me (even a test suid root CGI, but in the main
> cgi-bin, not under suexec).
First, it should be 06555 even if the chmod *command* fixes it up.
Second, there is no reason to *require* owner write to be set on any
executable.
Third, the answer lies in the chmod(1) manual page. 06555 is setuid
*and* setgid if it's applied to a file. (The setuid is undefined on a
directory and setgid on a directory is described in chmod(1).)
--
Garry Williams
------------------------------
Date: 15 Nov 2001 00:56:32 -0800
From: joes@bluewin.ch (joes)
Subject: Re: Simple Question: use variable in regexp
Message-Id: <26760a3e.0111150056.2c408b86@posting.google.com>
Thank you !
Now it iw working. It was my fault, I used then the wrong operator. My
german documentation does not really describe the difference between
tr and s. I should use another documentation in english then ;)
regards
Mark
> $replacement = 'worked';
> $string = 'Has this &H?';
> $string =~ s/&H/$replacement/;
>
> print $string, "\n";
>
> this outputs
>
> Has this worked?
>
> HTH
>
> Paul
------------------------------
Date: 15 Nov 2001 10:36:30 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Simple Question: use variable in regexp
Message-Id: <9t05re$5fg$2@mamenchi.zrz.TU-Berlin.DE>
According to joes <joes@bluewin.ch>:
> Thank you !
>
> Now it iw working. It was my fault, I used then the wrong operator. My
> german documentation does not really describe the difference between
> tr and s. I should use another documentation in english then ;)
What on earth are you using?
The German Camel is quite decent, translation-wise. Well, the second
edition was, I haven't looked at the third.
Anno
------------------------------
Date: Thu, 15 Nov 2001 11:00:57 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Simple Question: use variable in regexp
Message-Id: <o287vt0ncko97rk05vsvv41e6ptl6k5q47@4ax.com>
joes wrote:
>My german documentation does not really describe the difference between
>tr and s.
Jeezes. Where did you get THAT from?
--
Bart.
------------------------------
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 2136
***************************************