[29472] in Perl-Users-Digest
Perl-Users Digest, Issue: 716 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 3 09:09:59 2007
Date: Fri, 3 Aug 2007 06:09:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 3 Aug 2007 Volume: 11 Number: 716
Today's topics:
Re: @arts <bik.mido@tiscalinet.it>
Re: FAQ 4.32 How do I strip blank space from the beginn <bik.mido@tiscalinet.it>
Re: Home directory not seen as writable in Vista <invalid@invalid.org>
Re: Home directory not seen as writable in Vista <sisyphus1@nomail.afraid.org>
Re: Home directory not seen as writable in Vista <sisyphus1@nomail.afraid.org>
Re: Home directory not seen as writable in Vista <invalid@invalid.org>
Re: Home directory not seen as writable in Vista <invalid@invalid.org>
Re: How do you continue in a for loop? <njus@larshaugseth.com>
Re: I finally got a round tuit. (My first JAPH) <tadmc@seesig.invalid>
Re: Object creation failure in perl <bugbear@trim_papermule.co.uk_trim>
Re: Prototypes/Parameters to a Function/Sub-Routine anno4000@radom.zrz.tu-berlin.de
Re: Prototypes/Parameters to a Function/Sub-Routine anno4000@radom.zrz.tu-berlin.de
Re: SOAP::Lite "service" examples xhoster@gmail.com
Re: Stripping some HTML code, while leaving others <stoupa@practisoft.cz>
Re: Windows based perl editor? <shawnhcorey@magma.ca>
Re: Windows based perl editor? <shawnhcorey@magma.ca>
Re: Windows based perl editor? anno4000@radom.zrz.tu-berlin.de
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 03 Aug 2007 10:38:31 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: @arts
Message-Id: <0bq5b3t5oh8gmlo5gqn1of2dfg2bghsn89@4ax.com>
On Thu, 2 Aug 2007 17:03:03 -0700, Keith Keller
<kkeller-usenet@wombat.san-francisco.ca.us> wrote:
>and so on. But it doesn't terminate! Now Michele's sig is eating up
>all my CPU. What am I supposed to do?!?
But seriously, you're joking, aren't you?
gin:~ [10:37:07]$ perl > /dev/null
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
[1]+ Stopped perl > /dev/null
gin:~ [10:37:17]$ bg
[1]+ perl > /dev/null &
gin:~ [10:37:20]$ uptime
10:37:25 up 17 days, 15:52, 2 users, load average: 0.38, 0.67, 0.58
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 03 Aug 2007 12:02:02 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: FAQ 4.32 How do I strip blank space from the beginning/end of a string?
Message-Id: <a3v5b31pec7juvp1775ervh2ptkub1n9ia@4ax.com>
On Thu, 2 Aug 2007 10:47:01 -0500, "Mario D'Alessio"
<dalessio@motorola.NOSPAM.com> wrote:
>> And as for efficiency... is the provided solution not fast enough? I
>> can't imagine many situations in which this would matter.
>
>I never timed it, but I wondered if the processing of a
>regex makes it less efficient than a dedicated command
>similar to chomp.
The general answer is that you should not care, and if you do care
then you shouldn't program in Perl. If you're really concerned you may
try writing an XS version of your command and benchmark it along with
the regex based one.
Ciao,
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 03 Aug 2007 13:07:49 +0200
From: David Sudlow <invalid@invalid.org>
Subject: Re: Home directory not seen as writable in Vista
Message-Id: <46b30c84$0$5082$ba4acef3@news.orange.fr>
David Sudlow wrote:
> Sisyphus wrote:
>>
>> "David Sudlow" <invalid@invalid.org> wrote in message
>> news:46b2e10b$0$5077$ba4acef3@news.orange.fr...
>> .
>> .
>>>
>>> This gives 'writable' in xp or linux, but 'not writable' in vista,
>>> when run from a folder in my home directory.
>>>
>>> Same result for:
>>> >perl -e "if (-w qq{.}) {print qq{writable\n}} else {print qq{Not
>>> writeable\n}}"
>>>
>>> from the command line.
>>>
>>> Is this a perl on vista issue or something funny with my machine's
>>> set-up?
>>>
>>
>> It's more likely something with your machine's set-up, rather than
>> anything to do with perl.
>>
>> The only directories I could find where that one liner reported "Not
>> writable" were "Program Files" and "Program Files (x86)" - running
>> from a user account on Vista Business 64, with perl-5.8.8.
>>
>> Which version of perl are you running ?
>> What is the full path to your home directory ?
>>
>> Cheers,
>> Rob
>
> ActiveState Perl 5.8.8 build 820
>
> My home directory is c:/Users/dave and I have tried running from various
> sub-directories therein.
>
> The problem is not permissions as such but the result of the -w test
> when applied to a directory.
>
> The following script:
>
> use Cwd;
> print "Current directory: " . getcwd() . "\n";
> if (-w ".") {print "writable\n"} else {print "Not writeable\n"}
> open (LOG, ">", "logfile") or die "Can't create logfile";
> print "Opened logfile\n";
> if (-w "./logfile") {print "writable\n"} else {print "Not writeable\n"}
> print LOG "Log\n" or die "Unable to print to logfile\n";
> close LOG or die "Unable to close logfile\n";
>
> gives me this result (!):
>
> C:\Users\dave\Desktop\Test_ooDoc>perl write.pl
> Current directory: C:/Users/dave/Desktop/Test_ooDoc
> Not writeable
> Opened logfile
> writable
>
> So I can write to the directory from perl despite the negative test.
>
> This leads to the problem using OpenOffice::OODoc as it performs the
> test and believes the false result.
This is a weird Vista thing (or a weird interaction between vista's new
version of ntfs and the perl code). I have created a new subfolder in
the above folder and in there it all works as expected. Both folders
have apparently the same permissions and both are writable from perl but
they produce different results for the -w test.
------------------------------
Date: Fri, 3 Aug 2007 22:03:24 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: Home directory not seen as writable in Vista
Message-Id: <46b31980$0$15142$afc38c87@news.optusnet.com.au>
"David Sudlow" <invalid@invalid.org> wrote in message
news:46b2fb41$0$25949$ba4acef3@news.orange.fr...
.
.
>
> The problem is not permissions as such but the result of the -w test when
> applied to a directory.
.
.
> This leads to the problem using OpenOffice::OODoc as it performs the test
> and believes the false result.
I didn't test the Users tree as rigorously as I should have:
---------------------------------------------------
C:\Users>perl -e "if (-w qq{.}) {print qq{writable\n}} else {print qq{Not
writea
ble\n}}"
Not writeable
C:\Users>cd Rob
C:\Users\Rob>perl -e "if (-w qq{.}) {print qq{writable\n}} else {print
qq{Not wr
iteable\n}}"
writable
C:\Users\Rob>cd Desktop
C:\Users\Rob\Desktop>perl -e "if (-w qq{.}) {print qq{writable\n}} else
{print q
q{Not writeable\n}}"
Not writeable
C:\Users\Rob\Desktop>mkdir Test
C:\Users\Rob\Desktop>cd Test
C:\Users\Rob\Desktop\Test>perl -e "if (-w qq{.}) {print qq{writable\n}} else
{pr
int qq{Not writeable\n}}"
writable
C:\Users\Rob\Desktop\Test>
---------------------------------------------------
Sorry, I don't know why the -w test should determine that your "Test_ooDoc"
directory is "Not writable".
I think there will be people here who can provide a good explanation and
sound advice .... if not try the perl-win32-users mailing list (hosted by
ActiveState) or Perlmonks.
Cheers,
Rob
------------------------------
Date: Fri, 3 Aug 2007 22:03:39 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: Home directory not seen as writable in Vista
Message-Id: <46b3198e$0$12802$afc38c87@news.optusnet.com.au>
"David Sudlow" <invalid@invalid.org> wrote in message
news:46b30c84$0$5082$ba4acef3@news.orange.fr...
.
.
>> This leads to the problem using OpenOffice::OODoc as it performs the test
>> and believes the false result.
>
> This is a weird Vista thing (or a weird interaction between vista's new
> version of ntfs and the perl code). I have created a new subfolder in the
> above folder and in there it all works as expected. Both folders have
> apparently the same permissions and both are writable from perl but they
> produce different results for the -w test.
>
What is the difference between the way this "new subfolder" was created,
compared to the way that the "Test_ooDoc" subfolder was created.
I, too, find that there's no correlation between folder permissions (which
seem to invariably be Readonly) and what the -w test returns.
Cheers,
Rob
------------------------------
Date: Fri, 03 Aug 2007 14:23:42 +0200
From: David Sudlow <invalid@invalid.org>
Subject: Re: Home directory not seen as writable in Vista
Message-Id: <46b31e4e$0$27374$ba4acef3@news.orange.fr>
Sisyphus wrote:
>
> "David Sudlow" <invalid@invalid.org> wrote in message
> news:46b2fb41$0$25949$ba4acef3@news.orange.fr...
> .
> .
>>
>> The problem is not permissions as such but the result of the -w test
>> when applied to a directory.
> .
> .
>> This leads to the problem using OpenOffice::OODoc as it performs the
>> test and believes the false result.
>
> I didn't test the Users tree as rigorously as I should have:
>
> ---------------------------------------------------
> C:\Users>perl -e "if (-w qq{.}) {print qq{writable\n}} else {print
> qq{Not writea
> ble\n}}"
> Not writeable
>
> C:\Users>cd Rob
>
> C:\Users\Rob>perl -e "if (-w qq{.}) {print qq{writable\n}} else {print
> qq{Not wr
> iteable\n}}"
> writable
>
> C:\Users\Rob>cd Desktop
>
> C:\Users\Rob\Desktop>perl -e "if (-w qq{.}) {print qq{writable\n}} else
> {print q
> q{Not writeable\n}}"
> Not writeable
>
> C:\Users\Rob\Desktop>mkdir Test
>
> C:\Users\Rob\Desktop>cd Test
>
> C:\Users\Rob\Desktop\Test>perl -e "if (-w qq{.}) {print qq{writable\n}}
> else {pr
> int qq{Not writeable\n}}"
> writable
>
> C:\Users\Rob\Desktop\Test>
> ---------------------------------------------------
>
> Sorry, I don't know why the -w test should determine that your
> "Test_ooDoc" directory is "Not writable".
>
> I think there will be people here who can provide a good explanation and
> sound advice .... if not try the perl-win32-users mailing list (hosted
> by ActiveState) or Perlmonks.
>
> Cheers,
> Rob
>
>
I created another folder on the Desktop in the same way as the original
(right click new folder). This one gives 'writeable'.
I noticed that in your tests Users was not writable which is correct,
but that your Desktop wasn't either which is not. So you are seeing the
same symptom (some folders that should test as writable failing the
test). This is a bug either in Vista or perl as far as I can see.
------------------------------
Date: Fri, 03 Aug 2007 14:49:32 +0200
From: David Sudlow <invalid@invalid.org>
Subject: Re: Home directory not seen as writable in Vista
Message-Id: <46b3245b$0$27383$ba4acef3@news.orange.fr>
David Sudlow wrote:
> Sisyphus wrote:
>>
>> "David Sudlow" <invalid@invalid.org> wrote in message
>> news:46b2fb41$0$25949$ba4acef3@news.orange.fr...
>> .
>> .
>>>
>>> The problem is not permissions as such but the result of the -w test
>>> when applied to a directory.
>> .
>> .
>>> This leads to the problem using OpenOffice::OODoc as it performs the
>>> test and believes the false result.
>>
>> I didn't test the Users tree as rigorously as I should have:
>>
>> ---------------------------------------------------
>> C:\Users>perl -e "if (-w qq{.}) {print qq{writable\n}} else {print
>> qq{Not writea
>> ble\n}}"
>> Not writeable
>>
>> C:\Users>cd Rob
>>
>> C:\Users\Rob>perl -e "if (-w qq{.}) {print qq{writable\n}} else {print
>> qq{Not wr
>> iteable\n}}"
>> writable
>>
>> C:\Users\Rob>cd Desktop
>>
>> C:\Users\Rob\Desktop>perl -e "if (-w qq{.}) {print qq{writable\n}}
>> else {print q
>> q{Not writeable\n}}"
>> Not writeable
>>
>> C:\Users\Rob\Desktop>mkdir Test
>>
>> C:\Users\Rob\Desktop>cd Test
>>
>> C:\Users\Rob\Desktop\Test>perl -e "if (-w qq{.}) {print
>> qq{writable\n}} else {pr
>> int qq{Not writeable\n}}"
>> writable
>>
>> C:\Users\Rob\Desktop\Test>
>> ---------------------------------------------------
>>
>> Sorry, I don't know why the -w test should determine that your
>> "Test_ooDoc" directory is "Not writable".
>>
>> I think there will be people here who can provide a good explanation
>> and sound advice .... if not try the perl-win32-users mailing list
>> (hosted by ActiveState) or Perlmonks.
>>
>> Cheers,
>> Rob
>>
>>
>
> I created another folder on the Desktop in the same way as the original
> (right click new folder). This one gives 'writeable'.
>
> I noticed that in your tests Users was not writable which is correct,
> but that your Desktop wasn't either which is not. So you are seeing the
> same symptom (some folders that should test as writable failing the
> test). This is a bug either in Vista or perl as far as I can see.
>
Even weirder: (based in limited testing) a folder is seen as writable
when created but becomes seen as unwritable if a shortcut to an
executable is created in it (or copied into it). I had a shortcut to
cmd.exe in the original folder to speed up opening a command window
pointing to the right folder. Removing the shortcut does not change the
status of the test back however.
------------------------------
Date: 03 Aug 2007 13:23:34 +0200
From: Lars Haugseth <njus@larshaugseth.com>
Subject: Re: How do you continue in a for loop?
Message-Id: <m1odhorhe1.fsf@vader.eiendomsnett.no>
* Lawrence Statton <yankeeinexile@gmail.com> wrote:
>
> "Jürgen Exner" <jurgenex@hotmail.com> writes:
> >
> > For exceptional circumstances I actually agree. It doesn't do well to
> > clutter the main flow of your code with exceptions that occur once in a
> > million.
> >
>
> Yeah -- I like your bridesmaid code better, too ... I'm still trying
> to think of a good example before breakfast. I need caffeine and
> sugar and lipids to write ...
I prefer the 'next' method when there are several conditions that could
cause a list item to be skipped (without generating an exception of any
kind):
for my $item (@list) {
next if ($item->{'Foo'} < 0);
next if (!defined $item->{'Bar'});
next if ($item->{'Baz'} eq 'IGNORE');
<do stuff with $item>
}
I like the above better than the following:
for my $item (@list) {
if ($item->{'Foo'} >= 0 &&
defined $item->{'Bar'} &&
$item->{'Baz'} ne 'IGNORE')
{
<do stuff with $item>
}
}
..especially when the conditionals are complex and/or hard to read,
and there are many of them.
There's also the added bonus of getting one less level of indentation.
In addition, it makes it pretty clear up front that these are special
cases and not the norm.
--
Lars Haugseth
"If anyone disagrees with anything I say, I am quite prepared not only to
retract it, but also to deny under oath that I ever said it." -Tom Lehrer
------------------------------
Date: Fri, 03 Aug 2007 10:33:01 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: I finally got a round tuit. (My first JAPH)
Message-Id: <slrnfb54ll.76i.tadmc@tadmc30.sbcglobal.net>
usenet@DavidFilmer.com <usenet@DavidFilmer.com> wrote:
> On Aug 2, 4:30 pm, Matt Madrid <admiral...@gmail.com> wrote:
>> Yeah, I though about omitting it altogether. I've seen some with
>> and without, but not many with a .
>
> To me ',' suggests list context. Surely this is a scalar
> expression :)
To me "another" suggest more than one, ie. list context.
:-)
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Fri, 03 Aug 2007 13:17:21 +0100
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: Object creation failure in perl
Message-Id: <13b676ijodfos67@corp.supernews.com>
Mark Clements wrote:
> Paul Lalli wrote:
>> On Aug 2, 9:21 am, ramesh.thangam...@gmail.com wrote:
>>> The thing here is the code is not failing always.
>>
>> That is not an important "thing". It is failing. Therefore, you did
>> something wrong.
>>
>>> I am using a cron wrapper script
>>
>> Also irrelevant.
> Notwithstanding the remainder of this post, the fact that something runs
> from cron can be relevant, since a process running from cron tends to
> have very few environment variables set by default and the user's shell
> startup script(s) isn't run.
Also cron may run as a different user. Clearly (?!)
the test should be run in same way as it is run under cron.
BugBear
------------------------------
Date: 3 Aug 2007 11:55:28 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Prototypes/Parameters to a Function/Sub-Routine
Message-Id: <5hgjdgF3ka8ruU1@mid.dfncis.de>
O. Olson <olson_ord@yahoo.it> wrote in comp.lang.perl.misc:
> Thanks Paul for your detailed discussion.
>
> On Aug 1, 6:49 pm, Paul Lalli <mri...@gmail.com> wrote:
> > What part of perlsub gave you the idea that was valid syntax?
> >
>
> No, I did not mean to say that I got this idea from perlsub - just
> that I wanted to do something like this - but this was not available
> in Perlsub. Anyway now I got the idea.
>
> > UNIVERSAL::isa($obj, "MyClass") or
> > croak "Argument to printObject is not a MyClass";
>
>
> I think this is what I wanted i.e. a way to check if an object is of a
> certain class.
If you know that $obj *is* an object, that's better written as
$obj->isa( 'MyClass');
Anno
------------------------------
Date: 3 Aug 2007 12:03:44 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Prototypes/Parameters to a Function/Sub-Routine
Message-Id: <5hgjt0F3ka8ruU2@mid.dfncis.de>
O. Olson <olson_ord@yahoo.it> wrote in comp.lang.perl.misc:
> On Aug 2, 1:50 pm, anno4...@radom.zrz.tu-berlin.de wrote:
> >
> > It is usually an indication of a design error if a method has to
> > care about the class an object comes from. If an object *can* invoke
> > a method (through inheritance, for instance) the method should be able
> > to handle it.
> >
> > Anno
>
>
> Thanks Anno.
> Consider if I have to compare two objects the same class. Something
> like:
>
> $obj1->diff($obj2)
>
> Where both $obj1 and $obj2 belong to the same class and the function
> diff() calculates the difference between them.
>
> In this case diff() needs to be able to ensure that the object passed
> as a parameter is of the same common class to be able to calculate the
> difference.
Not necessarily. A user could present $obj2 coming from a subclass,
in which case the test may fail, depending how it it done.
In a purely OO design, the diff method would use accessor methods of
the common class to compare values, not rely on a particular structure
of the objects.
Anno
------------------------------
Date: 03 Aug 2007 11:03:54 GMT
From: xhoster@gmail.com
Subject: Re: SOAP::Lite "service" examples
Message-Id: <20070803070354.681$pz@newsreader.com>
"John" <john1949@yahoo.com> wrote:
> <xhoster@gmail.com> wrote in message
> news:20070802215906.104$gS@newsreader.com...
> > I'm having trouble getting SOAP::Lite "service" method to work
> > properly. All of the examples I've seen point to wsdl's that are either
> > not found or just give no response.
> >
> > http://www.xmethods.net/sd/StockQuoteService.wsdl
> > http://svc.perl.org/Svc.wsdl
> >
> > Does anyone have a working example of how to make a call with
> > SOAP::Lite service which uses a working, publicly available SOAP
> > server?
> >
> > Also, I haven't been impressed with my experience with SOAP::Lite.
> > When I try to use it on our internal wsdls I get inscrutable errors,
> > where other language's SOAP support seems to work fine. Is there
> > something else designed to make SOAP easy to use that I might want to
> > try? (SOAP::WSDL uses SOAP::Lite under the hood, so I suspect it will
> > have the same problem.
> > It refuses to install with cpan under a non-privileged user, so I
> > haven't yet tested it directly. Trying to fix that will be the next
> > step, unless I
> > get good suggestions here.)
> >
> > Thanks,
> >
> > Xho
> >
> > --
> > -------------------- http://NewsReader.Com/ --------------------
> > Usenet Newsgroup Service $9.95/Month 30GB
>
> Hi
>
> I have been down this road before.
>
> Can you show us what you have already written?
I'm just using the client side, and unfortunately I don't think that
showing you that will do much good without also providing the whole
server side stuff, wsdl (which I have access to but would need to
go through obstructionist lawyers to show you) plus the implementation
(which I don't even have access to, or know what language it is in). Alas,
that is why I was hoping for an example using a publicly accessible
server--that way the client stuff would be meaningful to you, as we would
be using the same server.
Anyway, what I do is:
#!/usr/bin/perl
use strict;
use warnings;
use SOAP::Lite service =>
'http://bioinf-dev07/services/foobaloo.asmx?wsdl';
print HelloWorldSimple();
__END__
Can't call method "name" without a package or object reference at
/tools/GNU/perl/5.8.7_64/lib/site_perl/5.8.7/SOAP/Lite.pm line 3005.
BEGIN failed--compilation aborted at soap.pl line 5.
I have SOAP::Lite version:
# $Id: Lite.pm,v 1.43 2006/08/16 14:49:34 byrnereese Exp $
Isolating around the problem, starting at line 3003:
foreach (@{$services->{$service}{parameters}}) {
# next unless $_;
$self->{'_stub'} .= " SOAP::Data->new(name => '".$_->name."',
type => '".$_->type."', attr => {";
So the commenting out of "next unless $_" allows truly empty $_ to reach
the following line, triggering the error. However, if I comment it back
in, then everything gets skipped, apparently because $_ is an object which
seems to have overloaded operations which cause it to evaluate as false in
this (stringification?) context. I changed the line to execute the "next"
on only the values of $_ which are true empty strings, rather than objects
with overloaded operations:
next if not ref $_ and not $_;
And that solves that particular error, but now nothing is printed in the
final line of my script. (In python and C# against the same WSDL/server,
HelloWorldSimple() does return a meaningful string)
Anyway, I will work on making a simplified WSDL and a Server to serve it,
that I can post both of.
Thanks,
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Fri, 3 Aug 2007 14:40:24 +0200
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: Stripping some HTML code, while leaving others
Message-Id: <f8v7o3$1d3k$1@ns.felk.cvut.cz>
Jason wrote:
> This is really only a problem (so far) when someone copies an entire
> article from a website. I had this posted today:
>
> <H1 class=headline> # not OK
> <FONT face=Arial>Investigators Search for Missing Cary Boy</FONT> # OK
> </H1> # not OK
> <br>
> <DIV style="DISPLAY: none"> # not OK
> <br>
> <P class=byline> # <P> would be OK, but not class=byline
>
I solved similar task few month ago and here is my solution, maybe can help
you.
I can allow:
<b></b>
<font ...></font>
<p></p>
I can disallow all tags from allowed where "class=" is used and disallow all
other tags.
The html source is in $content variable.
# delete all tags with class=
$content =~s/<.+?class=.+?>//sg;
my $lt=chr(1);
my $gt=chr(2);
# replace "<" with chr(1) and ">" with chr(2) for all <b> and <p>
$content =~s/<(\/{0,1})(b|p)>)/$lt$1$2$gt/sg;
# replace "<" with chr(1) and ">" with chr(2) for all <font...>
$content =~s/<(\/{0,1})(font.*?)>)/$lt$1$2$gt/sg;
# delete all other html tags
$content =~ s/<.+?>//sg;
# replace back chr(1) with "<"
$content =~s/$lt/</sg;
# replace back chr(2) with ">"
$content =~s/$gt/>/sg;
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
------------------------------
Date: Fri, 03 Aug 2007 08:00:37 -0400
From: "Mr. Shawn H. Corey" <shawnhcorey@magma.ca>
Subject: Re: Windows based perl editor?
Message-Id: <46B318E5.9090205@magma.ca>
A. Sinan Unur wrote:
> Mr. Corey: I am not sure why this needed to be posted three times.
I did not post three times; the internet did it for me.
The internet is a complete network of computers talking to each other. When a message is sent, it is sent through multiple pathways. If the sending computer does not get a receipt before it times out, the message is re-sent. Normally, there is a unique ID attached to each message but sometimes this gets lost.
Seeing a message appear multiple times occurs 2 or 3 times a year per newsgroup. If you don't like it, don't read the newsgroups.
--
Just my 0.00000002 million dollars worth,
Shawn
"For the things we have to learn before we can do them, we learn by doing them."
Aristotle
------------------------------
Date: Fri, 03 Aug 2007 08:00:56 -0400
From: "Mr. Shawn H. Corey" <shawnhcorey@magma.ca>
Subject: Re: Windows based perl editor?
Message-Id: <33c81$46b3196b$401aaa70$26617@PRIMUS.CA>
A. Sinan Unur wrote:
> Mr. Corey: I am not sure why this needed to be posted three times.
I did not post three times; the internet did it for me.
The internet is a complete network of computers talking to each other. When a message is sent, it is sent through multiple pathways. If the sending computer does not get a receipt before it times out, the message is re-sent. Normally, there is a unique ID attached to each message but sometimes this gets lost.
Seeing a message appear multiple times occurs 2 or 3 times a year per newsgroup. If you don't like it, don't read the newsgroups.
--
Just my 0.00000002 million dollars worth,
Shawn
"For the things we have to learn before we can do them, we learn by doing them."
Aristotle
------------------------------
Date: 3 Aug 2007 12:13:05 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Windows based perl editor?
Message-Id: <5hgkehF3ka8ruU3@mid.dfncis.de>
Mr. Shawn H. Corey <shawnhcorey@magma.ca> wrote in comp.lang.perl.misc:
> A. Sinan Unur wrote:
> > Mr. Corey: I am not sure why this needed to be posted three times.
>
> I did not post three times; the internet did it for me.
>
> The internet is a complete network of computers talking to each other.
> When a message is sent, it is sent through multiple pathways. If the
> sending computer does not get a receipt before it times out, the message
> is re-sent.
"The internet"? No way. What news reader are you using? (Though, I
haven't heard of a news reader that does that.)
> Seeing a message appear multiple times occurs 2 or 3 times a year per
> newsgroup. If you don't like it, don't read the newsgroups.
It happened again. You exceeded your quota.
Anno
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V11 Issue 716
**************************************