[30843] in Perl-Users-Digest
Perl-Users Digest, Issue: 2088 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 31 03:09:43 2008
Date: Wed, 31 Dec 2008 00:09:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest           Wed, 31 Dec 2008     Volume: 11 Number: 2088
Today's topics:
    Re: fail running an external C program into a Perl CGI  yairl@savion.huji.ac.il
    Re: hash table usage questions <tadmc@seesig.invalid>
    Re: ISINNET Function (or similar) <someone@example.com>
    Re: ISINNET Function (or similar) <hansmu@xs4all.nl>
        new CPAN modules on Wed Dec 31 2008 (Randal Schwartz)
    Re: searching for franken <george@example.invalid>
    Re: searching for franken <wahab-mail@gmx.de>
    Re: searching for franken <frank@example.invalid>
    Re: searching for franken <tadmc@seesig.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 30 Dec 2008 23:58:30 -0800 (PST)
From: yairl@savion.huji.ac.il
Subject: Re: fail running an external C program into a Perl CGI script
Message-Id: <911fe1ab-a8ce-4170-a89b-e64ba28c9f2c@r27g2000vbp.googlegroups.com>
On Dec 30, 8:53=A0pm, Tim Greer <t...@burlyhost.com> wrote:
> ya...@savion.huji.ac.il wrote:
> > hi,
>
> > I 'm trying to execute a small C program into the Perl CGI working
> > with apache server and it fail . I used `cmd` , sytem, qx( ) , open
> > orders every thing it doens't work when it run as CGI. The script
> > works fine if it runs as shell script by hand or cron but the forked
> > program send "segmentation fault" and it ended with status 35584
> > (ACCESS VIOLATION) when it runs into CGI mode under apache server or
> > Sun One webserver. This happened with some C small programs they use
> > socket to connect some resources outside and return some value to
> > evaluate. These programs started to fail since perl 5.6 under linux
> > SuSe 9 ,10 and solaris 8 and 9. The regular OS orders like date, cat ,
> > cal work fine, I tested it. I don't understand why is happened, what's
> > wrong they are common C progrmas using the standard C library like
> > socket lib. Someone know anything about this bug?
>
> Are you using a script or program that's suid/sgid, or running SuEXEC
> for CGI? =A0This doesn't sound like a Perl issue, as others have said.
> --
> Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
> Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
> and Custom Hosting. =A024/7 support, 30 day guarantee, secure servers.
> Industry's most experienced staff! -- Web Hosting With Muscle!- Hide quot=
ed text -
>
> - Show quoted text -
first thanks to everybody that answered.
It's a common CGI script running into cgi-bin. I don't think it's a
permition problem because i can execute shell orders. It's something
into these C programs that it doesn't work correctly in the webserver
enviroment.
I read some post in this forum talking about the output buffering
problem, it sound me that may be the point. I'm going to test the
Expect module and check if it solve the problem. Anyway if the Expect
module doesn't work I decided to rewrite this program in perl as perl
module. I did it before with others small C programs that stoped to
work.
------------------------------
Date: Tue, 30 Dec 2008 17:15:12 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: hash table usage questions
Message-Id: <slrngllas0.kj7.tadmc@tadmc30.sbcglobal.net>
freesoft12@gmail.com <freesoft12@gmail.com> wrote:
[ snip: sln has gone off his meds again ]
> Your asinine answers to my questions and to other people's posts to
> this newsgroup (i checked) spoils the great work done by others in
> teaching Perl to beginners.
Simply ignore the jackoffs and pay attention to the others.
> I am going to recommend to this group's moderator that they cancel
> your membership.
Neither of those are possible, as there are no moderators for
this newsgroup, and there is no concept of "membership".
That is how most Usenet newgroups operate.
-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Tue, 30 Dec 2008 16:15:42 -0800
From: "John W. Krahn" <someone@example.com>
Subject: Re: ISINNET Function (or similar)
Message-Id: <NQy6l.12400$gY5.8898@newsfe21.iad>
Antgoodlife wrote:
> New to perl and this community...Hi all...
> 
> I've done some javascript / proxy pac work and I was curious if perl
> has a built in (or if someone can point me to a module) that
> determines if an IP is in a specific network?  (Similar to proxy.pac
> isinnet function)
> 
> For example :
> 
> #!/usr/bin/perl -w
> # if ip 10.8.5.3 is in net 10.8.0.0 w/mask 255.255.0.0 return true
> $ipaddr = "10.8.5.3"
> print "$ipaddr is in the network!" if isinnet
> ($ipaddr,"10.8.0.0","255.255.0.0");
> 
> CIDR notation acceptance is a plus however not required for my
> question.
$ perl -le'
use Socket;
sub isinnet {
     my ( $ip_addr, $net, $mask ) = map inet_aton( $_ ), @_;
     return $net eq ( $ip_addr & $mask );
     }
