[29601] in Perl-Users-Digest
Perl-Users Digest, Issue: 845 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 13 03:09:41 2007
Date: Thu, 13 Sep 2007 00: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 Thu, 13 Sep 2007 Volume: 11 Number: 845
Today's topics:
$string =~ /$pattern/i cracraft@cox.net
Re: $string =~ /$pattern/i <noreply@gunnar.cc>
Re: (?{ code }) block works fine in child rule but not <nospam-abuse@ilyaz.org>
Re: (?{ code }) block works fine in child rule but not <bart.lateur@pandora.be>
Re: Free guitars <ataru@faeroes.freeshell.org>
new CPAN modules on Thu Sep 13 2007 (Randal Schwartz)
Re: passing variable to sub - $_='SendMessage' <ben@morrow.me.uk>
removing rows based on two duplicate fileds <vnr1995@gmail.com>
Re: removing rows based on two duplicate fileds usenet@DavidFilmer.com
Re: removing rows based on two duplicate fileds <tadmc@seesig.invalid>
Re: removing rows based on two duplicate fileds <tadmc@seesig.invalid>
removing users from /etc/group <vnr1995@gmail.com>
Re: removing users from /etc/group <news@lawshouse.org>
Running Perl script in the backend from Html satish2112@gmail.com
Re: Running Perl script in the backend from Html <stoupa@practisoft.cz>
Win32::OLE->Getobject hangs?? <bubslg@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 12 Sep 2007 16:53:09 -0700
From: cracraft@cox.net
Subject: $string =~ /$pattern/i
Message-Id: <1189641189.478787.189610@o80g2000hse.googlegroups.com>
Hi,
I am attempting to find out if a $string contains $pattern.
$string =~ /$pattern/i
normally solves it.
However, I noticed that if $pattern contains something like
(4)
and $string contains something like
ABC(4)
then
$string =~ /$pattern/i
does not work, because of the parenthesis.
I want a flat-out literal match where $string can contain any
occurrence of $pattern regardless of parenthesis.
In other words, I don't want the special characters of regular
expressions interpreted.
I could write my own pattern matcher but resist it and would
think Perl could provide the above feature.
Anybody?
--Stuart
------------------------------
Date: Thu, 13 Sep 2007 02:11:49 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: $string =~ /$pattern/i
Message-Id: <5krdijF55k6qU1@mid.individual.net>
cracraft@cox.net wrote:
> I am attempting to find out if a $string contains $pattern.
>
> $string =~ /$pattern/i
>
> normally solves it.
>
> However, I noticed that if $pattern contains something like
>
> (4)
>
> and $string contains something like
>
> ABC(4)
>
> then
>
> $string =~ /$pattern/i
>
> does not work, because of the parenthesis.
>
> I want a flat-out literal match where $string can contain any
> occurrence of $pattern regardless of parenthesis.
>
> In other words, I don't want the special characters of regular
> expressions interpreted.
$string =~ /\Q$pattern/i
> I could write my own pattern matcher
Really? And still not able to solve this problem?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Thu, 13 Sep 2007 05:02:05 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: (?{ code }) block works fine in child rule but not in parent
Message-Id: <fcag8d$2bm9$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Ben Morrow
<ben@morrow.me.uk>], who wrote in article <a4sjr4-cvt.ln1@osiris.mauzo.dyndns.org>:
> > Was there ever a time when qr// was the only way to have different parts
> > of the pattern have different "global" options, or was qr// introduced
> > after (?-xism:...) was introduced?
> No, that doesn't work....
[Not parsable.]
> a qr// is stringified before it's interpolated.
It may be not interpolated at all, and used "as is". Then
the way it is stringified does not matter.
> It *cannot* preserve its options unless it has the
> (?xism-:) syntax to preserve them into; since Ilya says that syntax was
> introduced for the sake of qr//s, they must have originally interpolated
> with different semantics from when they were compiled.
Correct. I decided that it would take longer to write decent
documentation for this difference in behaviour, than to design and
implement "a sane behaviour". ;-)
Yours,
Ilya
------------------------------
Date: Thu, 13 Sep 2007 05:44:49 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: (?{ code }) block works fine in child rule but not in parent
Message-Id: <nijhe3102ehcjlcu1p7ddv1tkoo5rimsbg@4ax.com>
Martijn Lievaart wrote:
>Did you look at Parser::Decent? Seems like the perfect tool for this job.
Except it's dead slow.
--
Bart.
------------------------------
Date: Wed, 12 Sep 2007 22:33:32 +0000 (UTC)
From: Christopher Benson-Manica <ataru@faeroes.freeshell.org>
Subject: Re: Free guitars
Message-Id: <fc9pfs$agb$1@chessie.cirr.com>
In comp.lang.c the Bede <rspwsownthebede@yahoo.com> wrote:
> <nutsbreaker3@gmail.com> wrote in message
> news:1189628263.196219.13780@r34g2000hsd.googlegroups.com...
>> (snip spam)
> (snip response)
Please do not reply to spam, or, if you are simply unable to help
yourself, at least a) trim the crosspost list appropriately, and b)
don't help the spammer by reposting its url.
(tin won't let me set followups to /dev/null; I've done the next best
thing.)
--
C. Benson Manica | I appreciate all corrections, polite or otherwise.
cbmanica(at)gmail.com |
----------------------| I do not currently read any posts posted through
sdf.lonestar.org | Google groups, due to rampant unchecked spam.
------------------------------
Date: Thu, 13 Sep 2007 04:42:15 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Sep 13 2007
Message-Id: <JoAIEF.qw2@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.
Acme-Godot-0.001001
http://search.cpan.org/~sjn/Acme-Godot-0.001001/
Nothing to be done
----
Alien-SVN-1.4.5.0
http://search.cpan.org/~mschwern/Alien-SVN-1.4.5.0/
A wrapper for installing the SVN Perl bindings
----
Business-ISBN-2.02_05
http://search.cpan.org/~bdfoy/Business-ISBN-2.02_05/
work with International Standard Book Numbers
----
CGI-Application-Tutorial-Namegame-0.01
http://search.cpan.org/~leocharre/CGI-Application-Tutorial-Namegame-0.01/
example of how to use plugins with cgiapps
----
CGI-PathInfo-1.02
http://search.cpan.org/~leocharre/CGI-PathInfo-1.02/
----
Catalyst-Controller-HTML-FormFu-0.01002
http://search.cpan.org/~cfranks/Catalyst-Controller-HTML-FormFu-0.01002/
----
Catalyst-Example-InstantCRUD-0.0.19
http://search.cpan.org/~zby/Catalyst-Example-InstantCRUD-0.0.19/
A CRUD scaffolding for Catalyst.
----
Catalyst-Example-InstantCRUD-0.0.20
http://search.cpan.org/~zby/Catalyst-Example-InstantCRUD-0.0.20/
A CRUD scaffolding for Catalyst.
----
Catalyst-Plugin-Authentication-Store-DBIC-0.08
http://search.cpan.org/~mramberg/Catalyst-Plugin-Authentication-Store-DBIC-0.08/
Authentication and authorization against a DBIx::Class or Class::DBI model.
----
Catalyst-Plugin-SubRequest-0.12
http://search.cpan.org/~mramberg/Catalyst-Plugin-SubRequest-0.12/
Make subrequests to actions in Catalyst
----
Catalyst-Plugin-Unicode-0.6
http://search.cpan.org/~mramberg/Catalyst-Plugin-Unicode-0.6/
Unicode aware Catalyst
----
Class-Method-Modifiers-0.07
http://search.cpan.org/~sartak/Class-Method-Modifiers-0.07/
provides Moose-like method modifiers
----
Crypt-Rijndael-1.04_01
http://search.cpan.org/~bdfoy/Crypt-Rijndael-1.04_01/
Crypt::CBC compliant Rijndael encryption module
----
DateTime-TimeZone-Tzfile-0.001
http://search.cpan.org/~zefram/DateTime-TimeZone-Tzfile-0.001/
tzfile (zoneinfo) timezone files
----
Devel-Events-0.01
http://search.cpan.org/~nuffin/Devel-Events-0.01/
Extensible instrumentation framework.
----
Devel-Events-Filter-Size-0.01
http://search.cpan.org/~nuffin/Devel-Events-Filter-Size-0.01/
----
Devel-Events-Filter-Size-0.02
http://search.cpan.org/~nuffin/Devel-Events-Filter-Size-0.02/
Add Devel::Size info to event data.
----
Devel-Events-Objects-0.01
http://search.cpan.org/~nuffin/Devel-Events-Objects-0.01/
Object tracking support for Devel::Events
----
Devel-PerlySense-0.01_17
http://search.cpan.org/~johanl/Devel-PerlySense-0.01_17/
IntelliSense for Perl
----
HTML-FormFu-0.01004
http://search.cpan.org/~cfranks/HTML-FormFu-0.01004/
HTML Form Creation, Rendering and Validation Framework
----
HTML-Tested-0.28
http://search.cpan.org/~bosu/HTML-Tested-0.28/
Provides HTML widgets with the built-in means of testing.
----
HTTP-Async-0.08
http://search.cpan.org/~evdb/HTTP-Async-0.08/
process multiple HTTP requests in parallel without blocking.
----
LEOCHARRE-Class-1.06
http://search.cpan.org/~leocharre/LEOCHARRE-Class-1.06/
----
Language-MuldisD-0.7.0
http://search.cpan.org/~duncand/Language-MuldisD-0.7.0/
Formal spec of Muldis D relational DBMS lang
----
Log-Handler-0.37_01
http://search.cpan.org/~bloonix/Log-Handler-0.37_01/
A simple handler to log messages to log files.
----
Module-CPANTS-Analyse-0.73
http://search.cpan.org/~domm/Module-CPANTS-Analyse-0.73/
Generate Kwalitee ratings for a distribution
----
MojoMojo-0.999002
http://search.cpan.org/~mramberg/MojoMojo-0.999002/
A Catalyst & DBIx::Class powered Wiki.
----
Net-IDN-tools-0.9920070912
http://search.cpan.org/~cfaerber/Net-IDN-tools-0.9920070912/
----
Net-IDN-tools-0.99_20070912
http://search.cpan.org/~cfaerber/Net-IDN-tools-0.99_20070912/
----
Net-Jabber-Bot-1.2.1
http://search.cpan.org/~toddr/Net-Jabber-Bot-1.2.1/
Automated Bot creation with safeties
----
Net-SIP-0.33
http://search.cpan.org/~sullr/Net-SIP-0.33/
Framework SIP (Voice Over IP, RFC3261)
----
Net-Whois-RegistryFusion-0.05
http://search.cpan.org/~ilial/Net-Whois-RegistryFusion-0.05/
perform cacheable whois lookups using RegistryFusion XML API
----
Ogre-0.27
http://search.cpan.org/~slanning/Ogre-0.27/
Perl binding for the OGRE C++ graphics library
----
POE-Component-MDBA-0.01002
http://search.cpan.org/~dmaki/POE-Component-MDBA-0.01002/
Multi-Database Aggregation with POE
----
Palm-Keyring-0.96_02
http://search.cpan.org/~andrew/Palm-Keyring-0.96_02/
Handler for Palm Keyring databases.
----
Palm-Keyring-0.96_03
http://search.cpan.org/~andrew/Palm-Keyring-0.96_03/
Handler for Palm Keyring databases.
----
Palm-Keyring-0.96_04
http://search.cpan.org/~andrew/Palm-Keyring-0.96_04/
Handler for Palm Keyring databases.
----
Slay-Maker-0.06
http://search.cpan.org/~nodine/Slay-Maker-0.06/
An perl make engine using perl code for rules
----
Template-Like-0.04
http://search.cpan.org/~askadna/Template-Like-0.04/
Lightweight Template Engine.
----
Text-Restructured-0.003036
http://search.cpan.org/~nodine/Text-Restructured-0.003036/
Perl implementation of reStructuredText parser
----
Text-WikiCreole-0.02
http://search.cpan.org/~jburnett/Text-WikiCreole-0.02/
Convert Wiki Creole 1.0 markup to XHTML
----
VCI-0.1.2
http://search.cpan.org/~mkanat/VCI-0.1.2/
A generic interface for interacting with various version-control systems.
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: Thu, 13 Sep 2007 00:52:09 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: passing variable to sub - $_='SendMessage'
Message-Id: <9mamr4-cl2.ln1@osiris.mauzo.dyndns.org>
[please trim quotations when replying]
Quoth steve <steven.stone4@btopenworld.com>:
>
> think I got all your points except the ->Append / join one, dont see
> how it can be used to replace the 3 appends
> case 3 {
> $win->RxTextfield->Append("action 3\r\n");
> chomp($actions[1]);
> $win->RxTextfield->Append("$actions[1]\r\n");
> open my $ACTION, '<', $actions[1] or die "cant open '$actions[1]' :
> $!";
> while (my $line = <$ACTION> ) {
> $win->RxTextfield->Append("$line\r\n");
> }
This 'while' loop will call ->Append multiple times (once for each line
in the file). The replacement I posted avoids that. The two previous
calls to ->Append are still needed, of course.
Ben
------------------------------
Date: Wed, 12 Sep 2007 23:31:58 -0000
From: heylow <vnr1995@gmail.com>
Subject: removing rows based on two duplicate fileds
Message-Id: <1189639918.048612.190650@57g2000hsv.googlegroups.com>
Gurus:
I have merged /etc/passwd files many systems, and trying to master
passwd file. I concatenated and sorted uniquely. I have the resultant
file which looks like
smith:*:100:100:8A-74(office):/home/smith:/bin/ksh
smith:*:100:100:8A-74(office):/home/smith:/etc/fakesh <-- duplicate
rob:*:101:101:8A-75(office):/home/smith:/bin/ksh
don:*:102:102:B25:/home/don:/bin/fakesh
don:*:102:102:B25:/home/don:/bin/fakesh <-- duplicate
ele:*:255:255:A45:/home/ele:/bin/ksh
rod:*:300:300:B456:/home/rod:/bin/ksh
I want to delete the duplicates; that is, I want to keep only one row
for every uid.
I have tried with ksh, but in vain. Can you shed how it can be done in
perl.
Thanks, Pedro
------------------------------
Date: Wed, 12 Sep 2007 23:46:43 -0000
From: usenet@DavidFilmer.com
Subject: Re: removing rows based on two duplicate fileds
Message-Id: <1189640803.732821.175240@d55g2000hsg.googlegroups.com>
On Sep 12, 4:31 pm, heylow <vnr1...@gmail.com> wrote:
> I want to delete the duplicates; that is, I want to keep only one row
> for every uid.
If you always want to assume the first instance wins, something like
this should work:
#!/usr/local/bin/perl
use strict; use warnings;
open (my $in, '<', 'passwd.merged');
open (my $out, '>', 'passwd.cleaned');
my %seen;
while (<$in>) {
/^(.*?):/;
print $out $_ unless $seen{$1};
$seen{$1}++;
}
__END__
--
The best way to get a good answer is to ask a good question.
David Filmer (http://DavidFilmer.com)
------------------------------
Date: Wed, 12 Sep 2007 18:59:41 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: removing rows based on two duplicate fileds
Message-Id: <slrnfegvbd.c0u.tadmc@tadmc30.sbcglobal.net>
heylow <vnr1995@gmail.com> wrote:
> I want to delete the duplicates;
> Can you shed how it can be done in
> perl.
It is done the way outlined in the Frequently Asked Questions.
perldoc -q duplicate
How can I remove duplicate elements from a list or array?
Modify it for your particular case:
---------------------------------
#!/usr/bin/perl
use warnings;
use strict;
my @unique = ();
my %seen = ();
while ( <DATA> ) {
my $elem = (split /:/)[2];
next if $seen{ $elem }++;
push @unique, $_;
}
print for @unique;
__DATA__
smith:*:100:100:8A-74(office):/home/smith:/bin/ksh
smith:*:100:100:8A-74(office):/home/smith:/etc/fakesh <-- duplicate
rob:*:101:101:8A-75(office):/home/smith:/bin/ksh
don:*:102:102:B25:/home/don:/bin/fakesh
don:*:102:102:B25:/home/don:/bin/fakesh <-- duplicate
ele:*:255:255:A45:/home/ele:/bin/ksh
rod:*:300:300:B456:/home/rod:/bin/ksh
---------------------------------
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Wed, 12 Sep 2007 20:13:50 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: removing rows based on two duplicate fileds
Message-Id: <slrnfeh3me.cu5.tadmc@tadmc30.sbcglobal.net>
usenet@DavidFilmer.com <usenet@DavidFilmer.com> wrote:
> open (my $in, '<', 'passwd.merged');
You should always, yes *always*, check the return value from open().
> /^(.*?):/;
> print $out $_ unless $seen{$1};
You should never use the dollar-digit variables unless you have
first ensured that the match _succeeded_.
The OP said he wanted duplicate uid's removed. The 1st field
is not the uid.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Thu, 13 Sep 2007 03:57:17 -0000
From: heylow <vnr1995@gmail.com>
Subject: removing users from /etc/group
Message-Id: <1189655837.605058.152190@50g2000hsm.googlegroups.com>
Hi Gurus:
I have a master file /etc/group, and another file contains logins
(say, master.login). I want to delete all users in /etc/group, who do
not exist in this master.login
master.login
-----------
abel
dan
cory
sia
/etc/group:
------
gr001:x:500:abel, x,y,z,sia
gr002:x:501:a,b, dan
gr003:x:610:cory, dan, x, a
I wanted to remove users (a, b, x, y, z) who do not exist in
master.login from the /etc/group, so that i can get clean group file.
Thanks for your help.
Pedro.
------------------------------
Date: Thu, 13 Sep 2007 07:00:47 +0100
From: Henry Law <news@lawshouse.org>
Subject: Re: removing users from /etc/group
Message-Id: <1189663183.73289.0@despina.uk.clara.net>
heylow wrote:
> I have a master file /etc/group, and another file contains logins
> (say, master.login). I want to delete all users in /etc/group, who do
> not exist in this master.login
> I wanted to remove users (a, b, x, y, z) who do not exist in
> master.login from the /etc/group, so that i can get clean group file.
You could write some Perl to do that; doesn't look too hard. Why not
have a go and come back here when you hit a snag? People here would be
delighted to help you overcome it.
--
Henry Law Manchester, England
------------------------------
Date: Thu, 13 Sep 2007 03:51:30 -0000
From: satish2112@gmail.com
Subject: Running Perl script in the backend from Html
Message-Id: <1189655490.482871.143540@r34g2000hsd.googlegroups.com>
following is my Html code:
<form name="form100" method="post" action="script.pl">
<textarea cols = "160" rows="12" name="TextArea1" > </textarea>
<input align = "left" name="UpdateButton" type= "submit"
value="Update" >
in the above code, if i click on submit button, a webpage is opened
and the script in script.pl is executed.
is there any way such that another web-page is not opened and the
script is run in the backend?
Please help me!!
------------------------------
Date: Thu, 13 Sep 2007 08:11:05 +0200
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: Running Perl script in the backend from Html
Message-Id: <fcakn9$2rt9$1@ns.felk.cvut.cz>
satish2112@gmail.com wrote:
> following is my Html code:
>
> <form name="form100" method="post" action="script.pl">
> <textarea cols = "160" rows="12" name="TextArea1" > </textarea>
> <input align = "left" name="UpdateButton" type= "submit"
> value="Update" >
>
> in the above code, if i click on submit button, a webpage is opened
> and the script in script.pl is executed.
>
> is there any way such that another web-page is not opened and the
> script is run in the backend?
>
For what purpose you need it? Maybe I can help you when I will know the
purpose.
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
------------------------------
Date: Wed, 12 Sep 2007 22:15:45 -0000
From: bubslg <bubslg@gmail.com>
Subject: Win32::OLE->Getobject hangs??
Message-Id: <1189635345.046167.107460@o80g2000hse.googlegroups.com>
I've got a script that goes through a list of servers and grabs dirve
info from them. The script usually works fine except when it hits a
server that WMI is acting goofy on.
Out of a list of ~250 servers, this call will hang on 2-3 servers.
$WMIServices = Win32::OLE->GetObject("winmgmts:
{impersonationLevel=impersonate}!//$Server/root/cimv2")
Any ideas how to get around this? Is ther a way to force this call to
timeout and move on?
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 845
**************************************