[29384] in Perl-Users-Digest
Perl-Users Digest, Issue: 628 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 6 21:10:22 2007
Date: Fri, 6 Jul 2007 18:09:10 -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, 6 Jul 2007 Volume: 11 Number: 628
Today's topics:
Re: [Job Opening] Experienced Perl Developer <dha@panix.com>
Re: Asynchronous forking(?) processes on Windows <tbrazil@perforce.com>
Re: dump_results <mgjv@tradingpost.com.au>
Re: Help finding CGI files on Unix server <tadmc@seesig.invalid>
Re: improvement suggestion for File::Find: pre-parsed e <bik.mido@tiscalinet.it>
Re: IO::Socket::Multicast in limbo? <rgbingham@gmail.com>
Iterating over a hash <steamaccount2@gmail.com>
Re: Iterating over a hash <noreply@gunnar.cc>
Re: Iterating over a hash xhoster@gmail.com
Re: Iterating over a hash <tadmc@seesig.invalid>
Re: Iterating over a hash <dummy@example.com>
Re: Online banking robot (automate the logon with LWP) <hawkmoon1972@hotmail.com>
re-lurking <invalid@invalid.nyet>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 6 Jul 2007 18:17:32 +0000 (UTC)
From: "David H. Adler" <dha@panix.com>
Subject: Re: [Job Opening] Experienced Perl Developer
Message-Id: <slrnf8t1ps.o3q.dha@panix2.panix.com>
On 2007-07-05, Azri Careers <azricareers@gmail.com> wrote:
>
> Join our highly motivated and dedicated team to embark upon a
You have posted a job posting or a resume in a technical group.
Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.
Had you read and understood the Usenet user manual posted frequently to
"news.announce.newusers", you might have already known this. :) (If
n.a.n is quieter than it should be, the relevent FAQs are available at
http://www.faqs.org/faqs/by-newsgroup/news/news.announce.newusers.html)
Another good source of information on how Usenet functions is
news.newusers.questions (information from which is also available at
http://www.geocities.com/nnqweb/).
Please do not explain your posting by saying "but I saw other job
postings here". Just because one person jumps off a bridge, doesn't
mean everyone does. Those postings are also in error, and I've
probably already notified them as well.
If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.
http://jobs.perl.org may be of more use to you
Yours for a better usenet,
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"We Americans stand on the shoulders of freaks." - Doctor Demento
------------------------------
Date: Fri, 06 Jul 2007 15:15:17 -0700
From: Tim <tbrazil@perforce.com>
Subject: Re: Asynchronous forking(?) processes on Windows
Message-Id: <1183760117.564007.87210@j4g2000prf.googlegroups.com>
Hi Xho
Once again and again and again .. thx
You are indeed a unique individual who for some reason persist in
helping me through this adventure. And yes, it has been an adventure.
I delayed my response because we (my boss and I) wanted to review
where things are with this project. If it wasn't for the Windows
requirement I'd say we'd be in good shape. However Perl on Windows
doesn't seem to operate at the same level of efficiency and
functionality as the *NIX platforms. Go figure... ;)
I ran your latest script which implements the select statement. It
seems to work nicely on OSX and Linux but locks up on Windows. On
Windows, all the children *do* execute completely but the output is
never released to? or read? by the parent. As a matter of fact, the
STDOUT from some of the "Forked pid $pid" statements never get
displayed. Considering there are 10 children getting spawn See below.
C:\Documents and Settings\tbrazil\Desktop>perl xho.pl
Forked pid -1556.
Forked pid -236.
Forked pid -2868.
Forked pid -2296.
Forked pid -568.
Forked pid -1932.
Forked pid -472. <--------- Only 7 children are
shown
Terminating on signal SIGINT(2) <--------- I control-C'ed after the
hand
Attempt to free unreferenced scalar: SV 0x2fd808, Perl interpreter:
0x281028.
Terminating on signal SIGINT(2)
Attempt to free unreferenced scalar: SV 0x2fd808, Perl interpreter:
0x281028.
C:\Documents and Settings\tbrazil\Desktop>perl xho.pl
Forked pid -1528.
Forked pid -1848.
Forked pid -2376.
Forked pid -712.
Forked pid -1076.
Forked pid -2516. <------- only 6 are displayed here
<-------- now we are in "hang city"
The reason why I don't see the full 10 processes is probably to the
buffer not getting flushed. However the parent never displays the
piped "data" info from the children.
We thought we might try to store the results of each children in an
array so that the child processes can end at their own rate and then
collect the process data subsequent to the run. Here's the code.
my $nchildren = 7;
for( $ichild = $nchildren; $ichild > 0; $ichild-- )
{
pipe RFH, WFH;
if( $pid = fork )
{
#
# Only executed in the parent.
#
print "Forked pid $pid.\n";
open $rfhs{ $pid }, "<&RFH";
close WFH;
}
elsif( defined $pid )
{
#
# Only executed in the children.
#
close RFH;
@output = `$cmd 2>&1`; # here's the difference
print WFH @output; # sorry I didn't add the
lexical FH's yet
print WFH "Exit status is ", $? >> 8, ".\n";
close WFH;
exit;
}
else
{
print "fork failed!\n";
exit 1;
}
}
close RFH;
foreach $pid ( keys %rfhs )
{
$rfh = $rfhs{ $pid };
print "\n$pid completed. It's output is:\n", <$rfh>;
close $rfh;
waitpid $pid,0;
}
Ultimately I end up with the same problem I started with. It can't
handle a large amount of data without locking up. BTW, I discovered
that you can only spawn 66 forks on Windows before it fails to fork.
It must be a limitation. It consistently fails after 66.
In summary, I wanted to let you know where thing stand with this
email. I do not expect any more help from you however I'm always up
for any last pointers. At this point (actually a few points back) you
have gone above and beyond. As a side note, I am a docent on Alcatraz
every other weekend. If you are ever in SF area of CA you should look
me up and I'll give you a tour. I need to figure out how to give you
my phone number without posting it here. You can always call Perforce
and ask for Tim Brazil.
Thx - Tim
------------------------------
Date: Sat, 7 Jul 2007 09:12:51 +1000
From: Martien verbruggen <mgjv@tradingpost.com.au>
Subject: Re: dump_results
Message-Id: <slrnf8tj3j.sh4.mgjv@martien.heliotrope.home>
On Tue, 03 Jul 2007 06:49:02 -0700,
aaron80v@yahoo.com.au <aaron80v@yahoo.com.au> wrote:
> On Jul 3, 8:34 pm, Martien verbruggen <m...@tradingpost.com.au> wrote:
>> On Tue, 03 Jul 2007 04:13:25 -0700,
>> aaron...@yahoo.com.au <aaron...@yahoo.com.au> wrote:
>>
>>
>>
>> > Does anyone know if DBI dump results API allow a dump without putting
>> > single quotes around the column values?
>>
>> DBI::dump_results() calls DBI::neat_list() for each row, which calls
>> DBI::neat() for each element. DBI::neat() quotes string valuess, which
>> is, I presume, what you're asking about?
>> What is the purpose of your question?
> The purpose is to get the right value delimiter such as double-quote,
> no quote at all etc for batch load data into database. For example, by
> default using dump_results(), even integer, smallint, decimal are
> delimited with single quote which during loaded will be mistaken to be
> varchar.
dump_results() is meant, according to the DBI documentation, to provide
output for humans. Specifically it states:
Since it uses "neat_list" to format and edit the string for reading
by humans, it is not recomended for data transfer applications.
So you're using a function for a purpose for which it is specifically
documented not to be meant. I suggest that maybe you need to have a look
at the DBI::Dumper module, or maybe you should simply override
DBI::neat() as I suggested.
Martien
--
|
Martien Verbruggen | Failure is not an option. It comes bundled
| with your Microsoft product.
|
------------------------------
Date: Sat, 07 Jul 2007 00:39:06 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Help finding CGI files on Unix server
Message-Id: <slrnf8tmsv.c51.tadmc@tadmc30.sbcglobal.net>
bassintro <bassintro@gmail.com> wrote:
> Would a server be exploitable if the ScriptAlias variable was defined
> but the dir did not exist?
>
> On one server I want to run cgi scripts and the other one I don't at
> all. Server A has the script alias variable defined in httpd.conf but
> the dir doesn't exist. Server B has the script alias variable defined
> and the dir does exist with strict permissions.
> Does it really matter or should I just comment the Alias out?
There is no Perl content in your questions above.
Please ask web server questions in a newsgroup about web servers.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Fri, 06 Jul 2007 20:46:26 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: improvement suggestion for File::Find: pre-parsed extensions
Message-Id: <lnus83pcb9ok6o0q14bht8t4gbhcrk9am5@4ax.com>
On Fri, 06 Jul 2007 12:21:12 -0400, Ted Zlatanov <tzz@lifelogs.com>
wrote:
>I really don't feel like arguing over semantics and what "Unix" cares
>about. My goal is to improve the user experience. Let's agree
Laudable attempt. But then it is my impression from the responses you
got here, that you wouldn't.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 06 Jul 2007 21:55:56 -0000
From: RayB <rgbingham@gmail.com>
Subject: Re: IO::Socket::Multicast in limbo?
Message-Id: <1183758956.643244.236760@m37g2000prh.googlegroups.com>
On Jul 5, 11:44 pm, Thomas Kratz <ThomasKr...@REMOVEwebCAPS.de> wrote:
> Did you try to use my posted send script to test the multicasts locally?
> If yes, I would bet on some OS issue. Do you have anything else on your
> machine that is successfully receiving multicasts?
Hey Thomas, Thanks a ton for your help. I tried the little send script
and to my surprise it worked. I captured the working packets along
side the nonworking ones, and saw almost immediately that I'd been
listening to the wrong port the whole time... 1119 not 1118... Sigh...
I then proceeded to bang my head against the wall for a while... :)
Your help was invaluable, though I feel ridiculous posting the
solution behind the problem... :)
--Ray
------------------------------
Date: Fri, 06 Jul 2007 14:39:35 -0700
From: limitz <steamaccount2@gmail.com>
Subject: Iterating over a hash
Message-Id: <1183757975.743459.272680@57g2000hsv.googlegroups.com>
Hey I have a question with iterating over a hash.
For example, if I have a hash table %hash1:
%hash1(
1 => 1,
2=> 2,
3=> 3,
);
And given this string 123123123123.
How would increment the values in the hash every time it recognizes
the value?
For example:
$numbers = 123123123123;
$beginning = <STDIN>;
print "Input Ending Base Number:\n";
$end = <STDIN>;
$length = $end-$beginning+1;
$one = '1';
$onecount = 0;
for my $i (0 .. $length-1) {
my $count = substr($numbers, $i, 2);
if ($count =~ $one) {
$onecount++;
}
}
Instead of copy and pasting this code three times and changing the
variable names. How would I have it directly read into the hash and
iterate over the hash?
Thanks
------------------------------
Date: Sat, 07 Jul 2007 00:13:06 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Iterating over a hash
Message-Id: <5f7t9gF3bm2tjU1@mid.individual.net>
limitz wrote:
> Hey I have a question with iterating over a hash.
>
> For example, if I have a hash table %hash1:
>
> %hash1(
> 1 => 1,
> 2=> 2,
> 3=> 3,
> );
>
> And given this string 123123123123.
>
> How would increment the values in the hash every time it recognizes
> the value?
To me, the problem you describe rather seems to be about iterating over
a string of digits. Are you after something like this?
#!/usr/bin/perl
use strict;
use warnings;
my %hash = ( 1 => 0, 2 => 0, 3 => 0 );
my $digits = '123123123123';
foreach my $dig ( split //, $digits ) {
$hash{$dig}++ if exists $hash{$dig};
}
print "$_: $hash{$_}\n" for keys %hash;
__END__
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 07 Jul 2007 00:19:29 GMT
From: xhoster@gmail.com
Subject: Re: Iterating over a hash
Message-Id: <20070706201932.254$8E@newsreader.com>
limitz <steamaccount2@gmail.com> wrote:
> Hey I have a question with iterating over a hash.
>
> For example, if I have a hash table %hash1:
>
> %hash1(
> 1 => 1,
> 2=> 2,
> 3=> 3,
> );
>
> And given this string 123123123123.
>
> How would increment the values in the hash every time it recognizes
> the value?
> For example:
> $numbers = 123123123123;
You may want to make that a string rather than a number, or at some
point you will lose precision.
$numbers = '123123123123';
>
> $beginning = <STDIN>;
> print "Input Ending Base Number:\n";
> $end = <STDIN>;
> $length = $end-$beginning+1;
Since we don't know what it is you type in for STDIN, this makes a poor
example. I would be better to hard-code the values you want for testing
purposes.
>
> $one = '1';
> $onecount = 0;
> for my $i (0 .. $length-1) {
> my $count = substr($numbers, $i, 2);
> if ($count =~ $one) {
> $onecount++;
> }
> }
Assuming this actually does what you want (in which case you want
something quite strange--counting how many of the overlapping "digraphs"
(not exactly the right word--every combination of two adjacent letters
taken together, with some possible weirdenss as the end of the string if
$length is the same or longer than length $numbers) of a string contain a
digit in at least one of the two places in the digraph), then you could do
it something like this:
my %hash1=(
1 => 0,
2=> 0,
3=> 0,
);
for my $i (0 .. $length-1) {
foreach (keys %hash1) {
$hash1{$_}++ if substr($numbers, $i, 2) =~ /$_/;
}
}
If performance was important, you could use index rather than a regex,
or try switching the nesting of the inner and outer loops, or a variety
of other things.
On the other hand, if the code you posted doesn't do what you want in the
first place, then it isn't clear what you want.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Sat, 07 Jul 2007 00:39:07 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Iterating over a hash
Message-Id: <slrnf8tn1s.c51.tadmc@tadmc30.sbcglobal.net>
limitz <steamaccount2@gmail.com> wrote:
> $length = $end-$beginning+1;
^^
^^
> for my $i (0 .. $length-1) {
^^
^^
What is the point of adding one followed by subtracting one?
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Sat, 07 Jul 2007 00:49:14 GMT
From: "John W. Krahn" <dummy@example.com>
Subject: Re: Iterating over a hash
Message-Id: <eqBji.22143$tB5.11875@edtnps90>
limitz wrote:
> Hey I have a question with iterating over a hash.
>
> For example, if I have a hash table %hash1:
>
> %hash1(
> 1 => 1,
> 2=> 2,
> 3=> 3,
> );
>
> And given this string 123123123123.
>
> How would increment the values in the hash every time it recognizes
> the value?
> For example:
>
> $numbers = 123123123123;
$hash1{ $_ }++ for $numbers =~ /[123]/g;
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
------------------------------
Date: Fri, 06 Jul 2007 14:05:49 -0700
From: Tony <hawkmoon1972@hotmail.com>
Subject: Re: Online banking robot (automate the logon with LWP)
Message-Id: <1183755949.594231.130710@m36g2000hse.googlegroups.com>
> http://search.cpan.org/~dave/Finance-Bank-Barclays-0.12/Barclays.pm
That looks promising, thanks very much Rob.
------------------------------
Date: Fri, 6 Jul 2007 20:46:56 -0400
From: "Wade Ward" <invalid@invalid.nyet>
Subject: re-lurking
Message-Id: <i-ednehWnvxefxPbnZ2dnUVZ_qyjnZ2d@comcast.com>
I have tried to get perl scripts to work for me and failed at it enough to
consider the endeavor a failure. I appreciated very much forum help as I
tried to do something that I thought was attainable, but erred. I'll leave
you with my chat conversation with my isp, which I think has elements of
humor. Thanks again for your help.
--
Wade Ward
Jenny > Hello dtyi, Thank you for contacting Comcast Live Chat Support. My
name is Jenny. Please give me one moment to review your information.
dtyi > hello?
Jenny > How may I help you?
dtyi > I'm wondering if there's another name for my news server
Jenny > I can help you with your Internet issues, Dtyi. One moment please as
I look into this for you.
dtyi > The name I have is newsgroups.comcast.net
dtyi > Are there authentication procedures that are peculiar to comcast?
Jenny > For information on our Comcast News Server settings, please visit:
http://www.comcast.net/help/faq/index.jsp?faq=Newsgroupstop18224
Jenny > May I ask why you are asking, 'Are there authentication procedures
that are peculiar to comcast'?
dtyi > I'm writing a perl script that simply can't get through your server
Jenny > Are you getting an error message, Dtyi? If yes, may I have the exact
error message please?
dtyi > sure:
dtyi > #!/usr/bin/env perl
use strict;
use warnings;
use Net::NNTP;
$|=1;
my $USER = 'zaxfuuq@comcast.net';
my $PASSWD = '';
my $SERVER = 'anything'; # aka news.comcast.giganews.com
my $GROUP = 'comp.lang.perl.misc';
my $FILE = 'articles.txt';
my $DAYS = 3;
my $nntp = Net::NNTP->new($SERVER, { Debug => 1} );
print "new($SERVER) returned $nntp\n";
print "authinfo($USER,***) ";
$_ = $nntp->authinfo($USER,$PASSWD) ? 'succeeded' : 'failed';
print "$_\n";
print "group($GROUP) ";
$_ = $nntp->group($GROUP) ? 'succeeded' : 'failed';
print "$_\n";
my $time = time() - $DAYS*24*60*60;
print "Looking for articles since ".localtime($time)."\n";
my $msg_ids_ref = $nntp->newnews($time);
die "Failed to retrieve message ids\n" unless $msg_ids_ref;
open my $ofh, '>', $FILE
or die "Cannot open $FILE: $!";
for my $msg_id (@{$msg_ids_ref}) {
$nntp->article($msg_id, $ofh)
or die "Failed to retrieve article $msg_id\n";
}
close $ofh;
dtyi > Use of uninitialized value in concatenation (.) or string at perl6.pl
line 15.
Can't call method "authinfo" on an undefined value at perl6.pl line 18.
Jenny > Thank you. One moment please as I will look into this further for
you.
Jenny > Still checking.
dtyi > Can I create a secondary acct for newsgroups that has a different
password than the primary
Jenny > Checking.
Jenny > Do you have more than one email account with us?
dtyi > no
Jenny > More information to come.
Jenny > You can add upto 6 more user names to your Comcast Internet service
which would give you a total of 7 email addresses. Then if you wanted, you
can access newsgoups using these email addresses as well.
Jenny > To add new user names or email addresses to your account, please
visit:
http://www.comcast.net/help/faq/index.jsp?faq=Account_ManagementAdditional_Accounts17476
Please note that step 2 should read: Under SECONDARY ACCOUNTS(?), select
Create a secondary account.
Jenny > More information to come in regards to your original question.
dtyi > alright
dtyi > It's a perl script. I think it's ironic that I can get news with OE
and other apps, but can't with a computer language that was designed to do
this.
Jenny > With regards to Pearl Script and Newsgroups, it is outside of our
support boundaries.
Jenny > Sorry about that Dtyi and I am seeing where you can get support.
dtyi > alright thx for your help
Jenny > For further assistance with Newsgroups, you can visit:
Jenny > http://sitesearch.comcast.net/?q=newsgroups
Jenny > and
Jenny > http://www.comcast.net/help/faq/
Jenny > Also at the http://www.comcast.net/help/faq/ site, we have Help
Forums that you can access for further assistance.
Jenny > I sincerely apologize for any inconveniences this may cause you.
Jenny > Is there anything else I can help you with today?
dtyi > no sweat
dtyi > nope
Jenny > Thank you for contacting Comcast. Please do not hesitate to contact
us. We are available 24 hours a day via email, chat and voice support. One
can also get help at our helpsite, http://www.comcast.net/help/ and at our
faqs site, www.comcast.net/help/faq/.
Jenny > Analyst has closed chat and left the room
------------------------------
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 628
**************************************