my $ipaddr = "10.8.5.3";
print "$ipaddr is in the network!" if isinnet( $ipaddr, "10.8.0.0", 
"255.255.0.0" );
'
10.8.5.3 is in the network!
John
-- 
Those people who think they know everything are a great
annoyance to those of us who do.        -- Isaac Asimov
------------------------------
Date: Wed, 31 Dec 2008 01:35:54 +0100
From: Hans Mulder <hansmu@xs4all.nl>
Subject: Re: ISINNET Function (or similar)
Message-Id: <495abf82$0$189$e4fe514c@news.xs4all.nl>
Mirco Wahab wrote:
> Antgoodlife wrote:
>> !! Sorry... modified for the post too quickly w/out proper syntax... I
>> mean I get "THIS error"
>> C:\>TestInNet.pl
>> Useless use of a constant in void context at C:/Perl/site/lib/HTTP/
>> ProxyAutoConfig.pm line 367.
>> Undefined subroutine &main::isInNet called at C:\TestInNet.pl line 7.
>>
>> C:\>type TestInNet.pl
>> #!/usr/bin/perl -w
>> # if ip 10.16.5.3 is in net 10.16.0.0 w/mask 255.255.0.0 return true
>> use HTTP::ProxyAutoConfig;
>> $ipaddr = "10.16.5.3";
>>
>> if (isInNet($ipaddr,"10.16.0.0","255.255.0.0")) {
>> print "$ipaddr is in the network!";
>> }
> 
> I don't know what the module is supposed to do,
> but wouldn't a simple comparison of fields against
> the netmask:
> 
> 
>  ...
> 
>  my $net = '10.16.0.0';
>  my $mask = '255.255.0.0';
> 
>  my $ip = "10.16.5.3";
> 
>  if( isInNet($ip, $net, $mask) ) {
>     print 'true'
>  }
>  else {
>     print 'false'
>  }
> 
>  sub isInNet {
>     my @ip  = split /\./, $_[0]; # split ip into net fields
>     my @net = split /\./, $_[1]; # split network into fields
>     for( $_[2] =~ /255/g ) {     # iterate over '255' mask fields
>        return 0 if shift(@ip) ne shift(@net)  # bail if different
>     }
>     1
>  }
> 
>  ...
> 
> 
> 
> suffice? Of course, only for IPV4.
That worked in the early days when the only numbers allowed in a netmask
were 0 and 255.  In 1993 the rules changed.  Today netmasks can also 
contain 128, 192, 224, 240, 248, 252 and 254.
One way to check that a network contains an IP addres is to convert all
three numbers to binary.  If the bitwise "and" of the IP addres and the
netmask is equal to the network number, then the network contains the
address:
sub binary { return pack("C4", split(/\./, shift)); }
$ipaddr = "10.16.5.3";
if ((binary($ipaddr) & binary("255.255.0.0")) eq binary("10.16.0.0")) {
	print "$ipaddr is in the network!";
}
I can understand why the OP prefers to use a module.
Hope this helps,
-- HansM
------------------------------
Date: Wed, 31 Dec 2008 05:42:23 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Wed Dec 31 2008
Message-Id: <KCq7un.21vn@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.
Apache-SWIT-0.43
http://search.cpan.org/~bosu/Apache-SWIT-0.43/
mod_perl based application server with integrated testing. 
----
Apache2-Response-FileMerge-0.31
http://search.cpan.org/~wazzuteke/Apache2-Response-FileMerge-0.31/
Merge and include static client-side style and code 
----
BSD-Resource-1.2902
http://search.cpan.org/~jhi/BSD-Resource-1.2902/
BSD process resource limit and priority functions 
----
BibTeX-Parser-0.2
http://search.cpan.org/~gerhard/BibTeX-Parser-0.2/
A plain perl BibTeX parser 
----
Bio-Tools-CodonOptTable-0.02
http://search.cpan.org/~shardiwal/Bio-Tools-CodonOptTable-0.02/
A more elaborative way to check the codons quality 
----
Bio-Tools-CodonOptTable-0.03
http://search.cpan.org/~shardiwal/Bio-Tools-CodonOptTable-0.03/
A more elaborative way to check the codons quality 
----
CPAN-Site-0.24
http://search.cpan.org/~markov/CPAN-Site-0.24/
CPAN.pm subclass for adding site local modules 
----
CPAN-Testers-ParseReport-0.0.23
http://search.cpan.org/~andk/CPAN-Testers-ParseReport-0.0.23/
parse reports to www.cpantesters.org from various sources 
----
CatalystX-ListFramework-Builder-0.37
http://search.cpan.org/~oliver/CatalystX-ListFramework-Builder-0.37/
Instant AJAX web front-end for DBIx::Class, using Catalyst 
----
Directory-Transactional-0.01
http://search.cpan.org/~nuffin/Directory-Transactional-0.01/
----
File-Stat-Moose-0.04
http://search.cpan.org/~dexter/File-Stat-Moose-0.04/
Status info for a file - Moose-based 
----
File-Stat-Trigger-0.05
http://search.cpan.org/~akihito/File-Stat-Trigger-0.05/
The module to monitor the status of file. 
----
GPS-Point-0.11
http://search.cpan.org/~mrdvt/GPS-Point-0.11/
Provides an object interface for a GPS point. 
----
GPS-Point-Cluster-0.05
http://search.cpan.org/~mrdvt/GPS-Point-Cluster-0.05/
Groups GPS Points in to clusters 
----
GPS-Point-Filter-0.01
http://search.cpan.org/~mrdvt/GPS-Point-Filter-0.01/
Algorithm to filter extraneous GPS points 
----
Geo-OSM-Tiles-0.02
http://search.cpan.org/~rotkraut/Geo-OSM-Tiles-0.02/
Calculate tile numbers for OpenStreetMap 
----
HtmlUnit-0.02
http://search.cpan.org/~awwaiid/HtmlUnit-0.02/
Inline::Java based wrapper of the HtmlUnit library 
----
Ipernity-API-0.06-2
http://search.cpan.org/~wneessen/Ipernity-API-0.06-2/
Perl interface to the Ipernity API 
----
Kephra-0.4.1.2
http://search.cpan.org/~lichtkind/Kephra-0.4.1.2/
crossplatform, GUI-Texteditor along Perl alike Paradigms 
----
KiokuDB-0.17
http://search.cpan.org/~nuffin/KiokuDB-0.17/
Object Graph storage engine 
----
KiokuDB-Backend-Files-0.02_01
http://search.cpan.org/~nuffin/KiokuDB-Backend-Files-0.02_01/
One file per object backend 
----
Locale-Country-Multilingual-0.22
http://search.cpan.org/~graf/Locale-Country-Multilingual-0.22/
mapping ISO codes to localized country names 
----
Locale-Maketext-Lexicon-0.77
http://search.cpan.org/~drtech/Locale-Maketext-Lexicon-0.77/
Use other catalog formats in Maketext 
----
MediaWiki-Bot-2.0.0
http://search.cpan.org/~dcollins/MediaWiki-Bot-2.0.0/
a Wikipedia bot framework written in Perl 
----
MediaWiki-Bot-Plugin-CUP-0.2.0
http://search.cpan.org/~dcollins/MediaWiki-Bot-Plugin-CUP-0.2.0/
a plugin for MediaWiki::Bot which contains data retrieval tools for the 2009 WikiCup hosted on the English Wikipedia 
----
MediaWiki-Bot-Plugin-ImageTester-0.2.0
http://search.cpan.org/~dcollins/MediaWiki-Bot-Plugin-ImageTester-0.2.0/
a plugin for MediaWiki::Bot which contains image copyright checking and analysis for the english wikipedia 
----
MediaWiki-Bot-Plugin-ImageTester-0.2.1
http://search.cpan.org/~dcollins/MediaWiki-Bot-Plugin-ImageTester-0.2.1/
a plugin for MediaWiki::Bot which contains image copyright checking and analysis for the english wikipedia 
----
MooseX-GlobRef-Object-0.04
http://search.cpan.org/~dexter/MooseX-GlobRef-Object-0.04/
Store a Moose object in glob reference 
----
MooseX-Traits-Attribute-CascadeClear-0.02
http://search.cpan.org/~rsrchboy/MooseX-Traits-Attribute-CascadeClear-0.02/
Attribute trait to cascade clearer actions 
----
Nagios-Plugin-Beanstalk-0.01
http://search.cpan.org/~gbarr/Nagios-Plugin-Beanstalk-0.01/
Nagios plugin to observe Beanstalkd queue server. 
----
Net-Appliance-Phrasebook-1.8
http://search.cpan.org/~oliver/Net-Appliance-Phrasebook-1.8/
Network appliance command-line phrasebook 
----
Net-Appliance-Session-1.33
http://search.cpan.org/~oliver/Net-Appliance-Session-1.33/
Run command-line sessions to network appliances 
----
Net-Appliance-Session-1.34
http://search.cpan.org/~oliver/Net-Appliance-Session-1.34/
Run command-line sessions to network appliances 
----
Net-BitTorrent-0.046
http://search.cpan.org/~sanko/Net-BitTorrent-0.046/
BitTorrent peer-to-peer protocol class 
----
Net-DNS-0.64
http://search.cpan.org/~olaf/Net-DNS-0.64/
Perl interface to the DNS resolver 
----
Net-DNS-SEC-0.15
http://search.cpan.org/~olaf/Net-DNS-SEC-0.15/
DNSSEC extensions to Net::DNS 
----
Net-DNS-TestNS-1.10
http://search.cpan.org/~olaf/Net-DNS-TestNS-1.10/
Perl extension for simulating simple Nameservers 
----
Net-DNS-Zone-Parser-0.02
http://search.cpan.org/~olaf/Net-DNS-Zone-Parser-0.02/
A Zone Pre-Parser 
----
Net-Google-Spreadsheets-0.01
http://search.cpan.org/~danjou/Net-Google-Spreadsheets-0.01/
A Perl module for using Google Spreadsheets API. 
----
Number-Format-1.61
http://search.cpan.org/~wrw/Number-Format-1.61/
Perl extension for formatting numbers 
----
Number-Format-1.61a
http://search.cpan.org/~wrw/Number-Format-1.61a/
Perl extension for formatting numbers 
----
Padre-Plugin-HTMLExport-0.02
http://search.cpan.org/~azawawi/Padre-Plugin-HTMLExport-0.02/
export highlighted HTML in Padre 
----
Rose-HTMLx-Form-Related-0.14
http://search.cpan.org/~karman/Rose-HTMLx-Form-Related-0.14/
RHTMLO forms, living together 
----
Storable-AMF-0.39
http://search.cpan.org/~grian/Storable-AMF-0.39/
Perl extension for serialize/deserialize AMF0/AMF3 data 
----
Test-Smoke-1.37
http://search.cpan.org/~abeltje/Test-Smoke-1.37/
The Perl core test smoke suite 
----
Test-Unit-Lite-0.1101
http://search.cpan.org/~dexter/Test-Unit-Lite-0.1101/
Unit testing without external dependencies 
----
Test-WWW-Selenium-1.17
http://search.cpan.org/~lukec/Test-WWW-Selenium-1.17/
Test applications using Selenium Remote Control 
----
Time-HiRes-1.9717
http://search.cpan.org/~jhi/Time-HiRes-1.9717/
High resolution alarm, sleep, gettimeofday, interval timers 
----
Tk-Tree-JSON-0.01
http://search.cpan.org/~santos/Tk-Tree-JSON-0.01/
JSON tree widget 
----
WWW-Google-Time-0.0103
http://search.cpan.org/~zoffix/WWW-Google-Time-0.0103/
get time for various locations via Google 
----
WWW-HatenaStar-0.04
http://search.cpan.org/~woremacx/WWW-HatenaStar-0.04/
perl interface to Hatena::Star 
----
forks-0.28
http://search.cpan.org/~rybskej/forks-0.28/
drop-in replacement for Perl threads using fork() 
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/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
------------------------------
Date: Tue, 30 Dec 2008 17:36:23 -0700
From: George <george@example.invalid>
Subject: Re: searching for franken
Message-Id: <hcm89f4zkc8e$.sdj5vjyeqb68$.dlg@40tude.net>
On Tue, 30 Dec 2008 12:17:44 +0100, Mirco Wahab wrote:
[snipped and reordered, for thematic reasons]
> my hack on your problem:
> 
>   use strict;
>   use warnings;
>   use LWP::Simple;
> 
>   # load the complete content of the url in question
>   # via LWP::Simple::get(...)
>   my $t = get 'http://www.alfrankensense.com/al_franken_quotes.html';
> 
>   # inspect the web site and look at what "marker"
>   # your stuff usually starts, in your case - it's the tag:
>   #         <center>Al Franken Quotes</center>
> 
>   my @quotes; # array, where the quotes are to be collected
> 
>   # *If* we got there:
>   if($t =~ /<center>Al Franken Quotes<\/center>/g) { # the inner / is ecscaped
>      # then we write a quick & dirty regular expression
>      # to map on the quote (look in the html for hints)
>      my $q = qr{ \t         # the quote is always preceeded by a tab
>                  "([^"]+)"  # find ", save all (saved to $1), to another "
>                  .+?        # fine, now look up  a '-' followed by whitespace
>                  \-\s+      # which comes here (escaped -) ..
>                  ([^<]+)    # this has to be the quote source until next html tag
>                }sx;   # the /s lets the .(dot) match across lines
>                       # the /x allows us to format and comment this expression
> 
>      # apply this expression to the text
>      while($t=~ /$q/g) { # /g in scalar context (look it up)
>         push @quotes, [$1, $2];  # save found quote on array
>      }                           # quote in $1, source in $2
>   }
> 
>   print "total: " . scalar @quotes . " quotes found\n";
> 
>   for my $q (@quotes) {           # now show what quotes we found
>      print_nice($q->[0], $q->[1]) # and format them however you want
>   }
>   # thats it
> 
>   # we need to provide our special formatting subroutine
>   sub print_nice {
>      my($q, $s) = @_; # shift actual arguments into variables
>      $q =~ s/\s+/ /g;    # quote: transfer multiple whitespace to a single space
>      $q =~ s/<[^>]+>//g; # quote: remove html formatting
>      $s =~ s/\s+/ /g;    # source: same here
>      $s =~ s/<[^>]+>//g; # source: same here
>      print "$q"                # print quote, followed by ...
>          . "\n" . '-'x40 ."\n" # new line + 40 x '-' + new line
>          . "- $s\n\n"          # '-' + quote source + double \n
>   }
We're getting real close here.
  use strict;
  use warnings;
  use LWP::Simple;
  # load the complete content of the url in question
  # via LWP::Simple::get(...)
  my $t = get 'http://www.alfrankensense.com/al_franken_quotes.html';
  # inspect the web site and look at what "marker"
  # your stuff usually starts, in your case - it's the tag:
  #         <center>Al Franken Quotes</center>
  my @quotes; # array, where the quotes are to be collected
  # *If* we got there:
  if($t =~ /<center>Al Franken Quotes<\/center>/g) { # the inner / is
ecscaped
     # then we write a quick & dirty regular expression
     # to map on the quote (look in the html for hints)
     my $q = qr{ \t         # the quote is always preceeded by a tab
                 "([^"]+)"  # find ", save all (saved to $1), to another "
                 .+?        # fine, now look up  a '-' followed by
