[18952] in Perl-Users-Digest
Perl-Users Digest, Issue: 1147 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 17 03:05:31 2001
Date: Sun, 17 Jun 2001 00:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <992761508-v10-i1147@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 17 Jun 2001 Volume: 10 Number: 1147
Today's topics:
Re: Converting spaces to plus signs <goldbb2@earthlink.net>
Re: Design pattern for a generic functions dispatcher <goldbb2@earthlink.net>
Re: File::Find skips the leaf nodes in a directory tree <goldbb2@earthlink.net>
Re: Looking for good tutorial/book on Perl programming. <wyzelli@yahoo.com>
Re: Memory Issues/File Slurping <goldbb2@earthlink.net>
Re: more than one execution for wait? <vrman@sl2sys.co.kr>
Re: more than one execution for wait? (Chris Fedde)
Re: Need Coding to Enable Two Websites to Share One For (Chris Fedde)
Re: Net::IRC connection problems: possible fix <goldbb2@earthlink.net>
Re: Newbie Post : Flushing output for long scripts (Kåre Olai Lindbach)
Re: Porblem: Predesignated Runtime? (Kyle Vinson)
Re: Porblem: Predesignated Runtime? (Kyle Vinson)
Re: PPM (isterin)
Re: Reval, Regular Expression, and Searching for Emails <goldbb2@earthlink.net>
Re: Server Side Includes on IIS (Chris Fedde)
strange error on pipe open <todd@designsouth.net>
Re: strange error on pipe open <pne-news-20010617@newton.digitalspace.net>
Re: To find string length? <bop@mypad.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 17 Jun 2001 00:39:17 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Converting spaces to plus signs
Message-Id: <3B2C3475.2D9F5CC7@earthlink.net>
Godzilla! wrote:
>
> Ken Philbrick wrote:
>
> > I have some strings that contain spaces, but I'd like to convert all the
> > spaces into plus signs. I've tried various methods using split and
> > join, but nothing has worked. The FAQ on perl.com doesn't seem to
> > mention anything about it either. Any ideas?
>
> Have you considered using transliteration or substitution
> to change spaces to plus signs? This would be logical.
>
> Godzilla!
Excuse me, Mr/Ms evil alien bodysnatcher/pod person, could you give us
back Kira? We miss her flames, sarcasm, and bad code.
On second thought, nevermind.
--
The longer a man is wrong, the surer he is that he's right.
------------------------------
Date: Sun, 17 Jun 2001 00:01:33 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Design pattern for a generic functions dispatcher
Message-Id: <3B2C2B9D.27644380@earthlink.net>
Bart Lateur wrote:
>
> Abe Timmerman wrote:
>
> >> I prefer sub refs.
> >>
> >> my %action_map = (
> >> ACTION1 => \&MyModule::SubModule::Myfunction,
> >> ACTION2 => \&MyOtherModule::MyOtherFunction,
> >> );
> >
> >So do I, but they will only work if the module in question is loaded.
>
> No, it *does* work. You can take a reference to a sub that is not
> compiled yet, maybe not even when the script strats running.
>
> %dispatch = ( 'abc' => \&Foo::test );
> eval <<'END';
> package Foo;
> sub test {
> print "It works!\n";
> }
> END
> $dispatch{abc}();
>
> This prints: "It works!"
Cool!
>
> n.b. Isn't it funny you can drop the arrow between the hash index and
> the sub calling parens as well?
>
> >The OP wanted dynamic loading to avoid loading all modules when only
> >one is needed per invocation of the program.
>
> The idea is to analyze the sub name, calling the proper module etc?
> Then use AUTOLOAD. Let the system take care of it all.
>
> For an elaborate AUTOLOAD mechanism, all in the same source file, take
> a good look at CGI.pm. Many "functions" are actually stored as source,
> in a hash, and eval() is used to compile them when first needed.
>
> Or, you can use AUTOLOAD in the more traditional way. The very barest
> working example:
>
> my %dispatch = ( A => \&Foo::Alpha::one, B => \&Foo::Beta::two );
> for my $op ('A', 'B') {
> $dispatch{$op}();
> }
>
> package Foo::Alpha;
> sub AUTOLOAD {
> require Foo::Alpha;
> goto &$AUTOLOAD;
> }
>
> package Foo::Beta;
> sub AUTOLOAD {
> require Foo::Beta;
> goto &$AUTOLOAD;
> }
Eww. When there are lots of packages used, this isn't exactly the best
thing to do. Why not just one method used as the AUTOLOAD for all those
packages?
> Care should be taken about sub DESTROY, in case of OO style packages.
> It should be no error if it is called, through AUTOLOAD, while it
> doesn't exist. The simplest way to cope with it, is simply drop the
> call in the AUTOLOAD routine. If the sub does exist, AUTOLOAD won't be
> called, and if it the package is not yet loaded, there shouldn't be
> any objects to call it.
Sensible.
The following assumes that %action_map is initially populated with sub
names, but don't panic, it replaces them with code references. This is
needed because I don't know how to extract the package name from a
coderef. The autoload closure ignores DESTROY calls as you suggested.
Also, since any package might have it's own autoloader, it removes the
symbol table entry for itself before doing the require.
my %dispatch;
BEGIN{ %dispatch = ( A => "Foo::Alpha::one", B => "Foo::Beta::two" ) }
for my $op (qw(A B)) {
$dispatch{$op)();
}
BEGIN{for my $action (keys %dispatch) {
my $subname = $action_map{$action};
$action_map{$action} = \&$subname; # replace string with coderef
my $package = $subname =~ /(.*)::/;
no strict 'refs';
*{"${package}::AUTOLOAD"} = sub {
return if $AUTOLOAD =~ /::DESTROY$/;
undef &{"${package}::AUTOLOAD"}; # uninstall ourself
$package =~ s[::][/]g;
require $package . ".pm";
goto &$AUTOLOAD;
} unless defined &{"${package}::AUTOLOAD"};
}}
My autoload code is 13 lines, no matter how many packages are used,
while yours is 5 lines per package needed. For a small number of
packages, yours is better, but for 3 or more, mine is smaller.
There's also the matter of maintainance -- with mine, no extra code
needs to be added if a new %dispatch entry is made, whereas for yours,
you will need to add another (package Xxx, sub AUTOLOAD) pair if the new
sub happens to be in a new package.
Of course, if we simply use only one entry from the dispatch table and
then exit, it might be better to not use an AUTOLOAD, and instead use
the "naive" method of parsing the subname and doing the require
immediately before calling the sub, sort of like I did in message
<3B2458E4.58989CAF@earthlink.net>, though without storing the coderef
back into the hash table:
my $action = shift @ARGV;
if( my $subname = $dispatch{$action} ) {
(my $package = $subname =~ m[(.*)::]) =~ s[::][/]g;
require $package . ".pm";
$subname = \&$subname; #is this faster than "no strict 'refs';"?
$subname->(@ARGV);
exit;
} else {
die "Illegal action: $action\n";
}
For a single call, dumbest may be best. OTOH, if we will ever need to
do more than one call, then the more complicated things would be best
right off the bat, even if they aren't fastest for the single-call case.
--
The longer a man is wrong, the surer he is that he's right.
------------------------------
Date: Sun, 17 Jun 2001 01:34:02 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: File::Find skips the leaf nodes in a directory tree?
Message-Id: <3B2C414A.1F2E5879@earthlink.net>
jon chang wrote:
>
> Hi,
>
> I'm trying to write a small script that'd scan a directory recursively
> and create a blank index.html in each subdirectory where no
> index.html, index.htm, or index.cgi is found.
>
> I found the following script skipping the leaf nodes of a directory.
> Any help would be appreciated.
>
> Also, is there a better way of doing things below in Perl, instead
> of invoking system() call.
>
> Regards.
>
> #!/usr/local/bin/perl -w
>
> use File::Find;
> @ARGV = ('.') unless @ARGV;
> find sub {
> if ( !(-e 'index.cgi' || -e 'index.html' || -e 'index.htm') ) {
> system("touch index.html; chown www:www index.html; chmod 644 index.html")
> ;
> }
> }, @ARGV;
$! perl -w
use strict;
use File::Find;
@ARGV = qw(.) unless @ARGV;
my $www_uid = getpwnam( 'www' );
my $www_gid = getgrnam( 'www' );
find sub {
return if( -l or !-d _ );
return if( -e "$_/index.$ext" ) for my $ext (qw(html cgi htm));
if( open my $fh, ">", my $fn = "$_/index.html" ) {
chown $www_uid, $www_gid, $fn;
chmod 0644, $fn;
} else {
warn "Cannot create $File::Find::dir/$fn: $!";
}
}, @ARGV;
__END__
--
The longer a man is wrong, the surer he is that he's right.
------------------------------
Date: Sun, 17 Jun 2001 12:06:03 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Looking for good tutorial/book on Perl programming.
Message-Id: <QwUW6.3$Y67.1629@vic.nntp.telstra.net>
"zero the hero" <christopher_brien@hotmail.com> wrote in message
news:3bcda11.0106160904.12b1367e@posting.google.com...
> "Wyzelli" <wyzelli@yahoo.com> wrote
> >--
> >($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down,
> pass it
> >around');
> >$d='$_$a$s$b$w';$e='$_$a$s$b';sub
> d{$h=shift;$h=~s/\$(\w+)/${$1}/g;return$h}
> >sub
>
>e{return(shift!=1)?'s':''}for(reverse(1..100)){$s=e($_);$f=d($d);$g=d($e);
> >$c.="$f\n$g\n$t\n";$_--;$s=e($_);$e=d($d);$c.="$e\n\n";}print"$c*hic*";
>
> Shouldn't that be
> ($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down,
> pass it around');$d='$_$a$s$b$w';$e='$_$a$s$b';sub
> d{$h=shift;$h=~s/\$(\w+)/${$1}/g;return$h}sub
>
e{return(shift!=1)?'s':''}for(reverse(1..100)){$s=e($_);$f=d($d);$g=d($e);$c
.="$f\n$g\n$t\n";$_--;$s=e($_);$i=d($d);$c.="$i\n\n";}print"$c*hic*";
You have changed the line wrapping. What is your point?
Oh, and here is another for you to peruse.
Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';
------------------------------
Date: Sun, 17 Jun 2001 02:10:56 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Memory Issues/File Slurping
Message-Id: <3B2C49F0.CE275B6@earthlink.net>
Doug McGrath wrote:
>
> > my $string = qr[ \@((:[^\@]|\@\@)*))\@ ];
>
> > (: \s* branch \s* ([^;]*) ; )?
>
> I've been experimenting, and you're suggestions are a great help --
> thank you! Doing the larger matches is reducing the memory usage
> dramatically. Your suggestions are also giving me some new ideas on
> how to better structure my regex's; they're obvious once I've seen
> them, but I wouldn't have thought of it otherwise.
>
> One further questions -- I can't find the "(:" combination in the docs
> anywhere. It appears to be the equivalent of "(?:" but I haven't been
> able to verify that.
>
> Is it a newer feature? On the one machine I'm using, I have 5.6.1
> installed, but most of our machines are at 5.004_04, and I don't have
> the luxury of updating all of them.
It's a typo. Another is that the line:
my $string = qr[ \@((:[^\@]|\@\@)*))\@ ];
should either be:
my $string = qr[ \@((?:[^\@]|\@\@)*))\@ ]x;
or
my $string = qr[\@((?:[^\@]|\@\@)*))\@];
since the spaces aren't meant to be part of the string. I'm not
entirely sure, but the following change might [or might not] improve it:
my $string = qr[ \@((?:[^\@]+|\@\@)*))\@ ]x;
I think some or all of the \G anchors should actually not be there. The
rcsfile manpage says that items of the <newphrase> catagory can go at
the end of head and delta, and between log and text of deltatext.
Leaving out the \G anchors allows us to skip past any <newphrase> items.
Another mistake is that the <string> items in the deltatext need to be
un-escaped with s/@@/@/g since I forgot.
--
The longer a man is wrong, the surer he is that he's right.
------------------------------
Date: Sun, 17 Jun 2001 14:19:27 +0900
From: "Lee Seung K." <vrman@sl2sys.co.kr>
Subject: Re: more than one execution for wait?
Message-Id: <9ghegr$m8n$1@imsinews.kornet.net>
Thanks Bob,
But if I use the system command
I only get 1 process at a time.
Is there a way that I can get 5 or x number of processes simultaneously?
Thanks!
"Bob Walton" <bwalton@rochester.rr.com> wrote in message
news:3B2BA714.F3CD924B@rochester.rr.com...
> "Lee Seung K." wrote:
> ...
> >
> > exec("$commandexec2");
> > exec("$commandexec3");
> > exec("$commandexec4");
> > exec("$commandexec5");
> >
> > lines get ignored.
> ...
> > Seung
> ...
> In:
>
> perldoc -f exec
>
> you will see:
>
> The exec() function executes a system command AND NEVER RETURNS -
> use system() instead of exec() if you want it to return. It fails and
> ...
>
> --
> Bob Walton
------------------------------
Date: Sun, 17 Jun 2001 05:25:46 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: more than one execution for wait?
Message-Id: <ubXW6.104$T3.192426496@news.frii.net>
In article <9gg470$h4v$1@imsinews.kornet.net>,
Lee Seung K. <vrman@sl2sys.co.kr> wrote:
>The problem with the code below is that it only sends the first line of
>execute.
>So only q1,q6,q11,q16.... directories get emptied and other queues don't get
>sent.
>
> exec("$commandexec2");
> exec("$commandexec3");
> exec("$commandexec4");
> exec("$commandexec5");
>
>lines get ignored.
>
Fork returns twice and exec never returns.
Here is a bit of code below for you to ponder:
#!/usr/bin/perl
use strict;
use warnings;
my $cmd = '/bin/sleep';
my %pid;
my $end = time() +60;
my $p;
sub start_one {
my $s = int(rand()*10);
$p = fork();
if ($p > 0) {
print "started $cmd $s: $p, \n";
$pid{$p}++;
} elsif ( ! defined $p) {
warn "fork failed";
} else {
exec ($cmd, $s);
}
}
for (1..5) {
start_one();
}
while ((keys %pid)[0]) {
delete $pid{$p = wait()};
print $end - time(), " ended $p\n";
next if (time() > $end);
start_one();
}
print "$0: all are done\n";
--
This space intentionally left blank
------------------------------
Date: Sun, 17 Jun 2001 04:21:04 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Need Coding to Enable Two Websites to Share One Form
Message-Id: <QeWW6.102$T3.178385920@news.frii.net>
In article <3B2BD341.440738A2@true-agent.com>,
Jay Reifert <true-agents@true-agent.com> wrote:
>
>Hi All,
>
>I have been all over the web, reviewing various resources and I am
>simply stumped when it comes to finding an answer to the following
>two questions:
>
>When utilizing the "@referers" command in a perl script, is it
>possible to have a form shared by two similar--but different--domains?
>
This appears to be more a question about webservers than it is
about the Perl language. But I'll take a stab any way. Two different
web pages may contain links to the same CGI program by simply
encoding the url properly. That is both pages may contain a URL
that is defined in the domain of one or the other page or even a
third domain all together. If there is a need to sort the data on
the back end that must be done using session data or passing a key
in a hidden field.
Good Luck
chris
--
This space intentionally left blank
------------------------------
Date: Sun, 17 Jun 2001 00:59:01 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Net::IRC connection problems: possible fix
Message-Id: <3B2C3915.6C5516AC@earthlink.net>
smk wrote:
>
> I havent seen this anywhere else so I figured I would post it here.
>
> When I first downloaded Net::IRC right away I got this error:
>
> Connection to the server....
> Can't connect to irc.nexlinks.net:6667! at
> /usr/lib/perl5/site_perl/5.6.0/Net/IRC.pm line 192
> Cannot Connect to the server at /home/xxx/testbot.pl line 7.
>
> The guys at perlmonks.com helped me out right away. These guys are
> great.
>
> This is what you need to do:
>
> Find the Connect.pm in your @INC:
>
> On line 253 on Connection.pm you will see a chunk of code that looks
> something like this:
>
> # This bind() stuff is so that people with virtual hosts can select
> # the hostname they want to connect with. For this, I dumped the
> # astonishingly gimpy IO::Socket. Talk about letting the interface
> # get in the way of the functionality...
>
> #if ($self->hostname) {
> # unless (bind( $sock, sockaddr_in( 0, inet_aton($self->hostname) ))) {
> # carp "Can't bind to ", $self->hostname, ": $!";
> # $self->error(1);
> # return;
> # }
> # }
>
> Just simply comment the whole if statment out like I did and it should
> work.
The error message which the commented out code would produce is
Can't bind to <hostname>: <errno-errmsg>
The error message which you are getting is:
Can't connect to <hostname>:<port>!
How does commenting out the bind stuff fix the connect problem?
> Again the guys at perlmonks saved me alot of time and searching.
> Thanks guys!
--
The longer a man is wrong, the surer he is that he's right.
------------------------------
Date: Sun, 17 Jun 2001 06:32:08 GMT
From: barbr-en@online.no (Kåre Olai Lindbach)
Subject: Re: Newbie Post : Flushing output for long scripts
Message-Id: <3b2c4ee5.1364955365@news.online.no>
On Mon, 4 Jun 2001 15:43:37 +0100, "Ben Holness"
<bholness@nortelnetworks.com> wrote:
>Unfortunately neither of these options solve my problem.
>
>$|=1, which I had already tried, doesn't make any difference.
>
>CGI::Push documentation says that it won't work for IE, which is our
>corporate standard, so no-one uses netscape :(
>
>It's a real pain, because I have a perl script that reads a file, processes
>it, prints a line of text, then reads the next file and so on...
>
>The problem is that the user gets bored waiting, or I get a timeout before
>the script has finished, so it would be nice to be able to feed them a line
>at a time...
Strange, I have a CGI-script taking up to 5-10 minutes running on a MS
IIS (Internet Information Server), using MS IE 4/5 browsers. It search
thru special logfiles and output the relevant (wanted)
context in a HTML-table structure at the end. What I do is that I send
a dot (print "."; # No \n) each time I start with a new file to scan
thru, so the user can see them growing one by one on the line. Before
I put in the dot, they also got timeout on the IE.
It works, and no special setup, either on IIS or IE, although I also
have "$|=1;" at the start of the script. The only thing that strikes
my mind is that I print it there and then outside of a CGI-form.
Regards Kåre Olai Lindbach
------------------------------
Date: 16 Jun 2001 21:29:17 -0700
From: tangfan01@hotmail.com (Kyle Vinson)
Subject: Re: Porblem: Predesignated Runtime?
Message-Id: <abecba05.0106162029.7bcb8b04@posting.google.com>
logan@cs.utexas.edu (Logan Shaw) wrote in message news:<9ge9sb$lo$1@charity.cs.utexas.edu>...
> In article <abecba05.0106151605.63bfc5da@posting.google.com>,
> Kyle Vinson <tangfan01@hotmail.com> wrote:
> >I have what seems to be a tricky problem. Using POE::Component::IRC I
> >have created a group of Perl IRC bots that do various things (log,
> >annoy, etc. ;) One of these bots I am trying to make able to announce
> >something in an IRC channel at a given set of times. Now, it can
> >announce fine, but it can't do it at the correct times. I've tried
> >using sleep, alarm, even using for loops to delay things until it
> >detects at the right time. I am easily able to get times using
> >localtime(), but to be able to detect the time in real time is
> >well-nigh impossible, simply because of the loops required for Perl to
> >watch the time constantly (along with the fact that it never
> >PROGRESSES past that loop to its other functions).
>
> Here's a little clock script I have that prints the time every minute,
> right (about) as the minute changes:
>
> #! /usr/local/bin/perl
>
> $| = 1;
>
> while (1)
> {
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
> = localtime(time);
>
> if ($hour < 12)
> { $ampm = 'AM'; }
> else
> { $hour = $hour - 12; $ampm = 'PM'; }
> if ($hour eq 0)
> { $hour = 12; }
>
> printf (" %2d:%2.2d%s\r", $hour, $min, $ampm);
>
> sleep (60 - $sec) unless $sec >= 60;
> }
>
> Basically, what it does is it figures out the present time and uses
> that information to figure out how long it should sleep. It doesn't
> check the current time after the sleep, although it could if I were
> paranoid (I might want to make it handle receiving asynchronous signals
> like SIGALRM without printing the time unnecessarily).
>
> The way I do the calculations works out to be very easy for me, because
> I don't need to sleep until a particular time; I just need to sleep for
> however many seconds remain of the current minute. That makes the
> math a bit easier.
>
> In your case, what I'd do is use the Time::Local module (which is
> included in the Perl distribution) to convert your target time into a
> an integer number of seconds (i.e. seconds since midnight January 1,
> 1970). Then, you can call the time() function to find the current time
> in the same units, and if you subtract the two, you'll know how long
> (in seconds) it will be until the target time, and then you know
> how long to sleep.
>
> For instance, to sleep until 8:00am Christmas morning this year:
>
> use Time::Local;
>
> $santa_time = timelocal (0, 0, 8, 25, 12-1, 2001);
> $now = time;
>
> sleep ($santa_time - $now);
>
> print "The time now is ", scalar localtime, "\n";
>
> Hope that helps.
>
> - Logan
Well, I've tried doing some things along these lines (sleep until
bleh) but for some reason, it always sleeps BEFORE it runs any of the
commands (in that subroutine) and then does the commands, which is
extremely peculiar to me. That's sort of off-topic, I guess, and I
need to read up more on sleep(), but do you have any idea why it might
be doing this?
Part of the problem I think is that, by virtue of using
POE::Component::IRC, everything is put in subroutines, which can be
troublesome.
I'm alreayd using Time::Local, so I'll give it a shot and see what
happens.
Hmmm... I suppose if I created a script that logged in and joined the
channel, then programmed it to enter a subroutine, which told it to
sleep until $blahtime, it might work. Because the sleep routine won't
run until after it gets the variables like you mentioned above, maybe
it will work...
hmmm..
Well, thanks, I am at least encouraged that this might be possible :)
/TF
------------------------------
Date: 16 Jun 2001 21:36:38 -0700
From: tangfan01@hotmail.com (Kyle Vinson)
Subject: Re: Porblem: Predesignated Runtime?
Message-Id: <abecba05.0106162036.482894da@posting.google.com>
Philip Newton <pne-news-20010616@newton.digitalspace.net> wrote in message news:<obqlito17go8v4fct2bvn7oj4q6euo194b@4ax.com>...
> On 15 Jun 2001 17:05:43 -0700, tangfan01@hotmail.com (Kyle Vinson)
> wrote:
>
> > Even having cron do something that the script can then detect would
> > require it to constantly check this time, right?
>
> Not necessarily. You could try using signals, for example -- have cron
> send, say, SIGUSR1 to your script and install a handler for $SIG{'USR1'}
> that sets a flag.
>
> If your main "loop" is a sleep, then the signal should interrupt the
> sleep. Then check the flag, and if it is set, make your announcement.
> Then reset the flag.
>
> > The way I have it set now, it looks for IRC messages occuring within a
> > certain timeframe (IE, it checks time whenever there's a message, and
> > announces when it sees a message in the times I've set), but this is
> > clunky and unreliable at best, along with annoying, as it will often
> > blither at every message that falls within this time frame (normally a
> > minute long), which causes the Channel OPs to punt the bot.
>
> Again, set a flag after you have made your announcement once. If the
> flag is already set, don't make the announcement again.
>
> Cheers,
> Philip
That sounds like it might work. The script runs on Linux, so no
worries about that. The trick will be getting the script to login to
the IRC server correctly, and then sleep, especially without getting
kicked from the server. See, the server receives no responses to its
pings, and therefore logs the script off. Thus, I'll have to have it
wake up at intervals of probably every minute or so and stay on for 10
seconds or so. But then I can have it catch another SIG to go back to
sleep. Hmmm...
Wel, thanks, I am feeling much more confident that I can make this
work :D
/TF
------------------------------
Date: 16 Jun 2001 23:05:03 -0700
From: isterin@hotmail.com (isterin)
Subject: Re: PPM
Message-Id: <db67a7f3.0106162205.279d38ec@posting.google.com>
That means that you probably screwed up you xml config file, and the
XML::Parser module is giving an error of incorrect token. Go in and
fix the node in the xml file, or if you don't know much about that
reinstall PPM and possible perl and don't mess with the configuration
file.
Ilya
"Joel Fentin" <joel@cts.com> wrote in message news:<01c0f6b6$03529b40$754b5ecc@joel>...
> If I use PPM with the commands: search, verify, & install;
> I get the following error:
> not well-formed at line 1, column 17, byte 17 at
> C:/Perl/site/lib/SOAP/Parser.pm line 73
>
> What does it want?
>
> It works with help, query & set.
>
> It use to work ok. I tried PPM genconfig > ppm.xml
> This got me an empty file called ppm.xml
>
> Winddoz 95, PPM Version 1.1.4, perl version 5.6.0
>
> Thank you
------------------------------
Date: Sun, 17 Jun 2001 02:21:28 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Reval, Regular Expression, and Searching for Emails
Message-Id: <3B2C4C68.9B7E62C2@earthlink.net>
DJ wrote:
>
> Hi.
>
> I am trying to use a feature to allow regular expression searches on
> email addresses. In the file there is an email id like
> Colin.O'Patrick@aol.com
> I use quotemeta and it becomes Colin\.O\'Patrick\@aol\.com.
>
> In my form if I enter "Col" it is found, but if I were to type
> "Colin\.O\'Patrick\@aol\.com" in the input field it is not found.
>
> For example,
> Loop through data in file
> $current_email = email id from current record
> $safe_email = quotemeta($current_email);
> $expression = "'$safe_email' =~ m/" . $form_input_email . "/i";
> $match = Safe->new->reval($expression);
>
> If my $from_input_email is, m/Colin\.O\'Patrick\@aol\.com/i, it
> doesn't match.
> Is there a better way to do this? Any thoughts?
Why are you using eval, in any form? This would probably be better off
as:
while( <DATA> ) {
next unless m[\Q$form_input_email];
# $_ matched. do stuff with it.
}
The \Q here matches until either the next \E, or until the end of the
quoting (which is ] in this case).
This would be even faster:
while( <DATA> ) {
next if index( $_, $form_input_email ) < 0;
# $_ matched. do stuff with it.
}
--
The longer a man is wrong, the surer he is that he's right.
------------------------------
Date: Sun, 17 Jun 2001 05:28:54 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Server Side Includes on IIS
Message-Id: <qeXW6.105$T3.171469824@news.frii.net>
In article <3B2B92B8.E74BB5D7@goldenapple.com>,
Michal T. Winter <mwinter@goldenapple.com> wrote:
>Does anyone know if you can include a "PL" as a SSI on an IIS server and
>how to do it. It does not support it out of the box.
>
>Warren Winter
>
You might want to ask this question in a news group that has IIS somewhere
in it's name.
Good Luck
chris
--
This space intentionally left blank
------------------------------
Date: Sun, 17 Jun 2001 05:19:35 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: strange error on pipe open
Message-Id: <H5XW6.163305$I5.46226655@news1.rdc1.tn.home.com>
I'm having a strange error that I can't debug. It _looks_ like perl dies
when you open a pipe. But it won't just die and store an error to $!, it
just dies and that's it.
This code prints the number 1 (so I know the script works up to here):
print 1;
exit;
open M, "|/usr/lib/sendmail -t" or print $!;
This code gives a server error:
print 1;
open M, "|/usr/lib/sendmail -t" or print $!;
exit;
No error message, just the server error. So what do I do to continue
debugging this? Pipe opens work from perl at the prompt.
$ perl
print 1;
open M, "|/usr/lib/sendmail -t" or print $!;
exit;
1$
What do i do?
------------------------------
Date: Sun, 17 Jun 2001 08:21:41 +0200
From: Philip Newton <pne-news-20010617@newton.digitalspace.net>
Subject: Re: strange error on pipe open
Message-Id: <uvioit856pohhelgk329c2rog8jvdg2hel@4ax.com>
On Sun, 17 Jun 2001 05:19:35 GMT, "Todd Smith" <todd@designsouth.net>
wrote:
> This code gives a server error:
>
> print 1;
> open M, "|/usr/lib/sendmail -t" or print $!;
> exit;
>
> No error message, just the server error.
What does it say in the server's error log?
You could also try putting in "use CGI::Carp qw(fatalsToBrowser);" at
the beginning of the script so you can see the error message, if any,
that Perl is trying to give you.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Sat, 16 Jun 2001 21:53:33 -0400
From: "flash" <bop@mypad.com>
Subject: Re: To find string length?
Message-Id: <k6UW6.73230$QE4.7389222@news20.bellglobal.com>
god damn, I can not spell, good thing someone cought that.
--
#--*--*--*--*--*--*--*--*--*--*--#
# The hypermart faq. #
# http://www.hmdc.f2s.com #
#--*--*--*--*--*--*--*--*--*--*--#
"Tintin" <somewhere@in.paradise.net> wrote in message
news:QlTW6.7$%C7.142356@news.interact.net.au...
>
> "flash" <bop@mypad.com> wrote in message
> news:iNSW6.4767$1L.315425@news20.bellglobal.com...
> > ok,
> >
> > $lenght=lenght($var);
> >
> > (I belive)
>
> or even length()
>
>
>
------------------------------
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 1147
***************************************