[29429] in Perl-Users-Digest
Perl-Users Digest, Issue: 673 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 23 09:10:09 2007
Date: Mon, 23 Jul 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 Mon, 23 Jul 2007 Volume: 11 Number: 673
Today's topics:
Re: @arts <dummy@example.com>
Re: @arts <zaxfuuq@invalid.net>
Re: @arts <vronans@nowheresville.spamwall>
Re: @arts <bik.mido@tiscalinet.it>
Re: @arts <bik.mido@tiscalinet.it>
Re: @arts <bik.mido@tiscalinet.it>
[OT] misc (was: Re: @arts) <rvtol+news@isolution.nl>
Re: [OT] misc (was: Re: @arts) <bik.mido@tiscalinet.it>
append arrays <a@mail.com>
Re: append arrays <noreply@gunnar.cc>
Re: append arrays <scobloke2@infotop.co.uk>
Re: funky TCP problems (Alan Curry)
Re: In deep complex XML <sow@sow.org.pl>
Re: Math <sisyphus1@nomail.afraid.org>
Re: Math <jurgenex@hotmail.com>
Re: Math <sisyphus1@nomail.afraid.org>
new CPAN modules on Mon Jul 23 2007 (Randal Schwartz)
perl IRC <sow@sow.org.pl>
Re: regexp as function? <wahab@chemie.uni-halle.de>
Re: regexp as function? <papahuhn@gmx.net>
Small script on OpenBSD sukovic@gmail.com
Re: Small script on OpenBSD (Jens Thoms Toerring)
Re: wors on active perl but not on unix <nospam@home.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 23 Jul 2007 02:28:31 GMT
From: "John W. Krahn" <dummy@example.com>
Subject: Re: @arts
Message-Id: <jnUoi.59258$tB5.46200@edtnps90>
Michele Dondi wrote:
> On Sun, 22 Jul 2007 16:47:03 -0700, "Wade Ward" <zaxfuuq@invalid.net>
> wrote:
>>
>>> my (undef, $first, $last, undef)=$nntp->group($grp)
> [snip]
>> It would seem that you didn't want the number of articles in the group or
>> the group name, and left it undef. Is undef a function in this usage?
>> $first and $last would be scalars that you used.
>
> Yes, it is a function, and as with all functions, you can read about
> it at
>
> perldoc -f undef
>
> undef in that usage is still a function, but you're only using its
> return value, which is actually its most common use, at first sight.
In the example above the return value of undef is *not* being used. In that
example undef is used as a "place holder" and it receives one of the values in
the list (and discards it.)
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
------------------------------
Date: Sun, 22 Jul 2007 22:49:02 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: @arts
Message-Id: <lNKdnaVSvrayijnbnZ2dnUVZ_q6hnZ2d@comcast.com>
"John W. Krahn" <dummy@example.com> wrote in message
news:jnUoi.59258$tB5.46200@edtnps90...
> Michele Dondi wrote:
>> On Sun, 22 Jul 2007 16:47:03 -0700, "Wade Ward" <zaxfuuq@invalid.net>
>> wrote:
>>>
>>>> my (undef, $first, $last, undef)=$nntp->group($grp)
>> [snip]
>>> It would seem that you didn't want the number of articles in the group
>>> or the group name, and left it undef. Is undef a function in this
>>> usage? $first and $last would be scalars that you used.
>>
>> Yes, it is a function, and as with all functions, you can read about
>> it at
>>
>> perldoc -f undef
>>
>> undef in that usage is still a function, but you're only using its
>> return value, which is actually its most common use, at first sight.
>
> In the example above the return value of undef is *not* being used. In
> that example undef is used as a "place holder" and it receives one of the
> values in the list (and discards it.)
...and it's a good notation if you want a newcomer to follow your source
script. He could have just as easily written:
my ($errno2, $first, $last, $debug1)=$nntp->group($grp);
and been, I believe, semantically correct.
--
Wade Ward
------------------------------
Date: Mon, 23 Jul 2007 01:13:01 -0700
From: "Vronans" <vronans@nowheresville.spamwall>
Subject: Re: @arts
Message-Id: <ttednb6suamP_jnbnZ2dnUVZ_vamnZ2d@wavecable.com>
"Wade Ward" <zaxfuuq@invalid.net> wrote in message
news:2J6dnRlDn_V7KD7bnZ2dnUVZ_v2unZ2d@comcast.com...
>
> "Tad McClellan" <tadmc@seesig.invalid> wrote in message
> news:slrnfa7b6f.siu.tadmc@tadmc30.sbcglobal.net...
>> Wade Ward <zaxfuuq@invalid.net> wrote:
>>
>>> 3) There exist special variables that begin with @ and look a lot
>>> like
>>> @arts.
>>
>>
>> Please share your knowledge with me then.
> Believe it or not, I didn't start this thread to look like an idiot,
> although I seem to have achieved this.
There are some here which chose to treat you as such, rather then
attempt to see what your problem really was*, one of which conveniently
snipped the part** of your post that described why you thought @arts was
special:
[[ "Wade Ward" wrote <news:CNSdnWsIpuaqEj7bnZ2dnUVZ_gydnZ2d@comcast.com>
> 2) I didn't see anything that looked like a declaration to me.
Apparently,
> this is the declaration:
> my ($since, @arts)=time-10*60*60;
> RHS looks like a scalar. Before I modified the 24*60*60 to a
smaller number
> so as not to have 40k of output, it looked like time-24*60*60 would
be a
> biggish integer. I was thinking that this got assigned to $since,
and that
> @arts was something like zone in str2time(DATE [, ZONE]), that is,
some type
> of argument. In C and fortran, the declarations of arrays are
> unmistakeable.
]]
* The only valid gripe I've seen thus far is the original Subject line,
which could of been a little more descriptive.
** There really was no reason to remove that part, unless one is too
busy thinking up their next clever quip.
>> Here are all of Perl's special variables that begin with @
>> that I can find:
>>
>> @LAST_MATCH_END
>> @+
>> @LAST_MATCH_START
>> @-
>> @ARGV
>> @F
>> @INC
>> @_
>>
>>
>> Which one of those looks like @arts to you?
You missed his point entirely (see quoted text from OP's original post.)
The root of his problem seems to be with this line:
==> my ($since, @arts)=time-10*60*60;
This construct doesn't seem to make sense to me, as the array does not
appear to be used at all:
% perl -e 'my ($since, @arts)=time-10*60*60; print "[$since]\n\n[".
join("]\n[", @arts). "]\n\n";'
[1185142005]
[]
As the OP pointed out (see quote above), the result of 'time-10*60*60'
is a scalar, so is there any reason why an array would be used in such a
place? It seems pointless to me, but I admit there could be some
instances my little test doesn't reveal (different result from time() on
another platform is the only thing that comes to mind, although I'd
doubt that.)
------------------------------
Date: Mon, 23 Jul 2007 12:37:33 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: @arts
Message-Id: <ua09a3de7q76umtils6ae1fqht2r58a2e9@4ax.com>
On Mon, 23 Jul 2007 01:13:01 -0700, "Vronans"
<vronans@nowheresville.spamwall> wrote:
>>> Please share your knowledge with me then.
>> Believe it or not, I didn't start this thread to look like an idiot,
>> although I seem to have achieved this.
>
>There are some here which chose to treat you as such, rather then
Well, being admittedly barely beyond the hello world level, asking for
ready made code, and evidently wanting to understand it without prior
knowledge of basic Perl somewhat justifies that.
>attempt to see what your problem really was*, one of which conveniently
>snipped the part** of your post that described why you thought @arts was
I addressed all three points. Anyway, some knowledge of *basic* Perl
wouldn't have raised the one you're stressing.
>** There really was no reason to remove that part, unless one is too
>busy thinking up their next clever quip.
I didn't remove it.
>>> Which one of those looks like @arts to you?
>
>You missed his point entirely (see quoted text from OP's original post.)
No, he didn't, quoted text from the OP's OP notwithstanding. It just
doesn't "look like" any (array) special variable: cum grano salis,
obvioulsy - because "to look like" is subjective.
>The root of his problem seems to be with this line:
> ==> my ($since, @arts)=time-10*60*60;
>
>This construct doesn't seem to make sense to me, as the array does not
Sorry for you. It does for me, if you don't like it just remove it.
>appear to be used at all:
In fact, it's declared but not really used. Should it have? Why so, my
lord? It's used a few lines later -where it makes sense to use it-,
and it's declared as closely as possible to where it's used, which is
what we always recommend. So what?
>As the OP pointed out (see quote above), the result of 'time-10*60*60'
>is a scalar, so is there any reason why an array would be used in such a
>place? It seems pointless to me, but I admit there could be some
Yes, the alternative would have been:
my $since=time-10*60*60;
my @arts;
which takes more typing, more vertical space, one more statement and
doesn't give any more readability.
>instances my little test doesn't reveal (different result from time() on
>another platform is the only thing that comes to mind, although I'd
>doubt that.)
Nah, no such big issues. Just a tiny personal preference.
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: Mon, 23 Jul 2007 12:42:06 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: @arts
Message-Id: <4f19a3pm0lmgrituj5oojl6nt3bt0borc7@4ax.com>
On Mon, 23 Jul 2007 02:28:31 GMT, "John W. Krahn" <dummy@example.com>
wrote:
>> undef in that usage is still a function, but you're only using its
>> return value, which is actually its most common use, at first sight.
>
>In the example above the return value of undef is *not* being used. In that
>example undef is used as a "place holder" and it receives one of the values in
>the list (and discards it.)
Yes, you're perfectly right: let's call it an extra bit of syntactic
sugar!
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: Mon, 23 Jul 2007 12:46:39 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: @arts
Message-Id: <hi19a3hm3ka1iifije2922uqm9bu5vpi7l@4ax.com>
On Sun, 22 Jul 2007 22:49:02 -0700, "Wade Ward" <zaxfuuq@invalid.net>
wrote:
>...and it's a good notation if you want a newcomer to follow your source
>script. He could have just as easily written:
>my ($errno2, $first, $last, $debug1)=$nntp->group($grp);
>and been, I believe, semantically correct.
No point in declaring variables you won't be using. But definitely I
would have chosen more descriptive name. $errno2 and $debug1 are
certainly confusing...
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: Mon, 23 Jul 2007 11:10:25 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: [OT] misc (was: Re: @arts)
Message-Id: <f822e4.1g0.1@news.isolution.nl>
Wade Ward <zaxfuuq(AT)invalid.net> schreef:
If I assume correctly, and you didn't ask Katie for consent, you are
abusing invalid.net.
Read RFC 2606, there is a link on http://www.example.com/
> John W. Krahn:
>> In the example above the return value of undef is *not* being used.
>> In that example undef is used as a "place holder" and it receives
>> one of the values in the list (and discards it.)
> ...and it's a good notation if you want a newcomer to follow your
> source script. He could have just as easily written:
> my ($errno2, $first, $last, $debug1)=$nntp->group($grp);
> and been, I believe, semantically correct.
Whitespace is cheap. Best put a blank line between the old text and your
reply.
And around the "=". A nice article by Abigail on this:
http://perl.abigail.be/Musings/coding_guidelines.html
All small investments, expect high returns.
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Mon, 23 Jul 2007 13:10:34 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: [OT] misc (was: Re: @arts)
Message-Id: <6039a3hpbie59c80542ti6qs1on15jju2f@4ax.com>
On Mon, 23 Jul 2007 11:10:25 +0200, "Dr.Ruud"
<rvtol+news@isolution.nl> wrote:
>> source script. He could have just as easily written:
>> my ($errno2, $first, $last, $debug1)=$nntp->group($grp);
>> and been, I believe, semantically correct.
>
>Whitespace is cheap. Best put a blank line between the old text and your
>reply.
No, to be honest, that's me! I must say I mostly follow the style
guidelines of perlstyle: not that I've read them and chosen to stick
with them, just out of sense. Yet, in some respects I deviate from
them, which is the case with horizontal space, e.g. below some commas
or around some assignments: but it depends on how readable I find them
to be...
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: Mon, 23 Jul 2007 08:15:17 GMT
From: "a" <a@mail.com>
Subject: append arrays
Message-Id: <psZoi.139158$NV3.137781@pd7urf2no>
Hi
I have 2 arrays containing strings , @ary1 and @ary2. How can I append ary2
to ary1?
Thanks
------------------------------
Date: Mon, 23 Jul 2007 10:17:45 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: append arrays
Message-Id: <5gj6niF3gha03U1@mid.individual.net>
a wrote:
> I have 2 arrays containing strings , @ary1 and @ary2. How can I append ary2
> to ary1?
perldoc -f push
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Mon, 23 Jul 2007 11:03:16 +0100
From: Ian Wilson <scobloke2@infotop.co.uk>
Subject: Re: append arrays
Message-Id: <46a47ce8$0$15857$fa0fcedb@news.zen.co.uk>
a wrote:
> I have 2 arrays containing strings , @ary1 and @ary2. How can I append ary2
> to ary1?
>
perl -e '@p=qw(a b c);@q=qw(d e f);push @p,@q;print "@p\n"'
------------------------------
Date: Mon, 23 Jul 2007 06:53:59 +0000 (UTC)
From: pacman@TheWorld.com (Alan Curry)
Subject: Re: funky TCP problems
Message-Id: <f81ja7$8ha$1@pcls6.std.com>
In article <1185145624.206414.244940@d30g2000prg.googlegroups.com>,
grocery_stocker <cdalten@gmail.com> wrote:
>
>However, what I really want to see is
>Trying 137.104.128.2...
>Connected to uwplatt.edu (137.104.128.2).
>Escape character is '^]'.
The above three lines would normally be printed by the telnet client reporting
on its progress. If you're trying to make a perl script that behaves exactly
like /usr/bin/telnet, you'll have to print those lines yourself. (Not to
mention the actual handling of the ^] escape)
>
> What's my error in logic?
The basic error is thinking that telnet is a raw TCP stream. It's not. When
you connect to the telnet server, the first few bytes you get are telnet
option negotiation. See RFC854 for the specification, and the Net::Telnet
module for a perly way to deal with that option negoation.
People often use the telnet client to speak to non-telnet servers like FTP or
SMTP, which works because the client doesn't attempt any option negotiation
unless you ask it to. Even here, though, it's not acting as a raw TCP
pass-through. It's adding carriage returns (which happens to be the right
thing for FTP and SMTP and several others) and mangling 0xFF bytes.
--
Alan Curry
pacman@world.std.com
------------------------------
Date: Sun, 22 Jul 2007 23:30:20 -0700
From: sow <sow@sow.org.pl>
Subject: Re: In deep complex XML
Message-Id: <1185172220.954408.196470@22g2000hsm.googlegroups.com>
yes mabye I lost bracket due to shorten xml tree if somebody know well
XML::Simple I'll sent original xml, I didn't want put the original
because it was very long
------------------------------
Date: Mon, 23 Jul 2007 13:53:35 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: Math
Message-Id: <46a42641$0$7087$afc38c87@news.optusnet.com.au>
"Ilya Zakharevich" <nospam-abuse@ilyaz.org> wrote in message
news:f807p7$2p1p$1@agate.berkeley.edu...
.
.
> So if your handling of numbers involves
> converting them to strings, then back, the precision will be lost.
>
It seems to me that you're saying that the following script will output
"Precision lost" (for some numeric value of $num, at least):
--------------------------
use warnings;
use strict;
my $num = 1.237e-6;
my $str = "$num";
if($num == $str) {print "Precision preserved\n"}
else {print "Precision lost\n"}
--------------------------
Do you have an example of such a value for $num ?
Cheers,
Rob
------------------------------
Date: Mon, 23 Jul 2007 04:51:13 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Math
Message-Id: <5tWoi.423$zJ4.143@trndny03>
Sisyphus wrote:
> "Ilya Zakharevich" <nospam-abuse@ilyaz.org> wrote in message
>> So if your handling of numbers involves
>> converting them to strings, then back, the precision will be lost.
>
> It seems to me that you're saying that the following script will
> output "Precision lost" (for some numeric value of $num, at least):
>
> --------------------------
> my $num = 1.237e-6;
> my $str = "$num";
>
> if($num == $str) {print "Precision preserved\n"}
> else {print "Precision lost\n"}
> --------------------------
>
> Do you have an example of such a value for $num ?
Oldest suspect in the world:
my $num = 1/3;
and the program above will print
Precision lost
jue
------------------------------
Date: Mon, 23 Jul 2007 15:26:56 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: Math
Message-Id: <46a43c21$0$15142$afc38c87@news.optusnet.com.au>
"Jürgen Exner" <jurgenex@hotmail.com> wrote in message
news:5tWoi.423$zJ4.143@trndny03...
.
.
>> It seems to me that you're saying that the following script will
>> output "Precision lost" (for some numeric value of $num, at least):
>>
>> --------------------------
>> my $num = 1.237e-6;
>> my $str = "$num";
>>
>> if($num == $str) {print "Precision preserved\n"}
>> else {print "Precision lost\n"}
>> --------------------------
>>
>> Do you have an example of such a value for $num ?
>
> Oldest suspect in the world:
> my $num = 1/3;
> and the program above will print
> Precision lost
>
Aaah, yes ... I understand. Thanks, jue.
Cheers,
Rob
------------------------------
Date: Mon, 23 Jul 2007 04:42:23 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Mon Jul 23 2007
Message-Id: <JLM7qn.AB7@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.
Apache2-Translation-0.17
http://search.cpan.org/~opi/Apache2-Translation-0.17/
Configuring Apache dynamically
----
Bundle-CPAN-1.856
http://search.cpan.org/~andk/Bundle-CPAN-1.856/
Bundle to optimize the behaviour of CPAN.pm
----
Catalyst-View-Mason-0.10
http://search.cpan.org/~flora/Catalyst-View-Mason-0.10/
Mason View Class
----
Catalyst-View-Mason-0.11
http://search.cpan.org/~flora/Catalyst-View-Mason-0.11/
Mason View Class
----
Graph-Convert-0.07
http://search.cpan.org/~tels/Graph-Convert-0.07/
Convert between graph formats: Graph and Graph::Easy
----
Graph-Easy-0.56
http://search.cpan.org/~tels/Graph-Easy-0.56/
Render graphs as ASCII, HTML, SVG or via Graphviz
----
HTML-DOM-0.004
http://search.cpan.org/~sprout/HTML-DOM-0.004/
A Perl implementation of the HTML Document Object Model
----
JE-0.016
http://search.cpan.org/~sprout/JE-0.016/
Pure-Perl ECMAScript (JavaScript) Engine
----
Lemonldap-NG-Handler-0.83
http://search.cpan.org/~guimard/Lemonldap-NG-Handler-0.83/
The Apache protection module part of Lemonldap::NG Web-SSO system.
----
Lemonldap-NG-Manager-0.82
http://search.cpan.org/~guimard/Lemonldap-NG-Manager-0.82/
Perl extension for managing Lemonldap::NG Web-SSO system.
----
Lemonldap-NG-Portal-0.76
http://search.cpan.org/~guimard/Lemonldap-NG-Portal-0.76/
The authentication portal part of Lemonldap::NG Web-SSO system.
----
Mail-DWIM-0.02
http://search.cpan.org/~mschilli/Mail-DWIM-0.02/
Do-What-I-Mean Mailer
----
Module-MultiConf-0.0100_06
http://search.cpan.org/~oliver/Module-MultiConf-0.0100_06/
Configure and validate your app modules in one go
----
Module-ThirdParty-0.20
http://search.cpan.org/~saper/Module-ThirdParty-0.20/
Provide information for 3rd party modules (outside CPAN)
----
Module-ThirdParty-0.21
http://search.cpan.org/~saper/Module-ThirdParty-0.21/
Provide information for 3rd party modules (outside CPAN)
----
Parse-IRC-1.04
http://search.cpan.org/~bingos/Parse-IRC-1.04/
A parser for the IRC protocol.
----
PerlIO-via-ANSIColor-0.03
http://search.cpan.org/~masanorih/PerlIO-via-ANSIColor-0.03/
PerlIO layer for Term::ANSIColor
----
RPM4-0.23
http://search.cpan.org/~nanardon/RPM4-0.23/
perl module to access and manipulate RPM files
----
SMS-Send-US-TMobile-v0.0.1
http://search.cpan.org/~dmuey/SMS-Send-US-TMobile-v0.0.1/
SMS::Send driver for the wmg.tmomail.net website
----
UID-0.20
http://search.cpan.org/~plato/UID-0.20/
----
WWW-Ebay-0.082
http://search.cpan.org/~mthurn/WWW-Ebay-0.082/
----
XML-Atom-Service-0.13.2
http://search.cpan.org/~takeru/XML-Atom-Service-0.13.2/
Atom Service Document object
----
XML-Atom-Service-0.13.3
http://search.cpan.org/~takeru/XML-Atom-Service-0.13.3/
Atom Service Document object
----
XML-TreePP-0.20
http://search.cpan.org/~kawasaki/XML-TreePP-0.20/
Pure Perl implementation for parsing/writing xml files
----
reslog-3.11
http://search.cpan.org/~imacat/reslog-3.11/
Reverse-resolve IP in Apache log files
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: Mon, 23 Jul 2007 03:16:17 -0700
From: sow <sow@sow.org.pl>
Subject: perl IRC
Message-Id: <1185185777.222535.193870@o61g2000hsh.googlegroups.com>
Hi
Who knows any IRC servers and chanels for help with perl scripts and
exactly XML::Simle, I have serious problem but I'm not a programist,
but I think that for professionals it will be very simle
------------------------------
Date: Mon, 23 Jul 2007 09:15:19 +0200
From: Mirco Wahab <wahab@chemie.uni-halle.de>
Subject: Re: regexp as function?
Message-Id: <f81ki6$1vgn$1@nserver.hrz.tu-freiberg.de>
Petr Vileta wrote:
> I want to know how to write regexp as "function" as this is possible in
> PHP where I can to write
> my $a = '10,12,2007';
> $b = preg_replace( 's/,/./' , $a);
> Any ideas or comments are welcomed ;-)
First naíve hack (can be improved ;-) ==>
...
sub preg_replace {
my ($reg, $op) = @_;
eval "\$op=~s$reg";
return $op;
}
my $a = '10,12,2007';
$b = preg_replace( '/,/./g' , $a);
print $b;
...
Regards
M.
------------------------------
Date: Mon, 23 Jul 2007 10:40:53 +0200
From: papahuhn <papahuhn@gmx.net>
Subject: Re: regexp as function?
Message-Id: <5gj7snF3h2s1gU1@mid.dfncis.de>
Why eval?
Mirco Wahab schrieb:
> sub preg_replace {
> my ($reg, $op) = @_;
> eval "\$op=~s$reg";
> return $op;
> }
------------------------------
Date: Mon, 23 Jul 2007 03:03:03 -0700
From: sukovic@gmail.com
Subject: Small script on OpenBSD
Message-Id: <1185184983.893036.220800@k79g2000hse.googlegroups.com>
Hi,
This script works on Linux, but on OpenBSD there is no /proc/net/dev,
any tip how to solve this?
Thanks.
----------------------------
#!/usr/bin/perl
use strict;
my $if = $ARGV[0] || mrtg_die();
open(F, "</proc/net/dev") || mrtg_die();
my @LINES = <F>;
close(F);
foreach (grep(/\s+$if\:/, @LINES)) {
/\s+$if\:(\s*\d*){1}/;
my $recv = $1;
$recv =~ s/\s+//g;
/\s+$if\:(\s*\d*){9}/;
my $sent = $1;
$sent =~ s/\s+//g;
print "$recv\n$sent\n0\n0\n";
}
sub mrtg_die() {
print "0\n0\n0\n0\n";
}
------------------------------
Date: 23 Jul 2007 11:48:18 GMT
From: jt@toerring.de (Jens Thoms Toerring)
Subject: Re: Small script on OpenBSD
Message-Id: <5gjis2F3g166pU1@mid.uni-berlin.de>
sukovic@gmail.com wrote:
> This script works on Linux, but on OpenBSD there is no /proc/net/dev,
> any tip how to solve this?
> #!/usr/bin/perl
> use strict;
> my $if = $ARGV[0] || mrtg_die();
> open(F, "</proc/net/dev") || mrtg_die();
> my @LINES = <F>;
> close(F);
> foreach (grep(/\s+$if\:/, @LINES)) {
> /\s+$if\:(\s*\d*){1}/;
> my $recv = $1;
> $recv =~ s/\s+//g;
> /\s+$if\:(\s*\d*){9}/;
> my $sent = $1;
> $sent =~ s/\s+//g;
> print "$recv\n$sent\n0\n0\n";
> }
> sub mrtg_die() {
> print "0\n0\n0\n0\n";
> }
Since you only seem to be inteested in the number of received and
transmitted bytes I guess you can get the same information (and in
a more system-independent way) from the output of 'ifconfig':
#!/usr/bin/perl
use strict;
use warnings;
my $found = 0;
my $if = $ARGV[ 0 ] or die "Missing argument\n";
open my $f, "/sbin/ifconfig $if 2>/dev/null|" or die "Can't run ifconfig\n"
while ( <$f> ) {
next unless /^\s*RX bytes\s*:\s*(\d+).*?TX bytes\s*:\s*(\d+)/;
print "$1\n$2\n";
$found = 1;
}
close $f;
die "Invalid interface: $if\n" unless $found;
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
------------------------------
Date: Mon, 23 Jul 2007 11:18:46 GMT
From: "Nospam" <nospam@home.com>
Subject: Re: wors on active perl but not on unix
Message-Id: <q80pi.689$mZ5.139@newsfe6-win.ntli.net>
Line:
='http://news.google.co.uk/search?q=~%22'.$keywords.'&num=100&hl=en&safe=off
does say
='http://news.google.co.uk/search?q=~%22'.$keywords.'%22&num=100&hl=en&safe=
off
"Nospam" <nospam@home.com> wrote in message
news:QzRoi.652$mZ5.474@newsfe6-win.ntli.net...
> #!/usr/bin/perl
>
> use strict;
> use warnings;
> use Data::Dumper;
> use WWW::Mechanize;
>
>
> my $total_count = 0;
>
> my @keywords = ('simpsons',
> 'diehard',
> 'fantastic+four',
> );
>
> foreach my $keywords(@keywords){
> my $url
>
='http://news.google.co.uk/search?q=~%22'.$keywords.'&num=100&hl=en&safe=off
> &start=0&as_qdr=all&filter=0';
>
>
>
> my $mech = WWW::Mechanize->new();
>
>
> $mech->get($url);
> print $mech->uri."\n";
> my @links_to_check = grep { $_->url() !~ /google/i}
> $mech->find_all_links( url_regex => qr/\./i );
>
>
>
>
>
> foreach my $links_to_check (@links_to_check)
> {
> $total_count++;
> print "$links_to_check \n";
>
> }
>
> }
>
> print " $total_count news items found \n";
>
>
> On activeperl I get approx 894 results, while on a server, I get 0 results
>
>
>
------------------------------
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 673
**************************************