whitespace
                 \-\s+      # which comes here (escaped -) ..
                 ([^<]+)    # this has to be the quote source until next
html tag
               }sx;   # the /s lets the .(dot) match across lines
                      # the /x allows us to format and comment this
expression
     # apply this expression to the text
     while($t=~ /$q/g) { # /g in scalar context (look it up)
        push @quotes, [$1, $2];  # save found quote on array
     }                           # quote in $1, source in $2
  }
  print "total: " . scalar @quotes . " quotes found\n";
  for my $q (@quotes) {           # now show what quotes we found
     print_nice($q->[0], $q->[1]) # and format them however you want
  }
  # thats it
  # we need to provide our special formatting subroutine
  sub print_nice {
     my($q, $s) = @_; # shift actual arguments into variables
     $q =~ s/\s+/ /g;    # quote: transfer multiple whitespace to a single
space
     $q =~ s/<[^>]+>//g; # quote: remove html formatting
     $s =~ s/\s+/ /g;    # source: same here
     $s =~ s/<[^>]+>//g; # source: same here
     print "$q"                # print quote, followed by ...
         . "\n"                 # new line 
         . "~~ $s\n"          # '-' + quote source + double \n
         . "% \n"               # a percentage sign between quotes
  }
# perl wahab7.pl >\Program Files\40tude Dialog\sigs\frank1.txt
#  perl wahab7.pl >frank1.txt
The output is really close.  I can't see any difference between the format
of the two following files
%
A dictatorship would be a heck of a lot easier, there's no question about
it. 
George W. Bush 
%
After the chaos and carnage of September 11th, it is not enough to serve
our enemies with legal papers. 
George W. Bush 
%
America is a friend to the people of Iraq. Our demands are directed only at
the regime that enslaves them and threatens us. When these demands are met,
the first and greatest benefit will come to Iraqi men, women and children. 
George W. Bush 
%
America is a Nation with a mission - and that mission comes from our most
basic beliefs. We have no desire to dominate, no ambitions of empire. Our
aim is a democratic peace - a peace founded upon the dignity and rights of
every man and woman. 
George W. Bush 
and
%
The biases the media has are much bigger than conservative or liberal.
They're about getting ratings, about making money, about doing stories that
are easy to cover.
~~ Al Franken, 
% 
[G. W. Bush's] pro-air pollution Clear Skies Initiative is designed to
clear the skies of birds.
~~ Al Franken, 
% 
And just like in 1984, where the enemy is switched from Eurasia to
Eastasia, Bush switched our enemy from al Qaeda to Iraq. Bush's War on
Terror is a war against whomever Bush wants to be at war with.
~~ Al Franken, 
% 
Mistakes are a part of being human. Appreciate your mistakes for what they
are: precious life lessons that can only be learned the hard way. Unless
it's a fatal mistake, which, at least, others can learn from.
~~ Al Franken, 
% 
, but right now, dialog doesn't think that these quotes are delimited by a
percentage sign.  Also, we need to remove the commas after Al Franken, when
inappropriate.  I think I can manage that tonight.
   $s =~ s/\s+/ /g;    # source: same here
   $s =~ s/<[^>]+>//g; # source: same here
I don't understand what these statements do.
> I looked into your html source and conceived something
> that does the job somehow. Please try to learn some
> basics of regular expressions, eg.: from here:
> http://oreilly.com/catalog/9781565922570/
> 
Thanks for your response, M., I'll read up tonight.
-- 
George
The terrorists and their supporters declared war on the United States - and
war is what they got.
George W. Bush
Picture of the Day http://apod.nasa.gov/apod/
------------------------------
Date: Wed, 31 Dec 2008 01:58:05 +0100
From: Mirco Wahab <wahab-mail@gmx.de>
Subject: Re: searching for franken
Message-Id: <gjeg80$saj$1@mlucom4.urz.uni-halle.de>
George wrote:
> On Tue, 30 Dec 2008 12:17:44 +0100, Mirco Wahab wrote:
> [snipped and reordered, for thematic reasons]
>> my hack on your problem:
>>   if($t =~ /<center>Al Franken Quotes<\/center>/g) { # the inner / is ecscaped
>>      # then we write a quick & dirty regular expression
>>      # to map on the quote (look in the html for hints)
>>      my $q = qr{ \t         # the quote is always preceeded by a tab
>>                  "([^"]+)"  # find ", save all (saved to $1), to another "
>>                  .+?        # fine, now look up  a '-' followed by whitespace
>>                  \-\s+      # which comes here (escaped -) ..
>>                  ([^<]+)    # this has to be the quote source until next html tag
>>                }sx;   # the /s lets the .(dot) match across lines
>>                       # the /x allows us to format and comment this expression
BTW, there is an error in above expression. Replace everything
from
        my $q {
              ...
to
              }sx
