[29165] in Perl-Users-Digest
Perl-Users Digest, Issue: 409 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 6 06:10:02 2007
Date: Sun, 6 May 2007 03:09:06 -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 Sun, 6 May 2007 Volume: 11 Number: 409
Today's topics:
Re: ´~~~ Free Flash Games ~~~ . <IzbaviteljMAKNIOVO@hotmail.com>
Re: 2 array problem anno4000@radom.zrz.tu-berlin.de
=?iso-8859-1?q?Re:_=B4~~~_Free_Flash_Games_~~~_=2E?= <chris@cupolagallery.com>
Re: eval problem! <uri@stemsystems.com>
Re: eval problem! <jaford@watford53.freeserve.co.uk>
Re: Link Matching <spamtrap@dot-app.org>
Re: Link Matching <stoupa@practisoft.cz>
Re: Link Matching <tadmc@augustmail.com>
Re: Link Matching <thepoet_nospam@arcor.de>
need a quick script <bob@schmo.com>
Re: need a quick script <noreply@gunnar.cc>
new CPAN modules on Sun May 6 2007 (Randal Schwartz)
Re: Select from drop down menu multipel times in the sa <bik.mido@tiscalinet.it>
Re: Select from drop down menu multipel times in the sa <nikos1337@gmail.com>
Re: Select from drop down menu multipel times in the sa <bik.mido@tiscalinet.it>
Re: Select from drop down menu multipel times in the sa <nikos1337@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 6 May 2007 06:17:30 +0200
From: "Zli_Zec" <IzbaviteljMAKNIOVO@hotmail.com>
Subject: Re: ´~~~ Free Flash Games ~~~ .
Message-Id: <f1jkt1$tm4$1@news1.carnet.hr>
craiglg wrote:
> On May 5, 7:36 am, Leisure....@gmail.com wrote:
>> http://arcadeplayers.com/play-181-Security.html- Free Flash Games
>> have fun galore.
> "Free Flash Games"!! - Get a big brown coat, go to your nearest
> park.........
Dobro di je Rudar ?!?
------------------------------
Date: 6 May 2007 02:48:36 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: 2 array problem
Message-Id: <5a4u04F2m9n3rU1@mid.dfncis.de>
Abigail <abigail@abigail.be> wrote in comp.lang.perl.misc:
> Michele Dondi (bik.mido@tiscalinet.it) wrote on MMMMCMXCIV September
> MCMXCIII in <URL:news:5mnm33h3207b0e0eptvsrtlemj326alaf3@4ax.com>:
> <> On 04 May 2007 15:07:18 GMT, Abigail <abigail@abigail.be> wrote:
> <>
> <> >That '@a' doesn't warn in your example has little to do with @a being
> <> >special. It just has to do with the fact that *a exists. Which exists
> <>
> <> That's surely what Anno meant. As you surely know full well.
>
>
> Then I don't get it. @a behaves the same as @c.
True, but the specialness of $a (the package variable) makes it easier
to use it inadvertently. That way @c is slightly safer than @a.
Anno
------------------------------
Date: 6 May 2007 02:29:45 -0700
From: Jumbo <chris@cupolagallery.com>
Subject: =?iso-8859-1?q?Re:_=B4~~~_Free_Flash_Games_~~~_=2E?=
Message-Id: <1178443785.918699.10690@y80g2000hsf.googlegroups.com>
On May 6, 5:17 am, "Zli_Zec" <IzbaviteljMAKNI...@hotmail.com> wrote:
> craiglg wrote:
> > On May 5, 7:36 am, Leisure....@gmail.com wrote:
> >>http://arcadeplayers.com/play-181-Security.html-Free Flash Games
> >> have fun galore.
> > "Free Flash Games"!! - Get a big brown coat, go to your nearest
> > park.........
>
> Dobro di je Rudar ?!?
I've got all his albums.
------------------------------
Date: Sat, 05 May 2007 14:21:41 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: eval problem!
Message-Id: <x73b2b872i.fsf@mail.sysarch.com>
>>>>> "JF" == Jim Ford <jaford@watford53.freeserve.co.uk> writes:
JF> When I get back to work (where I'm running the script) I'll pick up the
JF> scripts and post the relevant parts.
you are missing the point. try to create a small COMPLETE script that
illustrates your problem. most of the time snippets aren't good enough
as critical parts are omitted. we see snippets with no data, snippets
that assumes too much that is unseen, etc.
a complete script can be downloaded and run so we can see the same
bugs/errors as the poster claims. then it is also easier for someone to
debug it and help you. there are times when a couple of lines if code is
enough as when it is already working but you want a better way to do it.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Sat, 05 May 2007 18:23:16 GMT
From: Jim Ford <jaford@watford53.freeserve.co.uk>
Subject: Re: eval problem!
Message-Id: <oY3%h.6481$H4.1535@newsfe2-gui.ntli.net>
Uri Guttman wrote:
>>>>>> "JF" == Jim Ford <jaford@watford53.freeserve.co.uk> writes:
>
>
> JF> When I get back to work (where I'm running the script) I'll pick up the
> JF> scripts and post the relevant parts.
>
> you are missing the point. try to create a small COMPLETE script that
> illustrates your problem. most of the time snippets aren't good enough
> as critical parts are omitted. we see snippets with no data, snippets
> that assumes too much that is unseen, etc.
>
> a complete script can be downloaded and run so we can see the same
> bugs/errors as the poster claims. then it is also easier for someone to
> debug it and help you. there are times when a couple of lines if code is
> enough as when it is already working but you want a better way to do it.
>
Got it - thanks Uri!
Jim
------------------------------
Date: Sat, 05 May 2007 16:27:53 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Link Matching
Message-Id: <m2odkzxbg6.fsf@local.wv-www.com>
Michele Dondi <bik.mido@tiscalinet.it> writes:
> On Sat, 05 May 2007 05:30:51 GMT, "John W. Krahn"
> <someone@example.com> wrote:
>
>>> Regexes are the most painful way possible to parse HTML. I'd rather
>>> shave with a cheese grater.
>>
>>Will you post that on YouTube? :-)
>
> And if you do, then please advertise here.
Will do!
I'm actually thinking now that it wouldn't be too difficult to hide an
electric razor inside an old-style "box" grater... :-)
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: Sun, 6 May 2007 00:28:16 +0200
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: Link Matching
Message-Id: <f1j2df$13gb$1@ns.felk.cvut.cz>
Tad McClellan wrote:
> Petr Vileta <stoupa@practisoft.cz> wrote:
>
>> Assume that variable $page contain html code.
>
>
> OK.
>
>
> --------------------------
> #!/usr/bin/perl
> use warnings;
> use strict;
>
> my $page = '<html></html>';
>
> while ($page =~ m/<a\s+.*?href=.+?>/sig)
> {
> $page =~ s/^.+?<a\s+.*?href=.+?>(.+?)<\/a>(.+)$/$2/si;
> print "$1\n";
> }
> --------------------------
>
>
> That link-finding program does exactly what it is supposed to do.
>
> If you had some other data in mind, then you need to share
> that with us, we are not mind readers.
Sorry, English is not my main language and I don't understand ;-)
In original message Taras_96 wrote:
>> I need to write a regex that parses some HTML text to output all links
>> whose text (the text that appears on the screen) a given expression.
The code above (you completed) work as expected. No <a href=...>...</a> in
the code then print nothing :-) But if I change it to this:
--------------------------
#!/usr/bin/perl
use warnings;
use strict;
my $page = "<html><body>\nClick to this <a
href=\"http://www.google.com\">link</a>\n</body></html>";
while ($page =~ m/<a\s+.*?href=.+?>/sig)
{
$page =~ s/^.+?<a\s+.*?href=.+?>(.+?)<\/a>(.+)$/$2/si;
print "$1\n";
}
--------------------------
then print "link" as Taras_96 need.
Where is the problem?
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
------------------------------
Date: Sat, 5 May 2007 19:38:04 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Link Matching
Message-Id: <slrnf3q8rc.mle.tadmc@tadmc30.august.net>
Petr Vileta <stoupa@practisoft.cz> wrote:
> --------------------------
> #!/usr/bin/perl
> use warnings;
> use strict;
>
> my $page = "<html><body>\nClick to this <a
> href=\"http://www.google.com\">link</a>\n</body></html>";
>
> while ($page =~ m/<a\s+.*?href=.+?>/sig)
> {
> $page =~ s/^.+?<a\s+.*?href=.+?>(.+?)<\/a>(.+)$/$2/si;
> print "$1\n";
> }
> --------------------------
> then print "link" as Taras_96 need.
> Where is the problem?
-------------------------
#!/usr/bin/perl
use warnings;
use strict;
my $page = '<html><body>\nClick to this
<a href = "http://www.google.com">link2</a>
<a href="http://www.google.com">link3</a >
<a href=\"http://www.google.com\">link</a>
<!--
<a href="http://www.google.com">Not A Link!</a>
-->
<a href="http://www.google.com" name="<<cool link!>>">link4</a>
<a name="href=stuff">No href here!</a>
</body></html>
';
while ($page =~ m/<a\s+.*?href=.+?>/sig)
{
$page =~ s/^.+?<a\s+.*?href=.+?>(.+?)<\/a>(.+)$/$2/si;
print "(($1))\n\n";
}
-------------------------
output:
((link3</a >
<a href=\"http://www.google.com\">link))
((Not A Link!))
((>">link4))
((No href here!))
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 06 May 2007 09:43:45 +0200
From: Christian Winter <thepoet_nospam@arcor.de>
Subject: Re: Link Matching
Message-Id: <463d8727$0$23138$9b4e6d93@newsspool1.arcor-online.net>
Taras_96 wrote:
> I need to write a regex that parses some HTML text to output all links
> whose text (the text that appears on the screen) a given expression.
>
> eg: findLinks(html,'(.*)o(.*)') called on the html code
>
> <a>one</a>
> <a>three</a>
> <a>two</a>
>
> Should return two matches, <a>one</a> and <a>two</a>
>
> I'm a bit new with regexs. At the moment I have:
>
> '/<a[^><]*href\s*=\s*[^>]*>'.$regex.'<\/a>/'
>
> (I'm only interested with tags that have a href attribute)
>
> which greedily matches the entire input string.
>
> How do I make the </a> match non greedy? I've read that (.*?)<\/a>
> makes the match non greedy, but this doesn't account for the form of
> the link text.
Other have already pointed out that a regex, though being a
quick means to do some text extraction, may not be the (sole) tool
of choice. I usually use HTML::TreeBuilder to do conditional link
extraction. It seems a bit more complex at first, but it is much
more powerful and respects rules of HTML syntax like comments or
random whitespace. I've ruthlessly nicked the example input from
Tad's example.
-------------------------------------------------------------------
#!/usr/bin/perl
use strict;
use warnings;
use HTML::TreeBuilder;
my $page = '<html><body>\nClick to this
<a href = "http://www.google.com">link2</a>
<a href="http://www.google.com">link3</a >
<a href=\"http://www.google.com\">link</a>
<!--
<a href="http://www.google.com">Not A Link!</a>
-->
<a href="http://www.google.com" name="<<cool link!>>">link4</a>
<a name="href=stuff">No href here!</a>
</body></html>
';
my $regex = qr/(.*)link\d(.*)/;
my $root = HTML::TreeBuilder->new_from_content($page);
foreach my $link (
$root->look_down(
'_tag',
'a',
sub {
defined( $_[0]->attr('href') )
&&
$_[0]->as_text() =~ $regex
}
)
) {
print "Found: ",$link->as_text(),"(",$link->attr('href'),")",$/;
}
-------------------------------------------------------------------
For elaborate documentation see "perldoc HTML::TreeBuilder",
"perldoc HTML::Tree::Scanning" and "HTML::Element".
-Chris
------------------------------
Date: Sun, 06 May 2007 02:27:27 GMT
From: bob schmo <bob@schmo.com>
Subject: need a quick script
Message-Id: <j2b%h.215$y_7.76@newssvr27.news.prodigy.net>
Does anyone have a script lying around that will take firstname lastname
and create first initial lastname: Bob Schmo --> BSchmo
TIA.
Bob
------------------------------
Date: Sun, 06 May 2007 10:49:03 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: need a quick script
Message-Id: <5a5j8iF2mpsu2U1@mid.individual.net>
bob schmo wrote:
> Does anyone have a script lying around that will take firstname lastname
> and create first initial lastname: Bob Schmo --> BSchmo
Probably not. That task is so easy to accomplish that it's unlikely that
somebody would bother to save a script. You'd better write some code.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sun, 6 May 2007 04:42:09 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sun May 6 2007
Message-Id: <JHLrq9.8GH@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
AI-Prolog-0.739
http://search.cpan.org/~jjore/AI-Prolog-0.739/
Perl extension for logic programming.
----
Apache-SWIT-0.25
http://search.cpan.org/~bosu/Apache-SWIT-0.25/
mod_perl based application server with integrated testing.
----
App-Addex-0.003
http://search.cpan.org/~rjbs/App-Addex-0.003/
generate mail tool configuration from an address book
----
CPAN-Test-Others-0.01
http://search.cpan.org/~szabgab/CPAN-Test-Others-0.01/
Include tests for other modules on CPAN
----
Catalyst-Plugin-CRUD-0.16
http://search.cpan.org/~bayside/Catalyst-Plugin-CRUD-0.16/
CRUD (create/read/update/delete) Plugin for Catalyst
----
Class-Accessor-Grouped-0.04000
http://search.cpan.org/~claco/Class-Accessor-Grouped-0.04000/
Lets you build groups of accessors
----
DBIx-Class-UUIDColumns-0.01001
http://search.cpan.org/~claco/DBIx-Class-UUIDColumns-0.01001/
Implicit uuid columns
----
DBIx-Class-Validation-0.01002
http://search.cpan.org/~claco/DBIx-Class-Validation-0.01002/
Validate all data before submitting to your database.
----
DBIx-CopyRecord-1.0
http://search.cpan.org/~jackb/DBIx-CopyRecord-1.0/
copying record sets within a database while maintaining referential integrity.
----
DateTime-Format-Natural-0.31
http://search.cpan.org/~schubiger/DateTime-Format-Natural-0.31/
Create machine readable date/time with natural parsing logic
----
Graph-Easy-0.55
http://search.cpan.org/~tels/Graph-Easy-0.55/
Render graphs as ASCII, HTML, SVG or via Graphviz
----
Gungho-0.05
http://search.cpan.org/~dmaki/Gungho-0.05/
Yet Another High Performance Web Crawler Framework
----
Lemonldap-NG-Manager-0.64
http://search.cpan.org/~guimard/Lemonldap-NG-Manager-0.64/
Perl extension for managing Lemonldap::NG Web-SSO system.
----
Lingua-RU-Sklon-0.01
http://search.cpan.org/~lexus/Lingua-RU-Sklon-0.01/
helps declensing russian word
----
Math-BigInt-1.84
http://search.cpan.org/~tels/Math-BigInt-1.84/
Arbitrary size integer/float math package
----
Math-BigInt-1.85
http://search.cpan.org/~tels/Math-BigInt-1.85/
Arbitrary size integer/float math package
----
Math-BigInt-Constant-1.08
http://search.cpan.org/~tels/Math-BigInt-Constant-1.08/
Arbitrary sized constant integers
----
Mediawiki-POD-0.06
http://search.cpan.org/~tels/Mediawiki-POD-0.06/
convert POD to HTML suitable for a MediaWiki wiki
----
Net-FPing-0.02
http://search.cpan.org/~mlehmann/Net-FPing-0.02/
quickly ping a large number of hosts
----
Net-Google-Calendar-Server-0.1
http://search.cpan.org/~simonw/Net-Google-Calendar-Server-0.1/
pretend to be like Google's Calendar
----
Perl6-Say-0.08
http://search.cpan.org/~jkeenan/Perl6-Say-0.08/
print -- but no newline needed
----
Spreadsheet-ParseExcel-0.32
http://search.cpan.org/~szabgab/Spreadsheet-ParseExcel-0.32/
Get information from Excel file
----
String-Ediff-0.09
http://search.cpan.org/~boxzou/String-Ediff-0.09/
Produce common sub-string indices for two strings
----
Text-VisualWidth-0.01
http://search.cpan.org/~nanzou/Text-VisualWidth-0.01/
Perl extension for trimming text by the number of the columns of terminals and mobile phones.
----
WWW-Facebook-API-v0.0.8
http://search.cpan.org/~unobe/WWW-Facebook-API-v0.0.8/
Facebook API implementation
----
WWW-Slides-0.0.7
http://search.cpan.org/~polettix/WWW-Slides-0.0.7/
serve presentations on the Web
----
Want-0.14
http://search.cpan.org/~robin/Want-0.14/
A generalisation of wantarray
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Sat, 05 May 2007 20:26:47 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Select from drop down menu multipel times in the same form
Message-Id: <f0gp33heu5je5biv7if2lqm7dvfageuu4l@4ax.com>
On 5 May 2007 08:34:32 -0700, Nikos <nikos1337@gmail.com> wrote:
>ps1. I edited it and wrote all the greek words to english ones. Also
>corrected spelling errors.
WELL DONE!
>ps2. Asked in PM as well but didnt got an answer.
WELL DONE! (Finally!)
Since nobody here is guaranteed to know what "PM" is, you may want to
write "PerlMonks", and/or -most importantly- include a link, e.g.:
http://perlmonks.org/?node_id=613723
Otherwise how is one supposed to know?!?
BTW: you *did* get answers. Notwithstanding the fact that the traffic
is limited both here and there during the weekends. Perhaps you didn't
get them *soon*. But who does? Have patience!
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: 5 May 2007 11:37:35 -0700
From: Nikos <nikos1337@gmail.com>
Subject: Re: Select from drop down menu multipel times in the same form
Message-Id: <1178390255.120935.193580@n59g2000hsh.googlegroups.com>
On May 5, 9:26 pm, Michele Dondi <bik.m...@tiscalinet.it> wrote:
> BTW: you *did* get answers. Notwithstanding the fact that the traffic
> is limited both here and there during the weekends. Perhaps you didn't
> get them *soon*. But who does? Have patience!
Thank you for allt he good words :)
I will be patient then, its just that iam so excited trying to get
this new order perl cgi script done that i cant wait for answers :)
------------------------------
Date: Sat, 05 May 2007 21:23:57 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Select from drop down menu multipel times in the same form
Message-Id: <icmp33ht68921u8iqkpa26mijmqmo8g3o1@4ax.com>
On 5 May 2007 11:37:35 -0700, Nikos <nikos1337@gmail.com> wrote:
>> BTW: you *did* get answers. Notwithstanding the fact that the traffic
>> is limited both here and there during the weekends. Perhaps you didn't
>> get them *soon*. But who does? Have patience!
>
>Thank you for allt he good words :)
>
>I will be patient then, its just that iam so excited trying to get
Thank you for understanding rather than complaining. And sorry if I
may have occasionally been overly harsh.
>this new order perl cgi script done that i cant wait for answers :)
New order? ;-)
Well, good luck with your project anyway.
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: 5 May 2007 13:01:46 -0700
From: Nikos <nikos1337@gmail.com>
Subject: Re: Select from drop down menu multipel times in the same form
Message-Id: <1178395306.724426.89260@l77g2000hsb.googlegroups.com>
On May 5, 10:23 pm, Michele Dondi <bik.m...@tiscalinet.it> wrote:
> Thank you for understanding rather than complaining. And sorry if I
> may have occasionally been overly harsh.
My apologies too, for not been carefull enough before posting, you are
an ok person.
> >this new order perl cgi script done that i cant wait for answers :)
> New order? ;-)
> Well, good luck with your project anyway.;t
Sounds like a dark mysterious world wide New Order Plan trying to take
over the world, doesnt it?!
Thanks :)
------------------------------
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 409
**************************************