[21948] in Perl-Users-Digest
Perl-Users Digest, Issue: 4170 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 24 21:06:13 2002
Date: Sun, 24 Nov 2002 18:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 24 Nov 2002 Volume: 10 Number: 4170
Today's topics:
Re: a question on regular expression <usenet@dwall.fastmail.fm>
Re: a question on regular expression <goldbb2@earthlink.net>
Re: automatic email anniversay script <itshardtogetone@hotmail.com>
Re: automatic email anniversay script <bwalton@rochester.rr.com>
Re: Changing server problem <stevenm@blackwater-pacific.com>
CHECK THIS OUT!!!! <hopeandlove2002@hotmail.com>
Re: complex foreach loop with deep hashes (sorted hash (Tad McClellan)
Re: detecting getpwnam() errors -- how? (Alan Barclay)
Re: hash values ref counted? (Paul Wood)
Re: Help with grep + hash value <bwalton@rochester.rr.com>
My cgi can't write in a file (=?ISO-8859-1?Q?Alvaro_Girat=E1?=)
Re: Perl debugger? <rereidy@indra.com>
Re: Perl debugger? <bwalton@rochester.rr.com>
Re: Perl/Tk <bwalton@rochester.rr.com>
Re: removing elements from an array <goldbb2@earthlink.net>
Re: Timers <troc@netrus.net>
Re: Timers <ian@WINDOZEdigiserv.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 24 Nov 2002 19:15:23 GMT
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: a question on regular expression
Message-Id: <Xns92D09106FF78Cdkwwashere@63.240.76.16>
Benjamin Goldberg <goldbb2@earthlink.net> wrote:
> David K. Wall wrote:
>>
>> Benjamin Goldberg <goldbb2@earthlink.net> wrote:
>>
>> > Kurt Gong wrote:
>> >>
>> [finding inverted repeats in a DNA sequence]
>>
>> [snip program]
>> >
>> > [untested]
>>
>> I think you should have tested it. Unless I'm mistaken (a
>> frequent occurrence), it misses things it should have found.
>
> Some sample data, please? In particular, show the outputs you
> expect to get.
Sure. Consider the sequence below. (randomly-generated; ruler added
for convenience)
0----5----0----5----0----5----
tccttagcgagcacatatgcgcctcggcgt
The program you posted gives the following output:
------
From 0 to 3 is 'tcc'
From 21 to 24 is 'cct' (it's mirror)
From 4 to 6 is 'ta'
From 16 to 18 is 'at' (it's mirror)
From 6 to 9 is 'gcg'
From 26 to 29 is 'gcg' (it's mirror)
From 10 to 12 is 'gc'
From 27 to 29 is 'cg' (it's mirror)
From 17 to 21 is 'tgcg'
From 26 to 30 is 'gcgt' (it's mirror)
From 24 to 26 is 'cg'
From 26 to 28 is 'gc' (it's mirror)
------
'cg' is at offsets 7, 19, 24 (and 27, but there's no inverse of it
after that point). Inverses are at 10, 18, 20, 26. The program only
finds 'cg' at 24 and 27 and misses the others.
Or consider 'ta' (offset 4). It has inverted repeats at 14 and 16,
but the outout above only shows the one at 16.
--
David Wall - me@dwall.fastmail.fm
"Oook."
------------------------------
Date: Sun, 24 Nov 2002 14:40:52 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: a question on regular expression
Message-Id: <3DE12B44.269A676A@earthlink.net>
David K. Wall wrote:
>
> Benjamin Goldberg <goldbb2@earthlink.net> wrote:
>
> > David K. Wall wrote:
> >>
> >> Benjamin Goldberg <goldbb2@earthlink.net> wrote:
> >>
> >> > Kurt Gong wrote:
> >> >>
> >> [finding inverted repeats in a DNA sequence]
> >>
> >> [snip program]
> >> >
> >> > [untested]
> >>
> >> I think you should have tested it. Unless I'm mistaken (a
> >> frequent occurrence), it misses things it should have found.
> >
> > Some sample data, please? In particular, show the outputs you
> > expect to get.
>
> Sure. Consider the sequence below. (randomly-generated; ruler added
> for convenience)
>
> 0----5----0----5----0----5----
> tccttagcgagcacatatgcgcctcggcgt
>
> The program you posted gives the following output:
>
> ------
> From 0 to 3 is 'tcc'
> From 21 to 24 is 'cct' (it's mirror)
> From 4 to 6 is 'ta'
> From 16 to 18 is 'at' (it's mirror)
> From 6 to 9 is 'gcg'
> From 26 to 29 is 'gcg' (it's mirror)
> From 10 to 12 is 'gc'
> From 27 to 29 is 'cg' (it's mirror)
> From 17 to 21 is 'tgcg'
> From 26 to 30 is 'gcgt' (it's mirror)
> From 24 to 26 is 'cg'
> From 26 to 28 is 'gc' (it's mirror)
> ------
>
> 'cg' is at offsets 7, 19, 24 (and 27, but there's no inverse of it
> after that point). Inverses are at 10, 18, 20, 26. The program only
> finds 'cg' at 24 and 27 and misses the others.
>
> Or consider 'ta' (offset 4). It has inverted repeats at 14 and 16,
> but the outout above only shows the one at 16.
Ok, I see what you are complaining about -- the OP never said that he
needs to find all of the inverses, though. I suppose I could change my
code to find such things.
Furthermore, having just now reread it, I see "this kind of pattern can
form stem-loop structure which is very important for various molecular
interaction." This is quite important! A sequence of "AAAC" won't
attach to a "CAAA" and form a loop; it needs to attach to the
*complemented* and reversed form -- that is, "AAAC" can form a loop with
"GTTT". (Yes, this means that the OP's example data is wrong; but I
think his description should be considered more important than the
sample data).
$data = ....;
while( $data =~ m[
( # match the forward part; it must have at least two
# different characters to be of interest.
(?> (.) \2* ) .+
)
(?= .* ( (??{
(my $x = reverse $1) =~ tr/ATCG/TAGC/;
$x;
}) ) )
]xig ) {
print "The sequence $1 can form a loop with $3\n";
print "The start location for $1 is $-[1]\n";
print "The start location for $3 is $-[3]\n";
}
This still doesn't print out later occurances of the reversed,
complemented version, but I don't think that that's necessary.
> --
> David Wall - me@dwall.fastmail.fm
> "Oook."
Hey, lookit the monkey!
*Twist* *Crunch* *Snap*
"No... aargh! I meant Orangutan! Not monkey! Oowch!"
--
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
------------------------------
Date: Mon, 25 Nov 2002 07:51:31 +0800
From: "itshardtogetone" <itshardtogetone@hotmail.com>
Subject: Re: automatic email anniversay script
Message-Id: <arrob1$iq$1@reader01.singnet.com.sg>
"Andras Malatinszky" <nobody@dev.null> wrote in message
news:3DE0C790.2090000@dev.null...
> itshardtogetone wrote:
>
> > I wish to have a script that automatically sends "greetings" when the
time
> > coincides, .... eg if their birthday falls on the 20th december, an
email,
> > with my "customised wordings", will be sent to them .. say on the 19th
> > december, can this be done?
>
> Yes!
But I am talking about "sending" via my homepage, not my computer. So can
this "automatic sending of greetings at a scheduled date" be done via a
homepage.?
> For the scheduling you will want to use cron on UNIX or Task Scheduler
> under Windows.
<snip>
> How did you know my birthday was on the 20th.
The lucky star must be shining on you.
------------------------------
Date: Mon, 25 Nov 2002 00:40:10 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: automatic email anniversay script
Message-Id: <3DE17163.80803@rochester.rr.com>
itshardtogetone wrote:
> "Andras Malatinszky" <nobody@dev.null> wrote in message
> news:3DE0C790.2090000@dev.null...
>
>>itshardtogetone wrote:
>>
>>
>>>I wish to have a script that automatically sends "greetings" when the
>>>
> time
>
>>>coincides, .... eg if their birthday falls on the 20th december, an
>>>
> email,
>
>>>with my "customised wordings", will be sent to them .. say on the 19th
>>>december, can this be done?
>>>
>>Yes!
>>
>
> But I am talking about "sending" via my homepage, not my computer. So can
> this "automatic sending of greetings at a scheduled date" be done via a
> homepage.?
You'll have to clarify exactly what you mean by "'sending' via my
homepage". Do you mean that if the person happens to access your home
page on a given date, that your home page contain some special text for
just that person? If so, the answer is not really, since you will have
little or no idea of who it is that is requesting your home page. You
would have to ask, via a form which requests the user to enter his/her
name and password (the information available from the user's HTTP client
is insufficient for identification purposes -- could be someone else
using his/her computer and browser, could be spoofed, etc). Or if you
mean that your home page contain special content on specified dates,
regardless of who is accessing the page, then yes, that can be easily
done by comparing a database of dates and text with the current date.
But neither of those seems to me to meet the definition of "sending".
Precicely what is it you want to do? And what have you done so far to
try to implement whatever it is you want to do?
...
--
Bob Walton
------------------------------
Date: Sun, 24 Nov 2002 11:10:41 -0800
From: Steven May <stevenm@blackwater-pacific.com>
Subject: Re: Changing server problem
Message-Id: <arr7u9$8mp$1@quark.scn.rain.com>
Angus wrote:
> I have had the Extropia.com web-store successfully working for a
> couple of years and I have just moved it, unchanged except for the
> obviously needed changes to the setup file, to a new server.
>
> It now refuses to work and I have managed to isolate the problem to a
> few lines in the sub add_to_the_cart. About ten lines down in that sub
> is the following syntax:
>
> chomp $_;
> my @row = split (/\|/, $_);
> my $item_number = pop (@row);
> $highest_item_number = $item_number if ($item_number >
> $highest_item_number);
>
> When I hash out these lines the script will launch, though obviously I
> cannot add to the cart. Without the hashes I get an 'internal server
> error'.
>
> Any suggestions?
>
> Thanks.
This might be construed as more of a cgi question than a Perl question,
but....
chomp $_;
my @row = split (/\|/, $_);
my $item_number = pop (@row);
$highest_item_number = $item_number if ($item_number >
$highest_item_number);
If $item_number or $hightest_item_number have no value(s), the
comparison will fail.
This is not good code, IMHO.
I am wondering if the server error may be Perl complaining about
something (the above?) with no provision made for printing out the
content-type first.
Your server error_log may tell you what the problem is. If no
error_log, start looking for a provider who sets up error_logs for
cgi-enabled sites. :-)
Or you could try sopmething like this:
chomp $_;
my @row = split (/\|/, $_);
my $item_number = pop (@row);
if( $item_number and $highest_item_number ){
$highest_item_number = $item_number if ($item_number >
$highest_item_number);
}
else{
# some sort of error message, your call
}
If the above checks out and the cart uses a flat file to store cart
contents, but only if the above code tells it it has something to
record, then I would look very hard at the configured path(s) and
ownership/permissions.
hth,
s.
------------------------------
Date: Sun, 24 Nov 2002 23:42:26 GMT
From: "Hope and Love" <hopeandlove2002@hotmail.com>
Subject: CHECK THIS OUT!!!!
Message-Id: <CtdE9.87508$ka.2284613@news1.calgary.shaw.ca>
Are You looking for the Perfect Christmas Gift for that Special Lady in Your Life???
Do You want to Help her have that smooooth look and feel???
http://www.advanceddermalsolutions.com/cgi-bin/affiliates/clickthru.cgi/Hope
------------------------------
Date: Sun, 24 Nov 2002 15:24:43 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: complex foreach loop with deep hashes (sorted hash slices (using an array for keys))
Message-Id: <slrnau2gsr.idl.tadmc@magna.augustmail.com>
Jay Tilton <tiltonj@erols.com> wrote:
> On Sun, 24 Nov 2002 00:43:58 +0100, "Seansan"
><sheukels=cuthere=@yahoo.co.uk> wrote:
>
>: Right. Thx Jay Tilton for nothing.
>
> My pleasure. Puzzling, though. My "nothing" echoed much of Tad's good
> advice.
This thread is such a compendium of Things You Shouldn't Do,
that I get the feeling it is deliberate.
I think we are being trolled.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 25 Nov 2002 00:03:00 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: detecting getpwnam() errors -- how?
Message-Id: <1038182580.429306@elaine.furryape.com>
In article <arqbtb$c0n$1@blue.rahul.net>,
Rahul Dhesi <c.c.eiftj@65.usenet.us.com> wrote:
>The problem:
> How to detect an error occurring within the getpw* class of functions.
> When such a function returns empty array or undef, either the user
> does not exist (or in the case of getpwent no more entries are left);
> or an error occurred and we should retry. I would like to know how to
> tell the difference between 'no such user' and 'an error occurred; try
> again'.
getpwnam() returns undef in the event of an error, with $! set to
the errno returned by the underlying C function.
You'll have to check your system documentation to find out what that
means. On Linux, it's documented to only return ENOMEM if it can't
allocate memory. On Solaris, I can't see any error codes documented
to be returned.
------------------------------
Date: 24 Nov 2002 15:34:02 -0800
From: paul@torporific.org (Paul Wood)
Subject: Re: hash values ref counted?
Message-Id: <a2702001.0211241534.b5a5e65@posting.google.com>
tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnau21if.i0c.tadmc@magna.augustmail.com>...
> Paul Wood <paul@torporific.org> wrote:
>
> > Hi, I've found myself writing something along the lines of...
> >
> > %hash = (
> > 'space1.key1' => 1,
> > 'space1.key2' => 2,
> > 'space2.key1' => 3,
> > );
>
>
> You should chastize yourself whenever you catch yourself writing
> something along those lines. :-)
Chastized.
>
>
> You should always prefer lexical (my) over dynamic (local)
> variables, except when you can't.
>
> Your's does not appear to be one of the "when you can't" cases.
>
> Do you have "use strict" turned on?
>
The code I posted was very simplified. It's more of a curiosity
anyway... I was thinking about creating a kind of environment for
anonymous subs, in which you'd use quite a strict API, possibly using
something like the above as a general place to store data (I was
actually using %_, shock horror), but allowing you to switch the
'namespace'.
>
> > {
> > local %hash = map { $_ =~ /^space1\.(.+)/ ? ($1, $hash{$_}) : () }
> > keys %hash;
> > print $hash{'key1'}, "\n"; # prints 1
> > }
> >
> > Now, does locally changing the name of the keys make an extra copy of
> > the value?
>
>
> Yes.
Ah, thanks. I was thinking it might use copy-on-write, or something.
It's a shame.
>
>
> When you have multi-part keys like that, it is usually an indication
> that you have not chosen the best data structure.
>
> A Hash of Hashes (HoH) would be easier to work with:
>
> <snip>
>
> Then you would no longer need a copy.
I was thinking this could be a way of avoiding dereferencing things,
as I wanted the the environment to be very easy to plug new bits into
for people who don't know much Perl.
Thanks anyway.
-Paul.
------------------------------
Date: Mon, 25 Nov 2002 01:54:08 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Help with grep + hash value
Message-Id: <3DE182B9.2040904@rochester.rr.com>
Trent Hare wrote:
...
> I'm trying get the grep to be more "lenient" in it's tossing out
> photos...
> I have photos that are named "12345C.jpg" that belong to car "12345C",
> (which has been temporarily appended ".jpg" for the array matching
> purposes) and I also have photos named "12345_2.jpg" "12345_3.jpg"
> etc., that I don't want placed into the @orphanpics.
>
> So, when the hash value = "12345C.jpg" how do I get it to allow
> 12345C_2.jpg as well using this type of array matching?
>
> push @orphanpics, grep {not exists $h{$_}} @pictures;
...
> Trent
>
I'm confused by your problem statement. You have an array @pictures
with a bunch of strings in it. You have a hash %h with some keys stored
in it (values irrelevent). You want to create another array @orphanpics
containing those strings in @pictures which are not keys of %h. So the
keys of %h are strings you do not want to appear in @orphanpics. Now
you say you want to "allow" 12345C_2.jpg, for example, when 12345C.jpg
appears in %h. Does that mean you want 12345C_2.jpg to also not appear
in @orphanpics? If the above is a correct interpretation, one could so
something like:
Example program:
use Data::Dumper;
use strict;
use warnings;
my @pictures=('12345C.jpg','abcde.jpg','54321C.jpg',
'12345C_2.jpg','12345_2.jpg','12345C_3.jpg',
'abced.jpg','abcdef.jpg');
my %h=('12345C.jpg'=>0,'abcd.jpg'=>0);
my @orphanpics;
my @keys=keys %h;
for(@keys){$_=quotemeta}
my $regex='^(?:'.join('|',@keys).')';
$regex=~s/\\\.jpg//g;
for(@pictures){push @orphanpics,$_ unless /$regex/}
print Dumper(\@orphanpics);
Output:
D:\junk>perl junk234.pl
$VAR1 = [
'54321C.jpg',
'12345_2.jpg',
'abced.jpg'
];
D:\junk>
That would exclude any string starting with whatever is in any key of %h
from appearing in @orphanpics (with the .jpg extension removed from the
keys). Is that what you want?
--
Bob Walton
------------------------------
Date: 24 Nov 2002 17:44:01 -0800
From: agirata@escolombia.net (=?ISO-8859-1?Q?Alvaro_Girat=E1?=)
Subject: My cgi can't write in a file
Message-Id: <ef53bf3a.0211241744.4f116fe3@posting.google.com>
I have a simple cgi script counter that reads the counter value and
writes the new value in the same counter file. The script can read the
file info but cannot write on it. The file's path is correct and the
cgi's permissions are setup to 755.
What could be wrong ?
This is the script!
========================================
#!/usr/bin/perl
print "Content-type: text/html\n\n";
$counterFile = '/home/sites/mydomainname/web/cgi-bin/counter.dat';
open (input,"$counterFile") or die "die";
$/ = undef;
$counterValue = <input>;
close (input);
$counterValue++;
open (output,">$counterFile") or die "die";
print output $counterValue;
close (output);
exit;
========================================
------------------------------
Date: Sun, 24 Nov 2002 12:06:55 -0700
From: Ron Reidy <rereidy@indra.com>
Subject: Re: Perl debugger?
Message-Id: <3DE1234F.589CA0CB@indra.com>
Rob Richardson wrote:
>
> Greetings!
>
> I am entering the Perl world from the worlds of Visual C++ and Visual
> Basic. In both of those worlds, I have at my disposal a powerful
> debugger that allows me to set breakpoints in code, to execute my code
> one step at a time, to enter or skip over subroutines, and to watch
> variables as they change. Most imporantly, the debugger can execute
> code in exactly the same environment in which the production version
> will run. Presumably, other Perl programmers also have experience
> with these or other IDEs with similar capabilities. So, since Perl is
> largely used for Web programming, I would presume that there exist
> IDEs for Perl that can act as web servers, accepting connections from
> browsers, generating web pages and responding to events from those
> pages by running the requested Perl scripts, stopping at breakpoints,
> displaying variable values, and all the rest of it. If that is indeed
> the case, what do people recommend that I try to persuade the
> non-profit organization I'm volunteering to do web programming for to
> spend money on?
>
> I've seen tantalizing hints in posts on this group, but I don't know
> where to start.
>
> Thanks!
>
> Rob
1. perldoc perldebug
2. There is a Tk debugger on CPAN - ptkdb
--
Ron Reidy
Oracle DBA
------------------------------
Date: Sun, 24 Nov 2002 21:22:10 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Perl debugger?
Message-Id: <3DE142FC.5080800@rochester.rr.com>
Rob Richardson wrote:
...
> I am entering the Perl world from the worlds of Visual C++ and Visual
> Basic. In both of those worlds, I have at my disposal a powerful
> debugger that allows me to set breakpoints in code, to execute my code
> one step at a time, to enter or skip over subroutines, and to watch
> variables as they change. Most imporantly, the debugger can execute
> code in exactly the same environment in which the production version
> will run. Presumably, other Perl programmers also have experience
> with these or other IDEs with similar capabilities. So, since Perl is
> largely used for Web programming, I would presume that there exist
> IDEs for Perl that can act as web servers, accepting connections from
> browsers, generating web pages and responding to events from those
> pages by running the requested Perl scripts, stopping at breakpoints,
> displaying variable values, and all the rest of it. If that is indeed
> the case, what do people recommend that I try to persuade the
> non-profit organization I'm volunteering to do web programming for to
> spend money on?
...
> Rob
I recommend that you first check out Perl's -d switch:
perl -d program.pl
You can also check out:
perldoc perldebug
For the web stuff, you are using the CGI module, right? In that case,
you can use its builtin command-line debug mode in conjunction with -d.
No need to spend any money unless you really want to. And, based on
my experience, I doubt you would get much that would actually help any
more than the builtin stuff anyway.
--
Bob Walton
------------------------------
Date: Sun, 24 Nov 2002 20:59:21 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Perl/Tk
Message-Id: <3DE13DA3.4050808@rochester.rr.com>
fafanie wrote:
...
> I want to build a graphical interface in Perl/Tk.
> Via this interface, I want to run a script perl from a button.
> For the moment, this script run via a console MS-Dos or a xterm unix.
>
> How to do?
> The command system("perl test.pl") or system("start perl test.pl") fails.
>
> Thus, my script writes some messages in STDOUT (console,xterm).
> How can I see theses outputs in my interface?
...
> fafanie
>
If you would like to capture the standard output of a program which is
run from within Perl, use:
$output=`program command line`;
Those are "grave accent" characters (to the left of the 1 key on many
keyboards, although I don't know about French ones). See:
perldoc perlop
for additional information (look in the quote and quote-like operators
section, or look for the qx operator (its other implementation).
--
Bob Walton
------------------------------
Date: Sun, 24 Nov 2002 14:18:20 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: removing elements from an array
Message-Id: <3DE125FC.8DE290CD@earthlink.net>
Nick Tipper wrote:
>
> Hi can anybody please tell me how i can remove an element from an
> array thus
>
> foreach (@arr) {
> if (some condition) {
> # remove $_ from @arr
> }
> }
@arr = grep { not ( some condition ) } @arr;
--
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
------------------------------
Date: Sun, 24 Nov 2002 23:54:37 -0000
From: Rocco Caputo <troc@netrus.net>
Subject: Re: Timers
Message-Id: <slrnau2plo.8ba.troc@eyrie.homenet>
On Fri, 22 Nov 2002 21:59:18 GMT, Ian.H wrote:
>
> Evening all (depending on location) =)
>
> Not so long ago, I wrote an IRC bot for my server using the Net::IRC
> and Net::IRC::Event modules (yup, I'm aware that Net::IRC is
> depreciated), and I'm looking to include a timer event.
>
> I've looked in the doc at the alarm() function, but this doesn't seem
> to be what I'm after, likewise, I've searched CPAN for timer modules,
> and there appears to be a varied selection.
>
> The bot uses a mySQL backend to control a banlist amongst other things,
> and I'd like to initiate temp bans of say... 5 mins.
You might consider upgrading to POE::Component::IRC instead. It is
based on POE, which provides multiple timers, multiplexed I/O, and
generic events.
Bot::Pluggable and Bot::BasicBot wrap POE::Component::IRC in different
interfaces, if you prefer. All the modules are available on the CPAN.
-- Rocco Caputo - troc@pobox.com - http://poe.perl.org/
------------------------------
Date: Mon, 25 Nov 2002 00:04:14 GMT
From: Ian.H <ian@WINDOZEdigiserv.net>
Subject: Re: Timers
Message-Id: <s1q2uugesrvo7k4nbbdcet50enl6v06qba@4ax.com>
Keywords: Remove WINDOZE to reply
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
In a fit of excitement on Sun, 24 Nov 2002 23:54:37 -0000, Rocco Caputo
<troc@netrus.net> managed to scribble:
> On Fri, 22 Nov 2002 21:59:18 GMT, Ian.H wrote:
> >
> > Evening all (depending on location) =)
> >
> > Not so long ago, I wrote an IRC bot for my server using the
> > Net::IRC and Net::IRC::Event modules (yup, I'm aware that Net::IRC
> > is
> > depreciated), and I'm looking to include a timer event.
> >
> > I've looked in the doc at the alarm() function, but this doesn't
> > seem to be what I'm after, likewise, I've searched CPAN for timer
> > modules, and there appears to be a varied selection.
> >
> > The bot uses a mySQL backend to control a banlist amongst other
> > things, and I'd like to initiate temp bans of say... 5 mins.
>
> You might consider upgrading to POE::Component::IRC instead. It is
> based on POE, which provides multiple timers, multiplexed I/O, and
> generic events.
>
> Bot::Pluggable and Bot::BasicBot wrap POE::Component::IRC in
> different interfaces, if you prefer. All the modules are available
> on the CPAN.
>
> -- Rocco Caputo - troc@pobox.com - http://poe.perl.org/
Rocco,
Have thought about it.. haven't looked into it in great detail as of
yet though.. the bot's more of a "fun/experimental" project.
POE::Component::IRC would probably suffice but I'm assuming there's
going to be a fair amount of conversion to do (the bot's ~1100 lines).
I should have looked into this in the first place, but was recommended
Net::IRC (had never written a bot from scratch, it started life as an
X-Chat script).. but I never received anything on their mailing list,
wasn't until the other day I found out that it was depreciated (hence
lack of traffic on mailing list, heh).
Anyway, thanks for your advice/suggestion(s), I'll definitely take a
look as I don't see any "way forward" in keeping the use of Net::IRC.
Regards,
Ian
-----BEGIN xxx SIGNATURE-----
Version: PGP Personal Privacy 6.5.3
iQA/AwUBPeFpTWfqtj251CDhEQKwNACfYzzj3EgasWx2Lb4518tWnTxzHkcAoJBh
SY+LJyTVhz06kDS0q2KUyGCb
=CI/K
-----END PGP SIGNATURE-----
--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Scripting, Web design, development & hosting.
------------------------------
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 4170
***************************************