by this slight modification:
     my $q = qr{ \t         # the quote is always preceeded by a tab
                 "([^"]+)"  # find ", save all (saved to $1), to another "
                 .+?        # fine, now look up  a '-' followed by whitespace
                 \-\s+      # which comes here (escaped -) ..
                 (.+?)      # this has to be the quote source ($2) until
                 </b>       # <== the terminal html (closing) tag which is a </b>
               }sx;   # the /s lets the .(dot) match across lines
                      # the /x allows us to format and comment this expression
The alfranken-page has sometimes html within he quote source,
the <== part of the expression makes the difference.
(The stray commas will be gone too, this was the reason.)
 ...
>
> We're getting real close here.
> ...
>   sub print_nice {
>      my($q, $s) = @_; # shift actual arguments into variables
>      $q =~ s/\s+/ /g;    # quote: transfer multiple whitespace to a single 
>      $q =~ s/<[^>]+>//g; # quote: remove html formatting
>      $s =~ s/\s+/ /g;    # source: same here
>      $s =~ s/<[^>]+>//g; # source: same here
>      print "$q"              # print quote, followed by ...
>          . "\n"              # new line 
>          . "~~ $s\n"         # '-' + quote source + double \n
>          . "% \n"            # a percentage sign between quotes
>   }
> ...
> but right now, dialog doesn't think that these quotes are delimited by a
> percentage sign.  Also, we need to remove the commas after Al Franken, when
> inappropriate.  I think I can manage that tonight.
OK, your quotes should probably *start* with the %, so replace
the print_nice by this one:
  sub print_nice {
     my($q, $s) = @_; # shift actual arguments into variables
     $q =~ s/\s+/ /g;    # quote: transfer multiple whitespace to a single
     $q =~ s/<[^>]+>//g; # quote: remove html formatting
     $s =~ s/\s+/ /g;    # source: same here
     $s =~ s/<[^>]+>//g; # source: same here
     print "%\n$q\n"   # print $, newline, quote, newline
         . "~~ $s\n"         # '~~' + quote source + \n
  }
