[29756] in Perl-Users-Digest
Perl-Users Digest, Issue: 999 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 2 14:10:11 2007
Date: Fri, 2 Nov 2007 11:09:06 -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 Fri, 2 Nov 2007 Volume: 11 Number: 999
Today's topics:
Re: !Help: can't get into perl -MCPAN -e shell <glex_no-spam@qwest-spam-no.invalid>
Forum Script agnes.florida@gmail.com
Re: How to convert csv file to XML using XML::Simple? <mritty@gmail.com>
Re: How to convert csv file to XML using XML::Simple? <tadmc@seesig.invalid>
Re: Looking for a module (or anything) to grab a webcam <nospam@nospam.net>
Mod_Perl / Apache Issue <superman183@hotmail.com>
Re: Mod_Perl / Apache Issue <wahab-mail@gmx.de>
Re: Mod_Perl / Apache Issue <glex_no-spam@qwest-spam-no.invalid>
Re: Mod_Perl / Apache Issue <superman183@hotmail.com>
Re: Mod_Perl / Apache Issue <simon.chao@fmr.com>
Re: runaway memory leak with LWP and Fork()ing on Windo sheinrich@my-deja.com
Re: runaway memory leak with LWP and Fork()ing on Windo <stoupa@practisoft.cz>
Re: runaway memory leak with LWP and Fork()ing on Windo <glex_no-spam@qwest-spam-no.invalid>
Re: Script to find largest files <bugbear@trim_papermule.co.uk_trim>
Sharecycle script agnes.florida@gmail.com
Re: string matching doesn't work <accpactec@hotmail.com>
Windows auto log off <minhaztuhin@hotmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 02 Nov 2007 10:10:52 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: !Help: can't get into perl -MCPAN -e shell
Message-Id: <472b3dfc$0$10300$815e3792@news.qwest.net>
mmccaws2 wrote:
> On Nov 1, 4:32 pm, mmccaws2 <mmcc...@comcast.net> wrote:
> Oh yes, we coordinated a reboot and the above output is even after the
> reboot.
Why would a reboot help? Do a re-build/re-install of perl, might as
well make it the latest version, while you're at it.
No idea how HP does things, but it should involve running make. Make
sure you do the 'make test'.
make
make test ---> this should pass.. maybe a few warnings, but it should
run and not give fatal errors.
make install .. if the tests pass
You probably want to do that on your test box or on one of your
redundant servers first.
------------------------------
Date: Fri, 02 Nov 2007 10:15:05 -0000
From: agnes.florida@gmail.com
Subject: Forum Script
Message-Id: <1193998505.405998.148130@d55g2000hsg.googlegroups.com>
AJ Forum is a professional, powerful, scalable and fully customizable
forums package. It has unlimited categories and forums, read only
forums, Smilies, very friendly bulletin board program and most
important easy set-up.
http://www.ajsquare.com/products/forum/index.php
------------------------------
Date: Fri, 02 Nov 2007 03:55:11 -0700
From: Paul Lalli <mritty@gmail.com>
Subject: Re: How to convert csv file to XML using XML::Simple?
Message-Id: <1194000911.507866.225530@z9g2000hsf.googlegroups.com>
On Nov 1, 10:54 pm, James Egan <jegan...@comcast.net> wrote:
> I need to take a comma separated value (csv) file and convert it to XML.
> I'm trying to do this with XML::Writer. Using XML::Writer I can see how
> to convert FROM an XML document, but I don't see how to take a csv file
> and convert it to XML. If I had a csv file like this:
>
> Robert, Smith, 123 Main St.
> Jane, Smith, 456 Market St.
> William, Watson, 789 First Ave.
>
> How would I convert that to an XML file like this:
>
> <?xml version="1.0" ?>
> <ADDRESSBOOK>
> <CONTACT>
> <FIRST_NAME> Robert </FIRST_NAME>
> <LAST_NAME> Smith </LAST_NAME>
> <ADDRESS> 123 Main St. </ADDRESS>
> </CONTACT>
> <CONTACT>
> <FIRST_NAME> Jane </FIRST_NAME>
> <LAST_NAME> Smith </LAST_NAME>
> <ADDRESS> 456 Market St. </ADDRESS>
> </CONTACT>
> <CONTACT>
> <FIRST_NAME> William </FIRST_NAME>
> <LAST_NAME> Watson </LAST_NAME>
> <ADDRESS> 789 First Ave. </ADDRESS>
> </CONTACT>
> </ADDRESSBOOK>
>
> Any help would be greatly appreciated!
What have you tried so far? How did it not work the way you wanted?
I would use Text::CSV to parse the CSV, and create a hash out of each
line, then pass the resulting data structure to XMLout(), like so:
#!/usr/bin/perl
use strict;
use warnings;
use Text::CSV;
use XML::Simple;
my @col_names = qw/FIRST_NAME LAST_NAME ADDRESS/;
my $csv = Text::CSV->new();
my $xml = { CONTACT => [ ] };
while (<DATA>) {
chomp;
$csv->parse($_);
my @cols = $csv->fields();
my %hash = map { $col_names[$_] => $cols[$_] } 0..$#cols;
push @{$xml->{CONTACT}}, \%hash;
}
print XMLout($xml, RootName => "ADDRESS_BOOK", NoAttr => 1);
__DATA__
Robert, Smith, 123 Main St.
Jane, Smith, 456 Market St.
William, Watson, 789 First Ave
Paul Lalli
------------------------------
Date: Fri, 02 Nov 2007 11:42:10 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: How to convert csv file to XML using XML::Simple?
Message-Id: <slrnfim376.s36.tadmc@tadmc30.sbcglobal.net>
James Egan <jegan472@comcast.net> wrote:
> Robert, Smith, 123 Main St.
> Jane, Smith, 456 Market St.
> William, Watson, 789 First Ave.
>
>
> How would I convert that to an XML file like this:
>
><?xml version="1.0" ?>
><ADDRESSBOOK>
> <CONTACT>
> <FIRST_NAME> Robert </FIRST_NAME>
> <LAST_NAME> Smith </LAST_NAME>
> <ADDRESS> 123 Main St. </ADDRESS>
> </CONTACT>
> <CONTACT>
> <FIRST_NAME> Jane </FIRST_NAME>
> <LAST_NAME> Smith </LAST_NAME>
> <ADDRESS> 456 Market St. </ADDRESS>
> </CONTACT>
> <CONTACT>
> <FIRST_NAME> William </FIRST_NAME>
> <LAST_NAME> Watson </LAST_NAME>
> <ADDRESS> 789 First Ave. </ADDRESS>
> </CONTACT>
></ADDRESSBOOK>
--------------------------
#!/usr/bin/perl
use warnings;
use strict;
while ( <DATA> ) {
chomp;
my($first, $last, $adr) = split /,\s*/;
print <<ENDCONTACT;
<CONTACT>
<FIRST_NAME>$first</<FIRST_NAME>
<LAST_NAME>$last</LAST_NAME>
<ADDRESS>$adr</ADDRESS>
</CONTACT>
ENDCONTACT
};
__DATA__
Robert, Smith, 123 Main St.
Jane, Smith, 456 Market St.
William, Watson, 789 First Ave.
--------------------------
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Fri, 02 Nov 2007 08:22:40 -0400
From: Paul <nospam@nospam.net>
Subject: Re: Looking for a module (or anything) to grab a webcam image
Message-Id: <472b09f3$0$2810$88260bb3@free.teranews.com>
* Tad McClellan wrote, On 11/1/2007 6:53 PM:
> snipped Message-ID
Hmm ... thanks. Didn't think about the fact that I'd been plonked in
that exchange. I've learned a lot in two years, but I don't suppose that
will go very far here.
In case there's any chance at all of anyone answering my question, I'll
repost:
Is there any perl-ish way to capture a USB webcam image and save it to a
file?
Has anyone used Video::Capture::V4l::Imager? I'd just install and start
mucking around with it, but I'm at work now and just thought I'd test
the waters here for some ideas.
--
Paul Burton
paulburto *at* gmail *dot* com
--
Posted via a free Usenet account from http://www.teranews.com
------------------------------
Date: Fri, 02 Nov 2007 08:46:56 -0700
From: Jane <superman183@hotmail.com>
Subject: Mod_Perl / Apache Issue
Message-Id: <1194018416.805153.116580@19g2000hsx.googlegroups.com>
Hi,
This relates to both perl and Apache. I have previously posted to the
Apache group but without getting any response. Hence, since this
relates to both Perl and Apache, I'm hoping someone here can help, or
suggest where I may obtain some help.
My machine died and I'm setting up a new Windows XP box, trying to
emulate the old setup I had, with Apache 2.0 and mod_perl. Everything
used to work fine, but now I've had to download and re-install
everything from scratch.
So, Apache 2.0 is installed and working fine. Download/installed
mod_perl, both via ppm command line, and also via the interface. No
apparent problems during installation either way, but still the same
problem results.
Set up in httpd.conf is as follows (also tried syntax as
Apache::Registry as well):
<Location /cgi2>
SetHandler perl-script
PerlHandler ModPerl::Registry
PerlSendHeader on
Options ExecCGI
</Location>
Also have the following couple of lines:
LoadFile "C:/Perl/bin/perl58.dll"
LoadModule perl_module modules/mod_perl.so
Apache is installed on drive D.
Active State Perl 5.8 is installed on drive C.
Running everything normally (ie. not trying to use mod_perl, by simply
remming out the cgi2 location) works fine.
However, as soon as I try to use mod_perl, I end up with all sorts of
errors in the Apache error log, per below (beginning at the very first
error):
[Thu Nov 01 16:37:41 2007] [error] failed to resolve handler
`ModPerl::Registry'
[Thu Nov 01 16:37:41 2007] [error] [client 127.0.0.1] unknown Apache::
constant EXIT at C:/Perl/site/lib/ModPerl/Const.pm line 52.
BEGIN failed--compilation aborted at C:/Perl/site/lib/ModPerl/
RegistryCooker.pm line 48.
Compilation failed in require at (eval 2) line 3.
...propagated at C:/Perl/lib/base.pm line 91.
BEGIN failed--compilation aborted at C:/Perl/site/lib/ModPerl/
Registry.pm line 26.
Compilation failed in require at (eval 1) line 3.
I seem to have tried everything, but cannot figure this out. I've
successfully installed it on a couple of machines previously, and have
never before seen these errors.
Any information to assist me would be much appreciated.
Thanks!
Jane
------------------------------
Date: Fri, 02 Nov 2007 17:11:43 +0100
From: Mirco Wahab <wahab-mail@gmx.de>
Subject: Re: Mod_Perl / Apache Issue
Message-Id: <fgfi8d$dkh$1@mlucom4.urz.uni-halle.de>
Jane wrote:
> However, as soon as I try to use mod_perl, I end up with all sorts of
> errors in the Apache error log, per below (beginning at the very first
> error):
Did you
- install the correct Apache2-version and the
corresponding mod_perl2-version (how can you tell?)
- remeber that actual Apache 2.2.6 won't work
simply "out of the box" on Windows?
Regards
M.
------------------------------
Date: Fri, 02 Nov 2007 11:15:35 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Mod_Perl / Apache Issue
Message-Id: <472b4d27$0$10296$815e3792@news.qwest.net>
Jane wrote:
> Hi,
>
> This relates to both perl and Apache. I have previously posted to the
> Apache group but without getting any response. Hence, since this
> relates to both Perl and Apache, I'm hoping someone here can help, or
> suggest where I may obtain some help.
>
> My machine died and I'm setting up a new Windows XP box, trying to
> emulate the old setup I had, with Apache 2.0 and mod_perl. Everything
> used to work fine, but now I've had to download and re-install
> everything from scratch.
[...]
> I seem to have tried everything, but cannot figure this out. I've
> successfully installed it on a couple of machines previously, and have
> never before seen these errors.
>
> Any information to assist me would be much appreciated.
http://perl.apache.org/help/index.html
------------------------------
Date: Fri, 02 Nov 2007 09:55:41 -0700
From: Jane <superman183@hotmail.com>
Subject: Re: Mod_Perl / Apache Issue
Message-Id: <1194022541.576213.177980@z9g2000hsf.googlegroups.com>
Hi,
In response to Micro Wahab, above, then, as indicated, I'm using
Apache 2.0.x, not Apache 2.2.x. The mod_perl download was simply a
choice between a version for Apache 2.0.x and one for Apache 2.2.x, so
I chose the former.
In response to J. Gleixner, then okay, that looks like a useful
link ... I'll check that out. Thx.
Meantime, if anyone else has actually experienced this problem, or can
suggest possible solutions, then please still feel free to add
comments.
Many thanks,
Jane
------------------------------
Date: Fri, 02 Nov 2007 17:08:44 -0000
From: nolo contendere <simon.chao@fmr.com>
Subject: Re: Mod_Perl / Apache Issue
Message-Id: <1194023324.493025.64770@o80g2000hse.googlegroups.com>
On Nov 2, 12:55 pm, Jane <superman...@hotmail.com> wrote:
> Hi,
>
> In response to Micro Wahab, above, then, as indicated, I'm using
> Apache 2.0.x, not Apache 2.2.x. The mod_perl download was simply a
> choice between a version for Apache 2.0.x and one for Apache 2.2.x, so
> I chose the former.
>
> In response to J. Gleixner, then okay, that looks like a useful
> link ... I'll check that out. Thx.
>
> Meantime, if anyone else has actually experienced this problem, or can
> suggest possible solutions, then please still feel free to add
> comments.
>
> Many thanks,
> Jane
http://perl.apache.org/download/index.html
The above link states that mod_perl 2.0 is for use with Apache 2.0.x/
2.2.x.
------------------------------
Date: Fri, 02 Nov 2007 08:00:24 -0700
From: sheinrich@my-deja.com
Subject: Re: runaway memory leak with LWP and Fork()ing on Windows
Message-Id: <1194015624.001333.43380@50g2000hsm.googlegroups.com>
Without delving too deep into your problem I think you could give a
try to my attached module PreforkAgent.pm.
It was made for very much the same task - stress testing a website in
fact.
You could probably use the module in your script without any
adaptations. Just follow the pod instructions on how to set up your
callback routines.
In contrast to your current concept the specified number of children
is created only once before the actual work starts. And each returning
child is immediantly given the next task as long as there are any
more.
Under Linux the Module works like a charm with up to 500 children.
Because the overhead for the forks is all done beforehand it's
possible to create a heavy load on a target web (or any other) server
with only moderate local means.
If you want to put a cap on the load, you will need to do so in your
wrapper script.
Because I never tried it in Windows I'd be delighted to hear how you
fare.
Cheers, Steffen
#
# PreforkAgent
#
# Allows execution of many jobs in parallel.
# All parent / child communication is implemented with pipes.
# Only the signal INT is caught by the parent for cleanup purposes.
#
# Steffen Heinrich - Jun 2007
#
package PreforkAgent;
use strict;
my $VERSION = '0.03';
#################################################
# libs and class vars
use IO::Select;
my $EOF_MSG_SEQ = "\x1F"; # ASCII cotrol character US (Unit Separator)
############################
# constructor
sub new {
my $class = shift;
my $me = bless {
debug_out => 0,
parent => $$,
listener => IO::Select->new(),
kids_to_spawn => 0,
kids => 0,
living => {},
pids => {},
jobs => {},
child_prepare => sub {1}
}, $class;
$me
}
############################
# methods
sub register {
# registers one or more callback routines with the agent
my $self = shift() or return;
my %subs = @_ or return;
my @errors;
while (my ($s, $c) = each %subs) {
if ($s !~ /^(child_prepare|fetch_next_task|process_job|
process_response)$/) {
push @errors, "'$s' is not a known sub";
} elsif (defined($c) && ref($c) && ref($c) =~ /CODE/) {
$self->{$s} = $c;
} else {
push @errors, "'$s' does not reference a sub";
}
}
die join("\n", @errors)."\n" if @errors;
}
sub spawn {
# creates a given number of children
# and opens bidrectional pipes for each
my $self = shift() or return;
my $kids_to_spawn = shift() or return;
$self->{kids_to_spawn} = $kids_to_spawn;
my $process_job = $self->{process_job}
or die "process_job() must have been registered with PreforkAgent
before a call to spawn()!\n";
my $sel = $self->{listener};
# prevent zombies since we won't wait()
$SIG{CHLD} = 'IGNORE';
# fork loop
for my $child (1..$kids_to_spawn) {
my $whdl = 'W'.$child;
my $rhdl = 'R'.$child;
{ no strict 'refs';
# open bidirect comm
pipe $rhdl, WH or die "pipe1: $!"; # parent <- child
pipe RH, $whdl or die "pipe2: $!"; # child <- parent
# register the read handle with the ones to listen to
$sel->add(\*$rhdl);
}
# save write handle connected with readhandle
$self->{living}{$child} = $whdl;
select((select(WH), $| = 1)[0]); # autoflush
select((select($whdl), $| = 1)[0]); # autoflush
my $pid;
unless ($pid = fork()) {
# Child process
# closes unnecessary handles
close $rhdl;
close $whdl;
# execute individual initialization
my $init = $self->{child_prepare};
defined(&$init($child)) or die;
# creates a new listener
$sel = IO::Select->new;
# registers the one handle to listen to
$sel->add(\*RH);
# signals readiness
_write_into_pipe(\*WH, 'READY');
while ($sel->can_read) {
my $job = _read_from_pipe(\*RH);
if ($job eq 'QUIT') {
last;
} else {
# do something
my $answer = &$process_job($job, $child);
_write_into_pipe(\*WH, $answer);
}
}
# child is done, unload and quit
$sel->remove(\*RH);
close WH;
close RH;
exit 0;
}
# Parent process closes unnecessary handles
close WH;
close RH;
# and registers child
$self->{pids}{$child} = $pid;
# parent catches SIGINT
$SIG{INT} = sub {$self->cleanup()}
unless $self->{kids}++;
} # loop to start others
($self->{kids} == $self->{kids_to_spawn})
or die "Could only spawn $self->{kids} kids of $self-
>{kids_to_spawn}: $!";
$self->{kids}
} # end of spawn()
sub assign {
# Sending out jobs to any child which is ready to listen
# and collecting any responses which are then being reported to the
registered callback.
# As long as their are more jobs to do, they are being immediately
assigned to returning children.
my $self = shift() or return;
my $fetch_next_task = $self->{fetch_next_task};
my $process_response = $self->{process_response};
($fetch_next_task && $process_response)
or die "fetch_next_task() and process_response() must have been
registered with PreforkAgent before a call to assign()!\n";
$self->{kids} > 0
or die "You need to call spawn(kids) before assigning jobs!\n";
my $sel = $self->{listener};
# work loop
while ($self->{kids}) {
my $not_finished = 1;
while (my @ready = $sel->can_read) {
foreach my $rhdl (@ready) {
my $child = '';
{ no strict 'refs';
*{$rhdl} =~ /^(.+::)?R(\d+)$/
and $child = $2;
}
my $whdl = $self->{living}{$child};
my $response = _read_from_pipe($rhdl);
unless ($response eq 'READY') {
&$process_response($response, $child);
}
# assign next task
my $task = undef;
$not_finished = $not_finished && defined($task = &
$fetch_next_task($child));
if ($child && $whdl && $not_finished) {
_write_into_pipe($whdl, $task);
$self->{jobs}{$child}++ if $self->{debug_out};
} else {
# tell child to exit
_write_into_pipe($whdl, 'QUIT');
# unregister child
$sel->remove($rhdl);
delete $self->{living}{$child};
# close handles to child
close $rhdl;
close $whdl;
$self->{kids}--;
}
}
}
}
# since all children exited and we set SIGCHLD = IGNORE
# we don't have to wait()
if ($self->{debug_out}) {
my $job_cnt = $self->{jobs};
foreach my $child (sort {$job_cnt->{$b} <=> $job_cnt->{$a}} keys %
$job_cnt) {
printf "%4s: %5d\n", $child, $job_cnt->{$child};
}
}
$self->cleanup();
} # end of assign()
############################
# subroutines
sub _read_from_pipe {
my ($fh) = @_;
my $blksize = (stat $fh)[11] || 16384;
my $offset = 0;
my $buf = '';
while (my $len = sysread($fh, $buf, $blksize, $offset)) {
if (!defined $len) {
next if $! =~ /^Interrupted/;
die "System Read Error: $!\n";
}
$offset += $len;
last if $buf =~ s/$EOF_MSG_SEQ$//o;
}
$buf
}
sub _write_into_pipe {
my ($fh, $msg) = @_;
$msg .= $EOF_MSG_SEQ;
my $length = length($msg);
my $blksize = (stat $fh)[11] || 16384;
my $offset = 0;
while ($length) {
my $len = syswrite($fh, $msg, $blksize, $offset);
die "System Write Error: $!\n"
unless defined $len;
$length -= $len;
$offset += $len;
}
$offset
}
sub cleanup {
my $self = shift() or return;
# only for parent
return unless $self->{parent} == $$;
# print "\$kids = $self->{kids}\n";
# print "\%living count = ", scalar(keys %{$self->{living}}), "\n";
# print "select bitmap = '", defined $self->{listener}->bits()?
(unpack 'b*', $self->{listener}->bits()):'', "'\n";
while (my ($kid, $pid) = each %{$self->{pids}}) {
my $ps = `ps $pid`;
if ($ps =~ /$0\b/so) {
print STDERR "killing $pid\n";
`kill $pid`;
}
delete $self->{pids}{$kid};
}
}
1
__END__
=pod
=head1 NAME
PreforkAgent - A dispatch wrapper for simultanous tasks.
=head1 PURPOSE
Any big number of similar tasks that have to be run in parallel with
outmost throughput.
First, a given number of children is spawned. Then each of them is
handed the next task
from a common queue in succsession as they return with a response.
=head1 SYNOPSIS
use PreforkAgent;
my $pfa = PreforkAgent->new or die;
$pfa->register(
child_prepare => \&individual_init, # this sub is optional
fetch_next_task => \&next_job,
process_job => \&dispatch,
process_response => \&collect_response
);
my $GLOBAL_VAR = "fancy value";
my $kid_count = $pfa->spawn(5) or die;
$pfa->assign();
exit;
sub individual_init {
# child will die if false is returned
# this sub is optional
my $child_id = shift() or return;
# Child context:
# can read $GLOBAL_VAR at time of spawn(), but not change
# any initialization to be done by each child goes here
...
return $success;
}
sub next_job {
# must return a string, which will be subsequently passed to
dispatch()
# and MUST return undef, if finished.
# Enables the main program to tie a certain job to a specific
child's response returned in collect_response().
my $child_id = shift;
# Parent context:
# can read AND write $GLOBAL_VAR
...
return $str_job;
}
sub dispatch {
# defines the parallel task for the children
# processes the job and returns a serialized response
my $str_job = shift() or return;
my $child_id = shift() or return;
# Child context:
# can read $GLOBAL_VAR at time of spawn(), but not change
...
return $str_response;
}
sub collect_response {
# allows the main program to evaluate any of the child's reponses
my $response = shift() or return;
my $child_id = shift() or return;
# Parent context:
# can read AND write $GLOBAL_VAR
...
}
=head1 SEE ALSO
ParallelUserAgent by Marc Langheinrich
=head1 VERSION
This document describes version 0.03.
=head1 LICENSE
Copyright (C) 2007, Steffen Heinrich. All rights reserved.
This module is free software;
you can redistribute it and/or modify it under the same terms as Perl
itself.
=cut
------------------------------
Date: Fri, 2 Nov 2007 15:46:11 +0100
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: runaway memory leak with LWP and Fork()ing on Windows
Message-Id: <fgfd9v$e2a$1@ns.felk.cvut.cz>
bulk88@hotmail.com wrote:
> I am trying to non-blocking/asynchronously fetch/work with websites as
> a standalone program (not a server script).
[...]
> I assume there is a problem with LWP somehow. I would rather not use a
> real threading library. It seems unnecessary and not KISS. Can someone
> help?
>
Fork is bad idea on Win platform ;-) Go to CPAN and look for
Win32::ProcFarm.
I did something with multiple LWP reads too and this module resolved my
problems excelently.
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
------------------------------
Date: Fri, 02 Nov 2007 10:20:59 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: runaway memory leak with LWP and Fork()ing on Windows
Message-Id: <472b405c$0$498$815e3792@news.qwest.net>
bulk88@hotmail.com wrote:
> I am trying to non-blocking/asynchronously fetch/work with websites as
> a standalone program (not a server script).
>
> My idea is to use Perl, LWP, and simple perl-provided forking on Win32
> (Windows XP in my case). Child threads do not need to talk back
> anything to the parent. Parent fires a bunch of childs off, and
> wait()s for them to complete, then fires off more children in a loop.
> My code has a severe memory leak. I have isolated it into the code
> below.
[...]
> Keywords: ...
No need for you to put 'Keywords' in your post.
>
> I assume there is a problem with LWP somehow. I would rather not use a
> real threading library. It seems unnecessary and not KISS. Can someone
> help?
You could look at LWP::Parallel::UserAgent
And a helpful article using it, by Randal:
http://www.stonehenge.com/merlyn/WebTechniques/col27.html
------------------------------
Date: Fri, 02 Nov 2007 14:05:15 +0000
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: Script to find largest files
Message-Id: <13imbkrgjltbh57@corp.supernews.com>
groups.user@gmail.com wrote:
> Hi Script Gurus..
>
> i'm looking for a script to find the largest files in a filesystem,
> ordered by size.
>
du -s /* | sort -rn
HTH
BugBear
------------------------------
Date: Fri, 02 Nov 2007 10:16:54 -0000
From: agnes.florida@gmail.com
Subject: Sharecycle script
Message-Id: <1193998614.334733.66500@o3g2000hsb.googlegroups.com>
AJCycle is a fully functional share cycle website! With full
administration controls, users need no programming experience to
change many site features. It is a complete web application developed
using PHP with MYSQL as back-end. Full developer API allows for
endless possibilities and use in your own project!
http://www.ajsquare.com/products/sharecycle/index.php
------------------------------
Date: Fri, 02 Nov 2007 17:32:10 -0000
From: Jack <accpactec@hotmail.com>
Subject: Re: string matching doesn't work
Message-Id: <1194024730.026878.43090@z24g2000prh.googlegroups.com>
On Nov 1, 3:47 pm, "Dr.Ruud" <rvtol+n...@isolution.nl> wrote:
> Jack schreef:
>
> > if (@content =~ m/<h1>Mr.*<\/h1>/){
> > print "here " . $1;
> > }
>
> $ perl -le'
> # use warnings;
> @c = qw(abc de fghi);
> if (@c =~ /([bdg0-9])/) {
> print $1;
> }
> '
> 3
>
> --
> Affijn, Ruud
>
> "Gewoon is een tijger."
I used Mirco Wahab's solution and it worked for some of the cases but
now I am stuck at parsing this line.
<td class="profile">Address<br>City State V2X
6J3<br>Canada<br>
</td><td align="right" class="profile"><nobr><b>Phone: </
b>555-555-5555</nobr>
</td>
I want to parse each section into a variable using qr. so for the
Address I used
<td[^>]+> ([^<]+) <br> # this line works fine and I get the address
portion
.+?
<br> ([^&]+)  \; # this part doesn't work meaning that I
don't get anything for city
Any help would much appreciated.
------------------------------
Date: Fri, 02 Nov 2007 10:54:45 -0700
From: Babul <minhaztuhin@hotmail.com>
Subject: Windows auto log off
Message-Id: <1194026085.541265.123660@o3g2000hsb.googlegroups.com>
Hello,
I wrote a program in Perl for windows and using that on Windows XP. It
has a Start and Stop button and the program starts running when the
user click on the Start button. Now I want to add some code in my
program so that when the Windows Auto Log Off triggered (if the
computer is idle for 15 minutes), at the same time my program will
stop running. I don't know how to synchronize my program with Windows
auto log off option. I would appreciate any help/idea.
Thanks.
Babul
------------------------------
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 999
**************************************