[23334] in Perl-Users-Digest
Perl-Users Digest, Issue: 5554 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 24 11:05:53 2003
Date: Wed, 24 Sep 2003 08:05:15 -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 Wed, 24 Sep 2003 Volume: 10 Number: 5554
Today's topics:
Re: add half an hour to all times in file <tore@aursand.no>
Re: add half an hour to all times in file <spamfilter@cheiron-it.nl>
Baffled newbie SNMP script (Steve The Geek)
Re: class methods <tore@aursand.no>
Re: cron/http absolute directories (Helgi Briem)
Re: cron/http absolute directories <notavailable@nospamplease.com>
Re: cron/http absolute directories (Anno Siegel)
Re: cron/http absolute directories <no.name@eidosnet.co.uk>
Re: cron/http absolute directories (Anno Siegel)
Re: cron/http absolute directories <no.name@eidosnet.co.uk>
Re: cron/http absolute directories <jurgenex@hotmail.com>
Re: different encoding datastream; if using different ( <udo@lipsia.de>
Docu (Valentin Welter)
Re: Docu <nospam@bigpond.com>
Fetching ActiveState PPD files without Installing them (John Ramsden)
Re: fixed width fields <raisin@delete-this-trash.mts.net>
Re: Found a way to write modules without package, expor <pilsl_usenet@goldfisch.at>
Re: How do I pass a value to a PERL script from an <a h <raisin@delete-this-trash.mts.net>
new to perl (mani)
new to perl (mani)
Re: new to perl <usenet@NOSPAM.matthewb.org>
Q: File contents substitution <abuse@microsoft.com>
Re: Q: File contents substitution (Anno Siegel)
Re: Q: File contents substitution <abuse@microsoft.com>
Re: RegExp: Matching <raisin@delete-this-trash.mts.net>
Setting Win32 priority from within a process <jeanc@cae.ca>
Split variable into fields ? <michael.benton@adpcl.co.uk>
Re: Split variable into fields ? <ak+usenet@freeshell.org>
Re: string length? <dave.nospam@ntlworld.com>
Re: string length? (Helgi Briem)
Re: Stupid perl regexp question <raisin@delete-this-trash.mts.net>
Re: Trouble with 0 <tore@aursand.no>
Re: Using variables in RegEx statements? <raisin@delete-this-trash.mts.net>
Re: What is the Simplest way to move Subs to Modules? (Helgi Briem)
Re: <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 24 Sep 2003 12:14:40 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: add half an hour to all times in file
Message-Id: <pan.2003.09.24.09.35.11.494499@aursand.no>
On Wed, 24 Sep 2003 12:56:18 +0800, Dan Jacobson wrote:
> Maybe perldoc Date::Parse has something to do with this.
Indeed. What went wrong when you tried to use it?
--
Tore Aursand <tore@aursand.no>
"You know the world is going crazy when the best rapper is white, the best
golfer is black, France is accusing US of arrogance and Germany doesn't
want to go to war."
------------------------------
Date: Wed, 24 Sep 2003 13:44:12 +0200
From: "Frank Maas" <spamfilter@cheiron-it.nl>
Subject: Re: add half an hour to all times in file
Message-Id: <3f71838d$0$132$e4fe514c@dreader4.news.xs4all.nl>
"Dan Jacobson" <jidanni@jidanni.org> schreef in bericht
news:87brtazswd.fsf@jidanni.org...
> $ cat file
> 18:25
> 18:56
> $ perl -wlpe 'Please tell me what to write here to get the following' file
> 18:55
> 19:26
perl -wlpe 'my ($h,$m)=split(/:/); my $t=($h*60)+$m+30; $h=int($t/60)%24;
$m=$t%60; $_=sprintf "%02d:%02d",$h,$m;'
--Frank
------------------------------
Date: 24 Sep 2003 06:11:52 -0700
From: slkleine@hotmail.com (Steve The Geek)
Subject: Baffled newbie SNMP script
Message-Id: <863f122c.0309240511.48b8948d@posting.google.com>
I grabbed SNMP_Session-0.98 and well, wow. :-)
What I'm trying to do is read an iplist from file and set the time on
the devices using the snmpset subroutine. The module compiles, but
terminates with error **Undefined subroutine &main::snmpset called at
Set-time-all.pl line 31, <IPLIST> line 139.**
I'm reasonably sure the script is bombing due to the <IPLIST> file
EOF, only because I can change the error line from 139 by adding (or
removing) blank entries from the file $IPLIST.
Any ideas, other than get the O'Reilly book and study?
TIA
Steve the (newbie to Perl) Geek
<begin script paste>
######################################
## Initialize
######################################
require 5.002;
use strict;
use SNMP_Session;
use BER;
my ($community, $oid, $IPLIST, @IPLIST_DATA, $host, $response);
$community = 'public', $oid = '1.3.6.1.4.1.52.4.3.3.1.1.0', $IPLIST =
'H:/CT_HW_IP.txt';
######################################
## Open file with IP list for all
## Cabletron/Enterasys devices
######################################
my $IPLIST = 'H:/CT_HW_IP.txt';
open ( IPLIST, $IPLIST) or die "Unable to open $IPLIST \n";
@IPLIST_DATA = <IPLIST>;
##########################
###### NOTE: script bails at this point with
##Undefined subroutine &main::snmpset called at
C:\DOCUME~1\TA3SXK~1.TAL\Desktop\SNMP_S~1.98\test\SET-TI~1.PL line 34,
<IPLIST> line 139.
####################
foreach $host (@IPLIST_DATA)
{
$response = &snmpset($host, $community, $oid, 'string', '084800');
}
close(IPLIST);
exit;
<end script paste>
------------------------------
Date: Wed, 24 Sep 2003 12:14:41 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: class methods
Message-Id: <pan.2003.09.24.03.04.43.680748@aursand.no>
On Tue, 23 Sep 2003 22:53:50 +0200, Matija Papec wrote:
> I have situation where /class method/ can be called inside and outside of
> package so I have to know when to throw away the first argument.
What do you mean, actually? Do you want to call the call a method's class
as a function, as in 'MyClass->Foo()'?
Seems like bad behaviour in my eyes, but then again I've never used
anything else than this syntax:
my $MyObject = MyClass->new();
$MyObject->foo();
Inside MyClass there's magic hand waving (well, not reall);
sub foo {
my $self = shift;
$self->bar();
}
sub bar {
my $self = shift;
# dada
}
Am I out of scope here? :-)
--
Tore Aursand <tore@aursand.no>
"You know the world is going crazy when the best rapper is white, the best
golfer is black, France is accusing US of arrogance and Germany doesn't
want to go to war."
------------------------------
Date: Wed, 24 Sep 2003 10:22:39 GMT
From: f_baggins80@hotmail.com (Helgi Briem)
Subject: Re: cron/http absolute directories
Message-Id: <3f717038.757062788@News.CIS.DFN.DE>
On Wed, 24 Sep 2003 02:23:46 +0100, "D Borland"
<notavailable@nospamplease.com> wrote:
>Not 100% sure if this is correct, but someone will soon
>correct me if it's not i'm sure :)
I don't know about that, but you've been warned
several times about top-posting.
Enough is enough. Into the killfile you go.
*PLONK*
--
Helgi Briem hbriem AT simnet DOT is
Excuse the munged address. My last
e-mail address was killed by spammers.
------------------------------
Date: Wed, 24 Sep 2003 12:23:37 +0100
From: "D Borland" <notavailable@nospamplease.com>
Subject: Re: cron/http absolute directories
Message-Id: <T8fcb.172$zF1.83@newsfep3-gui.server.ntli.net>
I hope that idiot isn't Helgi isn't talking about me top-posting, there's
absolutely nothing wrong with the threads in this post - I can only assume
that this person is a sad-basta$d.
I've done nothing wrong except to reply to a post in the usual manner, so
omeone asks i qustion the post appears in the newsgroup and i reply, simple
i would have though, but obviously some of us don't like people's post
getting their before less and are seeming to act spiteful through their
jealousy for some reason, i don't know why i really couldn't care less is my
posts are always the last in the thread, or second third or first, it
doesn't matter.
Well that's my 2-cents in your face! Now i'll leave you to carry on your
pathetic exsitence you try to call a life.
Dagmar
"Helgi Briem" <f_baggins80@hotmail.com> wrote in message
news:3f717038.757062788@News.CIS.DFN.DE...
> On Wed, 24 Sep 2003 02:23:46 +0100, "D Borland"
> <notavailable@nospamplease.com> wrote:
>
> >Not 100% sure if this is correct, but someone will soon
> >correct me if it's not i'm sure :)
>
> I don't know about that, but you've been warned
> several times about top-posting.
>
> Enough is enough. Into the killfile you go.
>
> *PLONK*
> --
> Helgi Briem hbriem AT simnet DOT is
>
> Excuse the munged address. My last
> e-mail address was killed by spammers.
------------------------------
Date: 24 Sep 2003 11:52:19 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: cron/http absolute directories
Message-Id: <bks0hj$d3j$1@mamenchi.zrz.TU-Berlin.DE>
D Borland <notavailable@nospamplease.com> wrote in comp.lang.perl.misc:
> I hope that idiot isn't Helgi isn't talking about me top-posting,
He is, but top-posting isn't what you think it is.
> there's
> absolutely nothing wrong with the threads in this post - I can only assume
> that this person is a sad-basta$d.
>
> I've done nothing wrong except to reply to a post in the usual manner, so
> omeone asks i qustion the post appears in the newsgroup and i reply, simple
> i would have though, but obviously some of us don't like people's post
> getting their before less and are seeming to act spiteful through their
> jealousy for some reason, i don't know why i really couldn't care less is my
> posts are always the last in the thread, or second third or first, it
> doesn't matter.
No, you misunderstand. "Top posting" has nothing to do with the placement
of your posts in a thread. It means placing your reply on top of the
one you are replying to, instead of interleaving your comments after
what you are commenting on. You have been doing this (top-posting) from
day one in this group, and people are trying to tell you it's considered
rude. See the posting guidelines for this group, they are posted regularly.
Anno
[TOFU snipped]
------------------------------
Date: Wed, 24 Sep 2003 13:32:13 +0000 (UTC)
From: "D Borland" <no.name@eidosnet.co.uk>
Subject: Re: cron/http absolute directories
Message-Id: <bks6ct$dmt$1@hercules.btinternet.com>
but i was the first person to reply to him and several others, so mine is
the first reply which means it is going to be the first (top) reply to
someones post. I really don't get this? I do reply to the actual post that
i am reffering to, example...
"i need help" # first post
+ "i need help" # reply to first post
+ "here yours answer" # reply to first post
+ "no you do" # reply to 'heres your answer'
+ "i can help you" # reply to first post
Ok, so it aint a great picutre, but that's they way i belive newsgroup
posting goes! If not show me what's wrong with the above.
Dagmar
"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:bks0hj$d3j$1@mamenchi.zrz.TU-Berlin.DE...
> D Borland <notavailable@nospamplease.com> wrote in comp.lang.perl.misc:
> > I hope that idiot isn't Helgi isn't talking about me top-posting,
>
> He is, but top-posting isn't what you think it is.
>
> >
there's
> > absolutely nothing wrong with the threads in this post - I can only
assume
> > that this person is a sad-basta$d.
> >
> > I've done nothing wrong except to reply to a post in the usual manner,
so
> > omeone asks i qustion the post appears in the newsgroup and i reply,
simple
> > i would have though, but obviously some of us don't like people's post
> > getting their before less and are seeming to act spiteful through their
> > jealousy for some reason, i don't know why i really couldn't care less
is my
> > posts are always the last in the thread, or second third or first, it
> > doesn't matter.
>
> No, you misunderstand. "Top posting" has nothing to do with the placement
> of your posts in a thread. It means placing your reply on top of the
> one you are replying to, instead of interleaving your comments after
> what you are commenting on. You have been doing this (top-posting) from
> day one in this group, and people are trying to tell you it's considered
> rude. See the posting guidelines for this group, they are posted
regularly.
>
> Anno
>
> [TOFU snipped]
---
This e-mail has been virus scanned and is certified virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.518 / Virus Database: 316 - Release Date: 9/11/03
------------------------------
Date: 24 Sep 2003 13:53:15 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: cron/http absolute directories
Message-Id: <bks7kb$fqs$1@mamenchi.zrz.TU-Berlin.DE>
D Borland <no.name@eidosnet.co.uk> wrote in comp.lang.perl.misc:
> but i was the first person to reply to him and several others, so mine is
> the first reply which means it is going to be the first (top) reply to
> someones post. I really don't get this? I do reply to the actual post that
> i am reffering to, example...
>
> "i need help" # first post
> + "i need help" # reply to first post
> + "here yours answer" # reply to first post
> + "no you do" # reply to 'heres your answer'
> + "i can help you" # reply to first post
>
> Ok, so it aint a great picutre, but that's they way i belive newsgroup
> posting goes! If not show me what's wrong with the above.
I'm not sure what the above lines are supposed to demonstrate.
The problem is that you are placing your reply *above* the quoted
text you are replying to. Please do read the posting guidelines that
are posted regularly here. Excerpt:
Use an effective followup style
...
Intersperse your comments *following* each section of quoted text to
which they relate. Unappreciated followup styles are referred to as
"Jeopardy" (because the answer comes before the question), or
"TOFU".
That's what we're kvetching about.
Anno
[more TOFU snipped]
------------------------------
Date: Wed, 24 Sep 2003 14:13:59 +0000 (UTC)
From: "D Borland" <no.name@eidosnet.co.uk>
Subject: Re: cron/http absolute directories
Message-Id: <bks8r7$h7h$1@hercules.btinternet.com>
Well i cannot see anything wrong with my posting, it's never been moaned
about before in the 14 years i've been on the internet - So frankly i don't
care anymore, put me in your killfile if you want, as i think that anyone
who is childish enough to react like that over something so trivial is
pathetic so i don't think your replies would be of any use to me anyhow.
That and the fact i can't see anything wrong with the way i post, it's the
same as everyone else, everywhere else. But then again you alsways do have
the 'spoilt kid or the lick' trying to spoil anything anyone ever does.
Some people should have never been givin the right to life.
Well, like i said above i'll post the way i want - You don't like, so what!
Dagmar
"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:bks7kb$fqs$1@mamenchi.zrz.TU-Berlin.DE...
> D Borland <no.name@eidosnet.co.uk> wrote in comp.lang.perl.misc:
> > but i was the first person to reply to him and several others, so mine
is
> > the first reply which means it is going to be the first (top) reply to
> > someones post. I really don't get this? I do reply to the actual post
that
> > i am reffering to, example...
> >
> > "i need help" # first post
> > + "i need help" # reply to first post
> > + "here yours answer" # reply to first post
> > + "no you do" # reply to 'heres your answer'
> > + "i can help you" # reply to first post
> >
> > Ok, so it aint a great picutre, but that's they way i belive newsgroup
> > posting goes! If not show me what's wrong with the above.
>
> I'm not sure what the above lines are supposed to demonstrate.
>
> The problem is that you are placing your reply *above* the quoted
> text you are replying to. Please do read the posting guidelines that
> are posted regularly here. Excerpt:
>
> Use an effective followup style
>
> ...
>
> Intersperse your comments *following* each section of quoted text
to
> which they relate. Unappreciated followup styles are referred to
as
> "Jeopardy" (because the answer comes before the question), or
> "TOFU".
>
> That's what we're kvetching about.
>
> Anno
>
> [more TOFU snipped]
---
This e-mail has been virus scanned and is certified virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.518 / Virus Database: 316 - Release Date: 9/11/03
------------------------------
Date: Wed, 24 Sep 2003 14:16:54 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: cron/http absolute directories
Message-Id: <qHhcb.2334$FH3.1512@nwrddc02.gnilink.net>
D Borland wrote:
[...]
> Well, like i said above i'll post the way i want - You don't like, so
> what!
Your choice, ***PLONK***
------------------------------
Date: Wed, 24 Sep 2003 15:54:14 +0200
From: udoline <udo@lipsia.de>
Subject: Re: different encoding datastream; if using different (file/socket) descriptoren
Message-Id: <bks7m6$5bvs7$2@ID-26126.news.uni-berlin.de>
Additional Comment #2 From udoline [on devel mode =:- D ] 2003-09-24 15:48
bei expilziter verwendung der kombinationen von:
# pragma
no encoding;
use Encode;
use DBI;
# use powercash21; # =8-) oder so
# im zusammenspiel mit
my $dbh = DBI->connect( ... );
# n e u hier
# prepare utf8 default encoding for this string is set to off
# perldoc Encode
Encode::_utf8_on( $sql_stmt );
# prepare sql-stmt
my $sth = $dbh->prepare( $sql_stmt );
funktioniert es vorlaeufig.
maybe WONT FIX
udoline wrote:
> hello all,
>
> precondition:
> * linux redhat 9.0
> * perl, v5.8.0
>
> strange problem:
> different process handling between encoding the data stream in the
> file-descriptor and in the socket-descriptor (connecton via sybase-driver)
> in perl ?
>
> if I run my program with pragma "encoding" then I will got different
> encoding datas between SOCKET and STDOUT
>
> eg:
> perl -Mencoding="iso 8859-1" -I lib/modules -I.
> ~/devel/test_unicode/perl/test_unicode_dbconnection.pl
>
> # output to STDOUT (file-descriptor) OK
> test db connection (user=siteadmin)... successfull.
> INSERT INTO test VALUES( '[0] ä ö ü ß Ä Ö Ü', '[0] Ä Ö Ü ß ä ö ü' )
> [0]
>
>
> # output to SOCKET (socket-descriptor) FALSE
> sql statment select ... ERROR not my inserted values found
> [0] result from sybase-DB:
> col. key1 =<<[0] Ã? ö Ã? Ã
> Ã Ã>>
> [0] result from sybase-DB:
> col. value=<<[0] Ã
> Ã Ã Ã
>
> what can I do ?
> please help, ThanX.
> --
> v.g.,
> udoline alias udo@lipsia.de
--
--
v.g.,
udoline
------------------------------
Date: 24 Sep 2003 04:42:38 -0700
From: valentin.welter@t-online.de (Valentin Welter)
Subject: Docu
Message-Id: <7f0ff6a5.0309240342.126198fc@posting.google.com>
Hi,
I am looking for a tutorial or Perl docu,which also has a Glossary and
terms, items index.
Thank you in advance
Valentin
------------------------------
Date: Wed, 24 Sep 2003 21:47:28 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: Docu
Message-Id: <2136040.SPSyUDGOBc@gregs-web-hosting-and-pickle-farming>
It was a dark and stormy night, and Valentin Welter managed to scribble:
> Hi,
>
> I am looking for a tutorial or Perl docu,which also has a Glossary and
> terms, items index.
>
> Thank you in advance
>
> Valentin
Try www.perldoc.com and www.rexswain.com/perl5.html
gtoomey
------------------------------
Date: 24 Sep 2003 06:50:23 -0700
From: john_ramsden@sagitta-ps.com (John Ramsden)
Subject: Fetching ActiveState PPD files without Installing them
Message-Id: <d27434e.0309240550.13fa55a6@posting.google.com>
I am testing a Perl app on a lab system which has no link
to the Internet, and I need to install an ActiveState perl
module, Net::DNS.
Is there a way to use ppm, or ppm3, or _any_ way to simply
retrieve the ppd file from whichever repository a normal
'install' would have obtained it, so I can copy this via
our intranet on to the lab system and install it 'locally'
by typing 'ppm install Net-DNS.ppd'.
(I'm sure I asked this on c.l.p.m a few months ago, and not
one person replied; but may have been another question, and
anyway I guess there's no harm trying again.)
P.S. Please spare me any answers along the lines of 'set up
a routing config so the lab system can see the outside world',
as these will be useless: I also need to be able to get hold
of the PPDs to assemble a self-contained installation kit of
the software for use at at customer sites.
Thanks in anticipation.
Cheers
John R Ramsden (john`rm -rf *`_ramsden.sagitta-ps.com)
(remove spambot trap before replying)
------------------------------
Date: Wed, 24 Sep 2003 09:10:01 -0500
From: Barry Kimelman <raisin@delete-this-trash.mts.net>
Subject: Re: fixed width fields
Message-Id: <MPG.19db61b59c44489798968e@news.mts.net>
[This followup was posted to comp.lang.perl.misc]
In article <b15b026d.0309220736.571cbaae@posting.google.com>, jg_x30
@iwon.com says...
> This should be an easy one but I'm having a brain cramp.
>
> I have a string: 2-s1.0-49FR-WSJ0-TWC1-XXXX-12345-00. I want to
> replace the 12345 with $i. When $i equals "1" how can I make it
> "00001"?
>
$data = sprintf "%05d",$i;
------------------------------
Date: Wed, 24 Sep 2003 12:39:39 +0200
From: peter pilsl <pilsl_usenet@goldfisch.at>
Subject: Re: Found a way to write modules without package, export
Message-Id: <3f71753f$1@e-post.inode.at>
Great Deals wrote:
>
> Isn't that great? Why would people even use package/export?
>
modules grant you some kind of privacy for the code you put into this
module. You can easily split up big projects into several modules without
having to fear namespace-collisions. This will get even more important if
you want to offer your module to various applications/authors and use
OO-approaches.
You just split your code into several files, but dont split the underlying
structure.
peter
--
peter pilsl
pilsl_usenet@goldfisch.at
http://www.goldfisch.at
------------------------------
Date: Wed, 24 Sep 2003 09:36:08 -0500
From: Barry Kimelman <raisin@delete-this-trash.mts.net>
Subject: Re: How do I pass a value to a PERL script from an <a href?
Message-Id: <MPG.19db67d34ae10da0989692@news.mts.net>
[This followup was posted to comp.lang.perl.misc]
In article <HQ0cb.20401$an.10076@bignews6.bellsouth.net>,
NoSpamPlease@bellsouth.net says...
> I want to use a regular HTML href to call a PERL script and I also want to
> include information to pass to the PERL script.
>
> IE:
> <a href="/cgi-local/PerlScript.pl">
>
> I would like to pass a value such as 567 along with this call.
>
> Can it be done using a regular <A HREF= > ?
> If so, what is the syntax?
First of all this is not the appropriate newsgroup for CGI questiuons.
You shpould post this question to comp.infosystems.www.authoring.cgi.
Now with that having been said to pass a parameter value to a Perl
script you can do the following :
<a href="/cgi-local/PerlScript.pl?parm1=567&parm2=999">
------------------------------
Date: 24 Sep 2003 07:08:39 -0700
From: indian_spindoctor@yahoo.com (mani)
Subject: new to perl
Message-Id: <1c84265c.0309240608.525c2965@posting.google.com>
Hi,
I read this sample code somewhere on the web and it is as follows:
$db="/www/emailadd.txt";
open (DB,"$db") || die "Can't Open mailadd: $!\n";
while (<DB>) {
chop;
&SendMail;
}
close DB;
I understand this code because i have been reading Learning Perl
written by Randal Schwartz & Tom C. I am assuming this Sendmail is a
subroutine
but arent su routines called as is like SendMail instead of the & in
the front... Or am i missing something here.... I have been reading
Perl 5.0
Please help me out
regards
Mani
------------------------------
Date: 24 Sep 2003 07:08:51 -0700
From: indian_spindoctor@yahoo.com (mani)
Subject: new to perl
Message-Id: <1c84265c.0309240608.69db10b@posting.google.com>
Hi,
I read this sample code somewhere on the web and it is as follows:
$db="/www/emailadd.txt";
open (DB,"$db") || die "Can't Open mailadd: $!\n";
while (<DB>) {
chop;
&SendMail;
}
close DB;
I understand this code because i have been reading Learning Perl
written by Randal Schwartz & Tom C. I am assuming this Sendmail is a
subroutine
but arent su routines called as is like SendMail instead of the & in
the front... Or am i missing something here.... I have been reading
Perl 5.0
Please help me out
regards
Mani
------------------------------
Date: Wed, 24 Sep 2003 15:56:11 +0100
From: "Matthew Browning" <usenet@NOSPAM.matthewb.org>
Subject: Re: new to perl
Message-Id: <pan.2003.09.24.14.56.11.543524@NOSPAM.matthewb.org>
On Wed, 24 Sep 2003 07:08:51 +0000, mani wrote:
> I understand this code because i have been reading Learning Perl
> written by Randal Schwartz & Tom C. I am assuming this Sendmail is a
> subroutine
> but arent su routines called as is like SendMail instead of the & in
> the front... Or am i missing something here.... I have been reading
> Perl 5.0
>
> Please help me out
No need to ask twice.
You need the ampersand if the subroutine in question has not been
previously defined (either in the program itself or imported from a
module).
Since you can always legally use it, you're probably best off doing so
if in doubt.
Matthew Browning
------------------------------
Date: Wed, 24 Sep 2003 13:47:41 GMT
From: "Troll" <abuse@microsoft.com>
Subject: Q: File contents substitution
Message-Id: <1ghcb.121287$bo1.98657@news-server.bigpond.net.au>
Hi,
I posted this in one of the other grps but have had no real luck yet. Sorry.
I need 2b able to change the contents of a file, ie. to substitute
occurences of 'one' to 'two'.
I have something like:
**************************
sub replace {
s/one/two/g;
}
open (INFILE, "+<test.txt") || etc...
while (<>) {
replace ();
}
**************************
Contents of test.txt are:
hello one
one ten one ten
What am I missing to make this work? I'd love to read the manual [like
someone has suggested] but by the time I get there it'll be next year...
Thanks in advance.
------------------------------
Date: 24 Sep 2003 13:55:53 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Q: File contents substitution
Message-Id: <bks7p9$fqs$2@mamenchi.zrz.TU-Berlin.DE>
Troll <abuse@microsoft.com> wrote in comp.lang.perl.misc:
> Hi,
>
> I posted this in one of the other grps but have had no real luck yet. Sorry.
>
> I need 2b able to change the contents of a file, ie. to substitute
> occurences of 'one' to 'two'.
> I have something like:
> **************************
> sub replace {
> s/one/two/g;
> }
>
> open (INFILE, "+<test.txt") || etc...
> while (<>) {
> replace ();
> }
> **************************
>
> Contents of test.txt are:
> hello one
> one ten one ten
>
> What am I missing to make this work? I'd love to read the manual [like
> someone has suggested] but by the time I get there it'll be next year...
Then read the FAQ instead, it's short and sweet. perldoc -q 'line in a file'.
Anno
------------------------------
Date: Wed, 24 Sep 2003 14:35:06 GMT
From: "Troll" <abuse@microsoft.com>
Subject: Re: Q: File contents substitution
Message-Id: <uYhcb.121326$bo1.72800@news-server.bigpond.net.au>
"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:bks7p9$fqs$2@mamenchi.zrz.TU-Berlin.DE...
> Troll <abuse@microsoft.com> wrote in comp.lang.perl.misc:
> > Hi,
> >
> > I posted this in one of the other grps but have had no real luck yet.
Sorry.
> >
> > I need 2b able to change the contents of a file, ie. to substitute
> > occurences of 'one' to 'two'.
> > I have something like:
> > **************************
> > sub replace {
> > s/one/two/g;
> > }
> >
> > open (INFILE, "+<test.txt") || etc...
> > while (<>) {
> > replace ();
> > }
> > **************************
> >
> > Contents of test.txt are:
> > hello one
> > one ten one ten
> >
> > What am I missing to make this work? I'd love to read the manual [like
> > someone has suggested] but by the time I get there it'll be next year...
>
> Then read the FAQ instead, it's short and sweet. perldoc -q 'line in a
file'.
>
> Anno
Anno,
Do I put
line in a file
in the search field on perldoc? Have never been there b4. What's the -q for?
------------------------------
Date: Wed, 24 Sep 2003 09:30:25 -0500
From: Barry Kimelman <raisin@delete-this-trash.mts.net>
Subject: Re: RegExp: Matching
Message-Id: <MPG.19db66788434b93c989691@news.mts.net>
[This followup was posted to comp.lang.perl.misc]
In article <pan.2003.09.23.01.42.00.171350@aursand.no>, tore@aursand.no
says...
> Hi!
>
> I'm totally stuck with a regular expression. It has actually to do with
> my Apache configuration (I've posted to alt.apache.configuration), but as
> regular expressions are quite similar, I hope it's OK to post my question
> here as well.
>
> The problem is that I want to match (inside a <DirectoryMatch> directive)
> '/var/www/html/test/' and all the subdirectories. However, I _do not_
> want the regular expression to match on subdirectories which begin with an
> underscore ('_').
>
> Example:
>
> /var/www/html/test/ - Match
> /var/www/html/test - Match
> /var/www/html/test/2 - Match
> /var/www/html/test/23/ - Match
> /var/www/html/test/_foo/ - Do _not_ match
>
> Thanks for any help!
#!/usr/bin/perl -w
@paths = ( "/var/www/html/test/", "/var/www/html/test",
"/var/www/html/test/2" , "/var/www/html/test/23/" ,
"/var/www/html/test/_foo/" );
foreach $path ( @paths ) {
@parts = split(/\//,$path);
$lastpart = $parts[$#parts];
if ( $lastpart =~ m/^_/ ) {
print "Do not match [$path]\n";
}
else {
print "A match for [$path]!\n";
}
}
exit 0;
------------------------------
Date: Wed, 24 Sep 2003 09:50:09 -0400
From: "Curufin" <jeanc@cae.ca>
Subject: Setting Win32 priority from within a process
Message-Id: <bks7ei$b7d$1@dns3.cae.ca>
Hi,
Is there a simple way for a perl process to change its own priority on Win32
?
From what I understand Win32::Process works only on child processes and
getpriority()/setpriority() are not available on Win32.
Thanks
Curufin
------------------------------
Date: Wed, 24 Sep 2003 15:48:22 +0100
From: "Michael Benton" <michael.benton@adpcl.co.uk>
Subject: Split variable into fields ?
Message-Id: <3f71a503$1@news.star.co.uk>
I am new to perl so appoligies in advance.
I have a variable which is set to "A..A_B..B_C..C_D..D_123456"
I would like to split this into fields using the "_" as a field delimeter
(easy in awk and ksh)
Is there a way to do this in perl ? is there an equiv to teh awk "-F_" ?
Thanks
Mike
------------------------------
Date: Wed, 24 Sep 2003 15:01:30 +0000 (UTC)
From: Andreas Kahari <ak+usenet@freeshell.org>
Subject: Re: Split variable into fields ?
Message-Id: <slrnbn3ce9.1do.ak+usenet@sdf.lonestar.org>
In article <3f71a503$1@news.star.co.uk>, Michael Benton wrote:
> I am new to perl so appoligies in advance.
>
> I have a variable which is set to "A..A_B..B_C..C_D..D_123456"
> I would like to split this into fields using the "_" as a field delimeter
> (easy in awk and ksh)
>
> Is there a way to do this in perl ? is there an equiv to teh awk "-F_" ?
my @fields = split(/_/, $variable);
--
Andreas Kähäri
------------------------------
Date: Wed, 24 Sep 2003 12:23:42 +0100 (BST)
From: "Dave Saville" <dave.nospam@ntlworld.com>
Subject: Re: string length?
Message-Id: <qnirfnivyyragyjbeyqpbz.hlq87ib.pminews@text.news.ntlworld.com>
On 24 Sep 2003 00:10:28 GMT, Sam Holden wrote:
<snip>
>>
>>> *PLONK*
>>
>> I'm sorry, but what real gain is there from publically announcing additions
>> to one's kill file?
>
>Other people see examples of wht not to do if they dont want to also end
>up in that person's killfile. And I guess what to do if they do want to
>end up in that person's killfile. And possibly a guide to others who
>didn't follow the thread as to a poster who's posts might be worth
>checking to see if the killfile entry should be duplicated. The second
>two reasons are less likely and less important, obviously, but that's
>three just off the top of my head.
>
>I consider it of great benefit to know what I should avoid in order to
>have a chance of knowledgable, experienced perl programmers answering a
>question I may have in the future.
The only problem here is that a poster who does not know enough to not
top post etc.etc. probably has no idea what PLONK means :-)
Regards
Dave Saville
NB switch saville for nospam in address
------------------------------
Date: Wed, 24 Sep 2003 11:39:54 GMT
From: f_baggins80@hotmail.com (Helgi Briem)
Subject: Re: string length?
Message-Id: <3f718239.761672046@News.CIS.DFN.DE>
On Wed, 24 Sep 2003 12:23:42 +0100 (BST), "Dave Saville"
<dave.nospam@ntlworld.com> wrote:
>The only problem here is that a poster who does not know
>enough to not top post etc.etc. probably has no idea what
>PLONK means :-)
Good point. The same people usually exhibit enough
other signs of cluelessness and psychopathic rudeness
as to disqualify themselves on other grounds.
--
Helgi Briem hbriem AT simnet DOT is
Excuse the munged address. My last
e-mail address was killed by spammers.
------------------------------
Date: Wed, 24 Sep 2003 09:17:54 -0500
From: Barry Kimelman <raisin@delete-this-trash.mts.net>
Subject: Re: Stupid perl regexp question
Message-Id: <MPG.19db6390e8c6a026989690@news.mts.net>
[This followup was posted to comp.lang.perl.misc]
In article <168f035a.0309221404.769f4994@posting.google.com>,
g_klinedinst@hotmail.com says...
> This is a really stupid regexp question but can someone please explain
> to me why this doesn't work:
>
> if( m/\/{1}/ ) { print $_; }
>
> I want to match only those lines which contain 1 and only 1 "/"
> character. My understanding is that a forward slash needs escaped or
> else it would signal the end of the regexp, the {1} indicates to match
> one and only one time. I have seen examples such as:
>
> $string =~ m/^\S{1,8}\.\S{0,3}/;
>
> which clearly show the syntax of both escaping and repetition and I
> can't see for the life of me how mine is different, except that I
> don't care about the pattern matching at the beginning of the string.
>
> Output is returning lines that have 1 or more "/" chars. TIA for any
> help. BTW, please do not reply with suggestions to use grep, or
> sed/awk, or python, or C, or Lisp, or Smalltalk or any other languages
> or techniques. I want to use Perl for what I am doing.
>
> G. Klinedinst
>
Your regexp will match any string that contains 1 consecutive "/" at any
point in the string. Therefor if you have 2 "/" at different points in
the string your pattern will still produce a match.
And if i have a choice when it comes to text processing and pattern
matching I will always choose Perl.
------------------------------
Date: Wed, 24 Sep 2003 12:14:41 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: Trouble with 0
Message-Id: <pan.2003.09.24.09.31.44.112510@aursand.no>
On Tue, 23 Sep 2003 14:19:19 +0100, Richard S Beckett wrote:
> foreach (1..100000) {
> my $input;
> if ($input = $port->input) {print FILE "$input\n"}
> }
>
> This seems to work OK, unless I get a zero sent into the port. I can't
> work out how to trap the zero, and distinguish it from no input.
That's because you're really testing if your 'if()' statements returns
true or false in your code above. A '0' means false, even when it's a
"true vale" for you. :-)
You could try this code instead:
foreach ( 1 .. 100_000 ) {
my $input = $port->input();
if ( defined $input ) {
print FILE $input . "\n";
}
}
Hope this helps!
--
Tore Aursand <tore@aursand.no>
"You know the world is going crazy when the best rapper is white, the best
golfer is black, France is accusing US of arrogance and Germany doesn't
want to go to war."
------------------------------
Date: Wed, 24 Sep 2003 09:13:54 -0500
From: Barry Kimelman <raisin@delete-this-trash.mts.net>
Subject: Re: Using variables in RegEx statements?
Message-Id: <MPG.19db62a0797e5c1698968f@news.mts.net>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <aIJbb.10555$jO.2981@bignews3.bellsouth.net>,
NoSpamPlease@bellsouth.net says...
> I would like to do something like:
>
> if ($SubIP_1 =~ /$SubIP[0]\.$SubIP[1]\.\d+\.\d+/)
>
> But apparently, I can not use variables in the RegEx statement.
>
> Can someone explain this to me?
>
>
> Thanks,
>
You must be making some sort of error in your code because Perl does
allow using variables in a RegEx as in the following example.
if ( $string =~ /${pattern_variable}/ )
------------------------------
Date: Wed, 24 Sep 2003 10:36:14 GMT
From: f_baggins80@hotmail.com (Helgi Briem)
Subject: Re: What is the Simplest way to move Subs to Modules?
Message-Id: <3f7172fb.757769965@News.CIS.DFN.DE>
On 24 Sep 2003 02:06:59 -0700, deals@slip-12-64-108-121.mis.prserv.net
(Great Deals) wrote:
>I am giving up on writing modules. Too complicated. My only goal is
>too many perl programs can use the same subs. Now, I have to copy and
>pastes those subs into each perl program. Once I do an update, I have
>do re copy paste all over again..
No you don't.
>Please show me the easiest/simplest way to move subs to 1
>common file to let many programs to share the same subs.
Dead simple. Here's the module:
sub foo { print "Foo\n"; }
sub moo { print "Moo\n"; }
1;
Here's the script that uses it:
#!perl
use warnings;
use strict;
use lib 'path/to/module';
use Test_Module;
moo();
--
Helgi Briem hbriem AT simnet DOT is
Excuse the munged address. My last
e-mail address was killed by spammers.
------------------------------
Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re:
Message-Id: <3F18A600.3040306@rochester.rr.com>
Ron wrote:
> Tried this code get a server 500 error.
>
> Anyone know what's wrong with it?
>
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {
(---^
> dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
...
> Ron
...
--
Bob Walton
------------------------------
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.
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 V10 Issue 5554
***************************************