Furthermore, "remove" the line (further above)
# print "total: " . scalar @quotes . " quotes found\n";
by commenting out with '#'.
>    $s =~ s/\s+/ /g;    # source: same here
>    $s =~ s/<[^>]+>//g; # source: same here
> 
> I don't understand what these statements do.
This is (line one) substitution (s/) of any count
of successive whitespace (\s+) by a single space ' '
and (second line) substitution of a html tag of
any kind like <stuff within brackets> by 'emptiness'.
See: http://www.anaesthetist.com/mnm/perl/Findex.htm#regex.htm
Regards
M.
------------------------------
Date: Wed, 31 Dec 2008 00:37:09 -0700
From: Frank <frank@example.invalid>
Subject: Re: searching for franken
Message-Id: <1ns7jow1tf2yc.17dto9mtde6cn.dlg@40tude.net>
On Tue, 30 Dec 2008 08:51:16 -0600, Tad J McClellan wrote:
> George <george@example.invalid> wrote:
>> On Mon, 29 Dec 2008 08:07:39 -0600, Tad J McClellan wrote:
> Now you will need neither m//m nor m//s...
Tonight's reading in the camel book might be the best place to start with
regex's.  It's chapter 5, and the camel book prefers to call the topic
"patterns."
So \ | ( ) [ { ^ $ * + ? . are the miscreants.
Not also ] / } /?
>>>>   while($html =~ /$what/mg) { # note the /m modifier
Pattern modifiers is where you get traction on this.
pg 147 :
The m//,s///, and qr// operators all accept the following modifers after
their final delimiter:
/i
/s
/m
/x
/o
# end excerpt
There's a lot of ways to get the m's and the s's backwards there.
> m//m modifies the meaning of the "^" and "$" anchors. It is useless
> on patterns that do not make use of those anchors.
Let ^ and $ match next imbedded \n.
> 
> m//s modifies the meaning of ".". It is useless on patterns that
> do not make use of the dot metacharacter (like in the amended
> pattern above).
Let . match newline and ignore $* .
>> my $url  = 'www.alfrankensense.com/al_franken_quotes.html';
> 
>> This is the page that I want to work on.  
> 
> 
> Getting this deep into a thread before the subject of the article
> correlates with the Subject of the article is plain silly.
> 
> Please exercise more care in choosing the contents of your Subject header.
I didn't know the url existed before yesterday. I disagree with your
opinion about the subject, and, as OP, think myself relevant.
Any ideas why this sig goes wild?
-- 
Frank
The biases the media has are much bigger than conservative or liberal.
They're about getting ratings, about making money, about doing stories that
are easy to cover.
~~ Al Franken,
%
[G. W. Bush's] pro-air pollution Clear Skies Initiative is designed to
clear the skies of birds.
~~ Al Franken,
%
And just like in 1984, where the enemy is switched from Eurasia to
Eastasia, Bush switched our enemy from al Qaeda to Iraq. Bush's War on
Terror is a war against whomever Bush wants to be at war with.
~~ Al Franken,
%
Mistakes are a part of being human. Appreciate your mistakes for what they
are: precious life lessons that can only be learned the hard way. Unless
it's a fatal mistake, which, at least, others can learn from.
~~ Al Franken,
%
In many ways I'm still a Hubert Humphrey Democrat -- someone who believes
in afflicting the comfortable and comforting the afflicted. A society is
judged by how it treats the elderly, the sick, the impoverished. To me it's
a matter of ethics and compassion.
~~ Al Franken, Playboy interview
%
When you encounter seemingly good advice that contradicts other seemingly
good advice, ignore them both.
~~ Al Franken,
%
And by the way, a few months ago, I trademarked the word 'funny.' So when
Fox calls me 'unfunny,' they're violating my trademark. I am seriously
considering a countersuit.
~~ Al Franken, in response to Fox's copyright infringement lawsuit
%
The irony upon irony of this lawsuit was great. First, Fox having the
trademark 'fair and balanced' -- a network which is anything but fair and
balanced. Then there's the irony of a news organization trying to suppress
free speech.
~~ Al Franken, CNN interview
%
[Roger Ailes, Fox News Founder, Chairman and CEO, and former
Nixon-Reagan-Bush strategist, is] a cynical Republican ideologue with no
regard for fairness and balance.
~~ Al Franken,
%
I once asked the most fabulous couple I know, Madonna and Guy Ritchie, how
they kept things fresh despite having been married for almost seven months.
'It's a job, Al,' Guy told me. 'We work at it every day.'
~~ Al Franken,
%
A brief digression on whether that suspicious-looking mole is actually
cancer. ... Take this simple test called the ABC test. 'A' is for age. What
is your age? Is it over thirteen? If so, it's cancer. That's how the ABC
test works.
~~ Al Franken,
%
[Newt Gingrich] is the most unpopular politician in America. His favorable
rating is only four points higher than the Unabomber.
~~ Al Franken, 1996
%
I said that Sean Hannity took residence up Newt Gingrich's butt from 94 to
98. I got that from British intelligence. It turns out he only took up
residence in 95.
~~ Al Franken
%
I do personal attacks only on people who specialize in personal attacks..
~~ Al Franken, Playboy interview
%
There's no liberal echo chamber in this country. There's a right-wing echo
chamber. I want to create a countervailing echo chamber.
~~ Al Franken, Chicago Tribune interview, on
%
I think some people hold [G.W.Bush] in high esteem because they watch Fox.
And they get their news from Rush Limbaugh. And they are fooled.
~~ Al Franken, in response to the 2004 SOTU address
%
No Child Left Behind is the most ironically named act, piece of legislation
since the 1942 Japanese Family Leave Act.
~~ Al Franken, in response to the 2004 SOTU address
%
I think if you're going to do a movie about Reagan you do it about the fact
that he created the huge deficit, that he armed the mujahadeen, that he
armed Saddam, that he armed Iran, he armed 2/3s of the Axis of Evil, he
funded terrorists in Central America, he was in my mind a terrible
president.
~~ Al Franken, Book TV, on CBS's Reagan movie
%
During the Reagan Administration, Bob Dole was present at a ceremony that
included each living ex-president. Looking at a tableau of Ford, Carter and
Nixon, Dole said, 'There they are: Hear No Evil, See No Evil and Evil.'
~~ Al Franken,
%
If you put the two Bushs together in their over seven years of their two
presidencies, not one new job has been created. Numbers do not lie. If you
extrapolated from that, if the Bushs had run this country from its very
beginning to the current time, not one American would have ever worked.
We'd be hunter-gatherers.
~~ Al Franken, in response to the 2004 SOTU address
%
Most of us here in the media are what I call infotainers...Rush Limbaugh is
what I call a disinfotainer. He entertains by spreading disinformation.
~~ Al Franken
%
Drug war, well, as Rush Limbaugh said, anyone who uses drugs illegally
should be prosecuted and put away. I don't agree with him; I think they
should be treated, but that's what Rush believes and so, you know, we're
praying for Rush because he's in recovery and you take responsibilities for
your actions so I'm sure any day now Rush will demand to be put away for
the maximum sentence and ask for the most dangerous prison and we'll be
praying for maybe an African American cellmate who saw the Donovan McNabb
comments on ESPN. So we're prayin'.
~~ Al Franken, Book TV, on Rush Limbaugh's illegal drug arrest and racist
remarks
%
If [Stuart Saves His Family] had actually been successful it would have
been a lot better teacher for me than the failure that it was, because it
would have given me the opportunity to do more movies,
~~ Al Franken, CNN interview
%
It's the Power of the Almighty, the Splendor of Nature, and then you.
~~ Al Franken
%
A concussion.
~~ Al Franken, Playboy interview, when asked what it would take for his
name to appear on the masthead of National Review or The Weekly Standard.
%
Oh, What Doesn't Kill You Can Have Lingering Aftereffects!
~~ Al Franken,
%
That's just stinkin' thinkin!
~~ Al Franken,
%
Listen to me. I'm should-ing all over myself.
~~ Al Franken
%
Whining is anger through a small opening.
~~ Al Franken
%
I'm good enough, I'm smart enough, and doggone it, people like me.
~~ Al Franken
%
I'm going to die homeless, penniless, and 30 pounds overweight.
~~ Al Franken
%
It's easier to put on slippers than to carpet the whole world.
~~ Al Franken
%
I would never ordinally say this, but... is there any way you can get to a
pound cake?
~~ Al Franken
%
I'm a perfectionist and if I start making changes, I'll never stop.
~~ Al Franken
%
My father grew up in the Great Depression - his mother's.
~~ Al Franken
%
 ...it's obviously how his disease manifests itself, any kind of substance
dependency is very deep, issues of self esteem, you can just tell that he's
a really insecure and vulnerable person -- and I love him. You know,
sometimes I listen to him on the radio, and he's very judgmental, he's a
very angry person, and I just want to remind him that anytime you have a
finger pointing at someone else, there's three pointing back at you.
~~ Al Franken
%
Picture of the Day http://apod.nasa.gov/apod/
------------------------------
Date: Wed, 31 Dec 2008 02:01:08 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: searching for franken
Message-Id: <slrnglm9m4.pgh.tadmc@tadmc30.sbcglobal.net>
Frank <frank@example.invalid> wrote:
> Tonight's reading in the camel book might be the best place to start with
> regex's.  It's chapter 5, and the camel book prefers to call the topic
> "patterns."
Probably because they no longer meet the definition of being "regular".
> So \ | ( ) [ { ^ $ * + ? . are the miscreants.
>
> Not also ] / } /?
] and }  don't become meta until they appear after their
corresponding opening char.
I am always thrilled whenever I need to match square bracket chars
because then I can write:
   /[][]/;   # which are meta and which are literal?
