[30360] in Perl-Users-Digest
Perl-Users Digest, Issue: 1603 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 2 16:09:43 2008
Date: Mon, 2 Jun 2008 13:09:11 -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, 2 Jun 2008 Volume: 11 Number: 1603
Today's topics:
Address Book - duplicating cards <justin.0805@purestblue.com>
Re: Address Book - duplicating cards <justin.0805@purestblue.com>
Re: Address Book - duplicating cards <jurgenex@hotmail.com>
Re: iCal default calendar <justin.0805@purestblue.com>
Re: iCal default calendar <justin.0805@purestblue.com>
Re: iCal default calendar <szrRE@szromanMO.comVE>
OO perl, why print hash keys AND values? <cartercc@gmail.com>
Re: OO perl, why print hash keys AND values? <glex_no-spam@qwest-spam-no.invalid>
Re: OO perl, why print hash keys AND values? <ben@morrow.me.uk>
Re: OO perl, why print hash keys AND values? <cartercc@gmail.com>
Re: OO perl, why print hash keys AND values? <szrRE@szromanMO.comVE>
Re: OO perl, why print hash keys AND values? <glex_no-spam@qwest-spam-no.invalid>
Re: OO perl, why print hash keys AND values? <szrRE@szromanMO.comVE>
Re: OT: SI units (was sorting a hash / 2008-06-01) <szrRE@szromanMO.comVE>
Re: pattern match timed-out question <smallpond@juno.com>
Re: Perl read file eat up my memory... <jimsgibson@gmail.com>
Re: Perl Special Variable Containing the name of the me <szrRE@szromanMO.comVE>
Re: Perl Special Variable Containing the name of the me <devnull4711@web.de>
Re: Perl Special Variable Containing the name of the me <uri@stemsystems.com>
Receiving snmp traps in perl on Win platform? <dirkvandemoortel@ThankS-NO-SperM.hotmail.com>
Re: The select() (IO::Select) function has a limit? xhoster@gmail.com
Re: The select() (IO::Select) function has a limit? <tzz@lifelogs.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 02 Jun 2008 14:48:07 -0000
From: Justin C <justin.0805@purestblue.com>
Subject: Address Book - duplicating cards
Message-Id: <2f94.48440827.d7413@zem>
Is there an easy way of duplicating cards in Address Book? Quite often I
speak to several people at the same company, and it'd be easier to just
duplicate an existing card and changing the name for the new contact,
rather than have to go through the whole address & phone number input
all over again - especially as I can't see the existing card while I'm
inputting the new one!
Justin.
--
Justin C, by the sea.
------------------------------
Date: Mon, 02 Jun 2008 15:02:34 -0000
From: Justin C <justin.0805@purestblue.com>
Subject: Re: Address Book - duplicating cards
Message-Id: <34a4.48440b8a.809ff@zem>
Message sent to wrong group in error. Sorry for the inconvenience
caused.
Justin.
--
Justin C, by the sea.
------------------------------
Date: Mon, 02 Jun 2008 15:49:05 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Address Book - duplicating cards
Message-Id: <8a584453qsf5mkq0ttautl1lsjegdeagop@4ax.com>
Justin C <justin.0805@purestblue.com> wrote:
>Is there an easy way of duplicating cards in Address Book?
Sure. Take the business cards out of your address book, put them on the
photocopier, and push the "copy" button once. If normal paper is too
flimsy then with most copiers you can put light cardboard into the
single feed slot.
Cut the copy to size and place it in your address book.
>Quite often I
>speak to several people at the same company, and it'd be easier to just
>duplicate an existing card and changing the name for the new contact,
You can change the name with a utility called a pen.
>rather than have to go through the whole address & phone number input
>all over again - especially as I can't see the existing card while I'm
>inputting the new one!
If the new card goes on a different page then you need to take the old
one out. Then you can see both at the same time.
jue
------------------------------
Date: Mon, 02 Jun 2008 14:51:01 -0000
From: Justin C <justin.0805@purestblue.com>
Subject: Re: iCal default calendar
Message-Id: <2fbb.484408d5.c68d2@zem>
On 2008-06-02, Justin C <justin.0805@purestblue.com> wrote:
>
> I have three calendars in iCal, Work, Home, and Automated (for script
> triggers). While I'm at work most entries I want to add are for work,
> while I'm at home most entries are personal ones (the two are synched
> using .Mac). How can I set iCal on my iMac, and on my MBP, to default to
> the relevant calendar for each location? It always seems to choose the
> wrong one!
Oh dear, that is a big "Whoops". Sorry for posting this here, it was
meant to go elsewhere.
It only came to light when I did it again. So, yes, I'm sorry, but
there's another one. Coming.
Totally unintentional. I am sorry, I shall try harder not to do this
again.
Justin.
--
Justin C, by the sea.
------------------------------
Date: Mon, 02 Jun 2008 14:51:50 -0000
From: Justin C <justin.0805@purestblue.com>
Subject: Re: iCal default calendar
Message-Id: <2fca.48440906.d8e6f@zem>
On 2008-06-02, Ben Bullock <benkasminbullock@gmail.com> wrote:
> On Mon, 02 Jun 2008 12:07:19 +0000, Justin C wrote:
>
>> I have three calendars in iCal, Work, Home, and Automated (for script
>> triggers). While I'm at work most entries I want to add are for work,
>> while I'm at home most entries are personal ones (the two are synched
>> using .Mac). How can I set iCal on my iMac, and on my MBP, to default to
>> the relevant calendar for each location?
>
> I don't want to seem like an ignorant fool, but what's an iCal, an iMac, an
> MBP, a .Mac, or a script trigger? I've never heard of any of those things.
>
>> It always seems to choose the wrong one!
>
> You also seem to have chosen the wrong forum to ask your question.
Yes I have. Thank you for replying, and sorry for wasting your time.
Justin.
--
Justin C, by the sea.
------------------------------
Date: Mon, 2 Jun 2008 12:32:54 -0700
From: "szr" <szrRE@szromanMO.comVE>
Subject: Re: iCal default calendar
Message-Id: <g21ht701f92@news4.newsguy.com>
Ben Bullock wrote:
> On Mon, 02 Jun 2008 12:07:19 +0000, Justin C wrote:
>
>> I have three calendars in iCal, Work, Home, and Automated (for script
>> triggers). While I'm at work most entries I want to add are for work,
>> while I'm at home most entries are personal ones (the two are synched
>> using .Mac). How can I set iCal on my iMac, and on my MBP, to
>> default to the relevant calendar for each location?
>
> I don't want to seem like an ignorant fool, but what's an iCal, an
> iMac, an MBP, a .Mac, or a script trigger? I've never heard of any of
> those things.
You've never heard of an "iMac" Macintosh computer? I have not heard of
the rest, though, either.
>> It always seems to choose the wrong one!
>
> You also seem to have chosen the wrong forum to ask your question.
Indeed.
--
szr
------------------------------
Date: Mon, 2 Jun 2008 07:22:07 -0700 (PDT)
From: cartercc <cartercc@gmail.com>
Subject: OO perl, why print hash keys AND values?
Message-Id: <1c401c94-8a23-4dfa-b548-e47acfc43903@27g2000hsf.googlegroups.com>
Two classes, Person and Instructor, with Instructor inheriting from
Person.
Person constructor looks like this:
sub new
{
my $class = shift;
bless
{
_id => $_[0],
_first => $_[1],
_middle => $_[2],
_last => $_[3],
_dob => $_[4],
}, $class;
}
Instructor adds accessors and mutators for degree, rank, etc.
Instructor also has a method named print_instructor that looks like
this:
sub print_instructor
{
my $self = shift;
print "Instructor data:\n";
foreach my $key (%$self)
{
print "$key\t"; #line 1
#print "\n\t$key: $self->{$key}"; #line 2
#print "\n\t$self->{$key}"; #line 3
}
print "\n";
}
Here is the (partial) output from line 1. Note that I only ask for the
$key, but it prints the values as well.
Instructor data:
_id 2 _university Johns Hopkins University
_last Dewey
_first John _field Philosophy _middle nmn _rank
Professor
_degree Ph.D. _dob 20-OCT-1859
Here is the (partial) output from line 2. Note that it prints the $key
AND value but then repeats the value on the next line.
Instructor data:
_id: 2
2:
_university: Johns Hopkins University
Johns Hopkins University:
_last: Dewey
Dewey:
_first: John
John:
_field: Philosophy
Philosophy:
_middle: nmn
nmn:
_rank: Professor
Professor:
_degree: Ph.D.
Ph.D.:
_dob: 20-OCT-1859
20-OCT-1859:
Here is the (partial) output from line 3. Note that it prints just the
values, which is exactly the expected behavior.
Instructor data:
2
Johns Hopkins University
Dewey
John
Philosophy
nmn
Professor
Ph.D.
20-OCT-1859
Questions:
Why does line 2 print the values twice?
Why does line 1 print the values at all?
I confess, I'm clueless, CC.
------------------------------
Date: Mon, 02 Jun 2008 09:33:21 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: OO perl, why print hash keys AND values?
Message-Id: <484404b2$0$33225$815e3792@news.qwest.net>
cartercc wrote:
> Two classes, Person and Instructor, with Instructor inheriting from
> Person.
>
> Person constructor looks like this:
> sub new
> {
> my $class = shift;
> bless
> {
> _id => $_[0],
> _first => $_[1],
> _middle => $_[2],
> _last => $_[3],
> _dob => $_[4],
>
> }, $class;
Your class would be more readable if you passed those arguments
via a hash.
> }
>
> Instructor adds accessors and mutators for degree, rank, etc.
> Instructor also has a method named print_instructor that looks like
> this:
> sub print_instructor
> {
> my $self = shift;
> print "Instructor data:\n";
> foreach my $key (%$self)
That's not how you get the 'keys' out of the hash.
perldoc -f keys
or
perldoc -f each
> I confess, I'm clueless, CC.
------------------------------
Date: Mon, 2 Jun 2008 15:47:50 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: OO perl, why print hash keys AND values?
Message-Id: <mpddh5-9d7.ln1@osiris.mauzo.dyndns.org>
Quoth cartercc <cartercc@gmail.com>:
>
> foreach my $key (%$self)
> {
> print "$key\t"; #line 1
> #print "\n\t$key: $self->{$key}"; #line 2
> #print "\n\t$self->{$key}"; #line 3
> }
> print "\n";
> }
>
> Here is the (partial) output from line 1. Note that I only ask for the
> $key, but it prints the values as well.
Evaluating a %hash in list context returns a list of interleaved keys
and values. To get a list of keys, use 'keys %hash' in list context.
None of the OO stuff you posted was the least bit relevant to your
problem. It would have been helpful if you had removed it before
posting.
Ben
--
Although few may originate a policy, we are all able to judge it.
Pericles of Athens, c.430 B.C.
ben@morrow.me.uk
------------------------------
Date: Mon, 2 Jun 2008 07:57:51 -0700 (PDT)
From: cartercc <cartercc@gmail.com>
Subject: Re: OO perl, why print hash keys AND values?
Message-Id: <440a60d6-45a8-4e26-8ba8-55e81f8e0e65@z66g2000hsc.googlegroups.com>
Thanks, J and Ben. Questions answered and method fixed.
I don't mind confessing ignorance. There's always another mountain to
climb and always another challenge to turn into an opportunity to
learn. If we were satisfied with our current place, we wouldn't get
anywhere.
CC
------------------------------
Date: Mon, 2 Jun 2008 11:06:19 -0700
From: "szr" <szrRE@szromanMO.comVE>
Subject: Re: OO perl, why print hash keys AND values?
Message-Id: <g21cqs01ae2@news4.newsguy.com>
J. Gleixner wrote:
> cartercc wrote:
>> Two classes, Person and Instructor, with Instructor inheriting from
>> Person.
>>
>> Person constructor looks like this:
>> sub new
>> {
>> my $class = shift;
>> bless
>> {
>> _id => $_[0],
>> _first => $_[1],
>> _middle => $_[2],
>> _last => $_[3],
>> _dob => $_[4],
>>
>> }, $class;
>
> Your class would be more readable if you passed those arguments
> via a hash.
Please correct me if I'm missing something, but isn't he in fact passing
an anonymous hash (ref) to bless already?
Yes, he could declare a named ref to an anonymous hash, like
my $obj = { ... };
bless $obj, $class;
but in the end I think that makes little difference in this case.
--
szr
------------------------------
Date: Mon, 02 Jun 2008 13:44:28 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: OO perl, why print hash keys AND values?
Message-Id: <48443f8d$0$87065$815e3792@news.qwest.net>
szr wrote:
> J. Gleixner wrote:
>> cartercc wrote:
>>> Two classes, Person and Instructor, with Instructor inheriting from
>>> Person.
>>>
>>> Person constructor looks like this:
>>> sub new
>>> {
>>> my $class = shift;
>>> bless
>>> {
>>> _id => $_[0],
>>> _first => $_[1],
>>> _middle => $_[2],
>>> _last => $_[3],
>>> _dob => $_[4],
>>>
>>> }, $class;
>> Your class would be more readable if you passed those arguments
>> via a hash.
>
> Please correct me if I'm missing something, but isn't he in fact passing
> an anonymous hash (ref) to bless already?
[...]
I meant pass them to new() as named arguments:
e.g.
Person->new( 1234, 'abc', ... );
Is more readable and less error prone as:
Person->new( id => 1234, first => 'abc', ... );
------------------------------
Date: Mon, 2 Jun 2008 12:37:41 -0700
From: "szr" <szrRE@szromanMO.comVE>
Subject: Re: OO perl, why print hash keys AND values?
Message-Id: <g21i6501ffo@news4.newsguy.com>
J. Gleixner wrote:
> szr wrote:
>> J. Gleixner wrote:
>>> cartercc wrote:
>>>> Two classes, Person and Instructor, with Instructor inheriting from
>>>> Person.
>>>>
>>>> Person constructor looks like this:
>>>> sub new
>>>> {
>>>> my $class = shift;
>>>> bless
>>>> {
>>>> _id => $_[0],
>>>> _first => $_[1],
>>>> _middle => $_[2],
>>>> _last => $_[3],
>>>> _dob => $_[4],
>>>>
>>>> }, $class;
>>> Your class would be more readable if you passed those arguments
>>> via a hash.
>>
>> Please correct me if I'm missing something, but isn't he in fact
>> passing an anonymous hash (ref) to bless already?
> [...]
> I meant pass them to new() as named arguments:
>
> e.g.
>
> Person->new( 1234, 'abc', ... );
>
> Is more readable and less error prone as:
>
> Person->new( id => 1234, first => 'abc', ... );
Ah, indeed that is much better. Thanks for clearing that up.
--
szr
------------------------------
Date: Mon, 2 Jun 2008 12:56:27 -0700
From: "szr" <szrRE@szromanMO.comVE>
Subject: Re: OT: SI units (was sorting a hash / 2008-06-01)
Message-Id: <g21j9b01goj@news4.newsguy.com>
Abigail wrote:
> _
> sheinrich@my-deja.com (sheinrich@my-deja.com) wrote on VCCCLXXXVI
> September MCMXCIII in
> <URL:news:909e7d1f-f37a-4e85-96de-c35f800e6a60@a70g2000hsh.googlegroups.com>:
>>> On May 30, 9:21 am, "dn.p...@gmail.com" <dn.p...@gmail.com> wrote:
>>>
>>> ...
>>>>
>>>> my %hash = () ;
>>>> $hash{Calif}{San Jose}{max_temp} = 84 ;
>>>> $hash{Calif}{San Fran}{max_temp} = 94 ;
>>>> $hash{Calif}{Cupertino}{max_temp} = 38 ;
>>>> $hash{Calif}{Fremont}{max_temp} = 66 ;
>>>> $hash{Texas}{Dallas}{max_temp} = 72 ;
>>>> $hash{Texas}{Austin}{max_temp} = 96 ;
>>>> $hash{Texas}{Fort Worth}{max_temp} = 62 ;
>>>> $hash{Mass}{Boston}{max_temp} = 96 ;
>>>> $hash{Mass}{Framingham}{max_temp} = 55 ;
>>>> $hash{Mass}{Worcester}{max_temp} = 55 ;
>>>>
>>> Excuse me, but is it really absolutely unthinkable to share your
>>> information with the meager 99% percent of the world that has
>>> adopted SI units decades(!) ago?
>
> The USA makes up for about 4.5% of the world population, so even
> if the rest of the world would use Celsius, it would only be 95%.
> But how many of those 95% actually care about the four hottest
> cities in the USA, as compared to the 4.5% that uses Fahrenheit?
You paint that percentage in an interesting way. To put it in
perspective, the USA is the 3rd most populated country in the world [1]
(1st being China and then India for 2nd) and carrier more than twice the
population of the largest single European country, and ~61% of the whole
European Union's worth. [2][1]
[1] http://en.wikipedia.org/wiki/List_of_countries_by_population
[2] http://en.wikipedia.org/wiki/European_Union
--
szr
------------------------------
Date: Mon, 02 Jun 2008 11:04:19 -0400
From: smallpond <smallpond@juno.com>
Subject: Re: pattern match timed-out question
Message-Id: <11027$48440bfd$634@news.teranews.com>
lovecreatesbea...@gmail.com wrote:
> Hi,
>
> Where am I wrong?
>
use warnings;
use strict;
Also check the return from things like open for errors.
How else are you going to find your problem?
-S
** Posted from http://www.teranews.com **
------------------------------
Date: Mon, 02 Jun 2008 12:08:41 -0700
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: Perl read file eat up my memory...
Message-Id: <020620081208419226%jimsgibson@gmail.com>
In article
<701d8f80-eb5f-47f9-939e-f40ba0c2bfd2@y22g2000prd.googlegroups.com>,
howa <howachen@gmail.com> wrote:
> Now, I have a program to read the file line by line:
>
> #!/usr/bin/perl
> use strict;
>
> if ( scalar(@ARGV) == 1 ) {
>
> my $filename = ( $ARGV[0] );
> open(IN_FILE, $filename) or die("Could not open the file.");
>
> my $line;
>
> foreach $line (<IN_FILE>) {
>
> print "Test";
> exit;
>
> }
> close(IN_FILE);
>
> }
>
> Suppose the file will read the first line and exit, however, it was
> halt and eating my memory forever, no output for print "Test" or exit
> at all.
Others told you about using while instead of foreach. In addition, if
you don't get output you expect, you should 1) Add a newline character
to your output, and 2) set standard output for no buffering (some call
it auto-flushing) (see 'perldoc -q flush").
--
Jim Gibson
------------------------------
Date: Mon, 2 Jun 2008 12:42:10 -0700
From: "szr" <szrRE@szromanMO.comVE>
Subject: Re: Perl Special Variable Containing the name of the method currently in?
Message-Id: <g21iej01foi@news4.newsguy.com>
Frank Seitz wrote:
> A. Sinan Unur wrote:
>> Nigel <nigelstuart@gmail.com> wrote in news:de8822a9-7087-4006-a8ef-
>> fd8c4b7e758a@z66g2000hsc.googlegroups.com:
>>>
>>> Is there a way to get the name of the subroutine Perl is currently
>>> in when it is running?
>>> For example, if I have a subroutine declared with the name sub
>>> helloWorld, is there any way from within that subroutine to
>>> programmatically get 'helloWorld' without having to hardcode it?
>>
>> #!/usr/bin/perl
>>
>> use strict;
>> use warnings;
>>
>> sub whatismyname { (caller 1)[3] }
>>
>> sub iknowmyname {
>> my $name = whatismyname();
>>
>> print "My name is '$name'\n";
>> }
>>
>> iknowmyname();
>
> It should be mentioned that there are cases where
> the code does not work as expected:
>
> *f = \&iknowmyname;
>
> iknowmyname();
> f();
>
> __END__
> My name is 'main::iknowmyname'
> My name is 'main::iknowmyname'
This would be exactly what I would expect. 'main::iknowmyname' is the
conical name of the function, where as 'f' is basically just a pointer
(ok, alias) and not the true name of the function, where as
'main::iknowmyname' is the true name :-)
--
szr
------------------------------
Date: Mon, 02 Jun 2008 16:13:49 +0200
From: Frank Seitz <devnull4711@web.de>
Subject: Re: Perl Special Variable Containing the name of the method currently in?
Message-Id: <6aidhjF36c918U4@mid.individual.net>
A. Sinan Unur wrote:
> Nigel <nigelstuart@gmail.com> wrote in news:de8822a9-7087-4006-a8ef-
> fd8c4b7e758a@z66g2000hsc.googlegroups.com:
>>
>>Is there a way to get the name of the subroutine Perl is currently in
>>when it is running?
>>For example, if I have a subroutine declared with the name sub
>>helloWorld, is there any way from within that subroutine to
>>programmatically get 'helloWorld' without having to hardcode it?
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> sub whatismyname { (caller 1)[3] }
>
> sub iknowmyname {
> my $name = whatismyname();
>
> print "My name is '$name'\n";
> }
>
> iknowmyname();
It should be mentioned that there are cases where
the code does not work as expected:
*f = \&iknowmyname;
iknowmyname();
f();
__END__
My name is 'main::iknowmyname'
My name is 'main::iknowmyname'
Frank
--
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel
------------------------------
Date: Mon, 02 Jun 2008 20:08:17 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Perl Special Variable Containing the name of the method currently in?
Message-Id: <x7mym3a9ce.fsf@mail.sysarch.com>
>>>>> "s" == szr <szrRE@szromanMO.comVE> writes:
s> Frank Seitz wrote:
>>>
>> It should be mentioned that there are cases where
>> the code does not work as expected:
>>
>> *f = \&iknowmyname;
>>
>> iknowmyname();
>> f();
>>
>> __END__
>> My name is 'main::iknowmyname'
>> My name is 'main::iknowmyname'
s> This would be exactly what I would expect. 'main::iknowmyname' is the
s> conical name of the function, where as 'f' is basically just a pointer
canonical
s> (ok, alias) and not the true name of the function, where as
s> 'main::iknowmyname' is the true name :-)
actually that isn't true. once you store a code ref into a type glob
perl can't tell which name came first. the symbol table is just a
special hash and has the same behavior. i bet if you chose multiple
names or selected them in the right way, you could make any of them show
up as the caller name. perl will likely just report the first name that
has the given address it is looking for.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Mon, 2 Jun 2008 18:47:17 +0200
From: "Dirk Van de moortel" <dirkvandemoortel@ThankS-NO-SperM.hotmail.com>
Subject: Receiving snmp traps in perl on Win platform?
Message-Id: <xuV0k.74432$x55.46478@newsfe17.ams2>
{
OOPS, posted this to moderated group perl.cpan.discuss as
well, so it can take a while to get through, if it gets through at all
Otherwise sorry for duplicate posting
}
We need to set up a server 2003 (or a win XP system) to accept
and act upon traps sent out from a storage system. Responding
to various error conditions, this system can be fully configured to
send traps.
I am wondering what must be done on the trap-accepting side.
I am fairly new to SNMP but I managed to install the NET::SNMP
module from
http://search.cpan.org/~dtown/Net-SNMP-5.2.0/lib/Net/SNMP.pm
and use it to interrogate and manipulate a remote SNMP agent (SNMP
service running on a XP-system), i.o.w. all the examples work.
I can do get and sets, and I can send traps to the remote system.
With a little utility like "SNMP Trap Watcher" I see the traps arriving.
Now I would like to create a perl script on the remote system to
listen for traps, and, at this point, to just show them on the console.
The NET::SNMP module seems not to support this.
I have been looking around I do find some examples of trap
listeners, but they all seem to work on unit or Linux only.
The module SNMP
http://search.cpan.org/~hardaker/SNMP-5.0401/SNMP.pm
seems promising, but when I try to install it with ppm, I get
ppm> install SNMP
====================
Install 'SNMP' version 0.0 in ActivePerl 5.8.7.815.
====================
Error: error downloading 'http://theoryx5.uwinnipeg.ca/ppms/x86/Bundle-
NetSNMP.tar.gz': 404 Not Found
Can anyone help me out here?
Tia,
Dirk Vdm
By the way, this might be of interest:
==============================
ppm> rep describe 1
Describing Active Repository 1:
Name: ActiveState Package Repository
Location: http://ppm.ActiveState.com/PPM/ppmserver-5.8-windows.plex?urn:/PPM/Server/SQL
Type: PPMServer 3.0
ppm>
ppm>
ppm> rep describe 2
Describing Active Repository 2:
Name: uwinnipeg
Location: http://theoryx5.uwinnipeg.ca/ppms/
Type: Webpage
ppm>
ppm>
ppm> search snmp
Searching in Active Repositories
1. Apache-WebSNMP [0.11] Apache-WebSNMP
2. Net-SNMP [5.2] Net-SNMP
3. Net-SNMP [5.2] Object oriented interface to SNMP
4. Net-SNMP-alpha [3.9.6] Net-SNMP-alpha
5. Net-SNMP-HostInfo [0.02] Net-SNMP-HostInfo
6. Net-SNMP-Interfaces [1.2] Net-SNMP-Interfaces
7. POE-Component-SNMP [0.01] POE-Component-SNMP
8. SNMP [0.0]
9. SNMP-BridgeQuery [0.58] SNMP-BridgeQuery
10. SNMP-Effective [1] SNMP-Effective
11. SNMP-MIB-Compiler [0.06] SNMP-MIB-Compiler
12. SNMP-Persist [0.05] SNMP-Persist
13. SNMP-Util [1.8] Snmp modules to perform snmp set,get,walk,next,walk_hash etc.
ppm>
==============================
------------------------------
Date: 02 Jun 2008 17:03:49 GMT
From: xhoster@gmail.com
Subject: Re: The select() (IO::Select) function has a limit?
Message-Id: <20080602130350.980$SN@newsreader.com>
peste <mcanato@gmail.com> wrote:
> Hi list,
> i'm writing a daemon in perl for exchanging data from a big quantity
> of machines (over 100000) over the network and I use the select()
> function in order to select the correct file handler (to read or
> write).
>
> All is fine when the number of clients is <100, but when arrives the
> 101th client the connection with this is dropped.
What do you mean "dropped"? What return value or error message are you
getting from what piece of code?
> Is this a limit of the IO::Select?
Not inherently. Maybe it is limit of the underlying structures which
IO::Select must interact with on some OSes. On Unix I have no problem
getting more than 300 socket connections. On Windows I can only get 80.
Can you dummy up some kind of short simple program that replicates
the problem (with a dummy driver to take the other end of the connections)
that you can post here so we can play with it?
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Mon, 02 Jun 2008 14:58:36 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: The select() (IO::Select) function has a limit?
Message-Id: <86abi3bocz.fsf@lifelogs.com>
On Mon, 2 Jun 2008 02:24:53 -0700 (PDT) peste <mcanato@gmail.com> wrote:
p> i'm writing a daemon in perl for exchanging data from a big quantity
p> of machines (over 100000) over the network and I use the select()
p> function in order to select the correct file handler (to read or
p> write).
p> All is fine when the number of clients is <100, but when arrives the
p> 101th client the connection with this is dropped.
p> Is this a limit of the IO::Select?
You'll hit a limit long before 100,000 file descriptors, and it's always
annoying to have arbitrary limits on the number of clients. Consider
using multicast messages or a distributed messaging protocol like XMPP
(http://www.xmpp.org/) if you can. It really depends on your network
topology and reliability/responsiveness requirements.
Ted
------------------------------
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 1603
***************************************