slash is not special in patterns, though it is often
special with the pattern match *operator*.
You can choose to use some delimiter other than /, then that
other character becomes meta (to the operator, not to patterns).
   /\/etc\/passwd/;  # leaning toothpick syndrome
can also be written:
   m#/etc/passwd#;
to keep your eyes from crossing...
I don't know what you mean by the fourth one, "/?"...
>>>>>   while($html =~ /$what/mg) { # note the /m modifier
>
> Pattern modifiers is where you get traction on this.
>
> pg 147 :
>
> The m//,s///, and qr// operators all accept the following modifers after
> their final delimiter:
>
> /i
> /s
> /m
> /x
> /o
Wa' happened to /g ?
I like to use Damian Conway's mnemonic: gym sox (gim sox).
>> m//m modifies the meaning of the "^" and "$" anchors. It is useless
>> on patterns that do not make use of those anchors.
>
> Let ^ and $ match next imbedded \n.
No, that is not correct.
Anchors are "zero width", they do not match _any_ characters (they
match positions instead).
^ and $ normally mean "match at begining/end of string".
with m//m, ^ and $ mean "match at begining/end of line".
>>> my $url  = 'www.alfrankensense.com/al_franken_quotes.html';
>> 
>>> This is the page that I want to work on.  
>> 
>> 
>> Getting this deep into a thread before the subject of the article
>> correlates with the Subject of the article is plain silly.
>> 
>> Please exercise more care in choosing the contents of your Subject header.
>
> I didn't know the url existed before yesterday. I disagree with your
> opinion about the subject, 
Then what did "franken" mean when you wrote it?
> and, as OP, think myself relevant.
You are not the OP.
You are Frank.
The OP was George.
-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
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 2088
***************************************