[29630] in Perl-Users-Digest
Perl-Users Digest, Issue: 874 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 22 03:09:40 2007
Date: Sat, 22 Sep 2007 00: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 Sat, 22 Sep 2007 Volume: 11 Number: 874
Today's topics:
Re: Concatenation: $i.$j different from "$i$j" <rvtol+news@isolution.nl>
Re: Concatenation: $i.$j different from "$i$j" <abigail@abigail.be>
DBI problem francis.moore@gmail.com
Re: DBI problem xhoster@gmail.com
Re: DBI problem francis.moore@gmail.com
Re: DBI problem <no@email.com>
Re: DBI problem xhoster@gmail.com
Re: DBI problem francis.moore@gmail.com
kenny the troll is dead <zaxfuuq@invalid.net>
Re: List Variable becomes undefined inexplicably <cwilbur@chromatico.net>
new CPAN modules on Sat Sep 22 2007 (Randal Schwartz)
Re: perl and unix command <lerameur@yahoo.com>
Re: Perl modules for handling Majordomo lists <noreply@gunnar.cc>
Re: re-launch piped external program <ben@morrow.me.uk>
Re: re-launch piped external program xhoster@gmail.com
Re: re-launch piped external program <rihad@mail.ru>
Re: re-launch piped external program xhoster@gmail.com
Re: TimeZone calculation on Windows Vista with DateTime <ben@morrow.me.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 21 Sep 2007 19:29:43 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Concatenation: $i.$j different from "$i$j"
Message-Id: <fd16av.12o.1@news.isolution.nl>
Occidental schreef:
> if ("$i$j" =~ /X/)
> if ($i.$j =~ /X/)
I heard somewhere that the next version of Python will make
1+2 * 3
behave differently from
1 + 2*3
;)
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 21 Sep 2007 18:59:03 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: Concatenation: $i.$j different from "$i$j"
Message-Id: <slrnff8525.8no.abigail@alexandra.abigail.be>
_
Dr.Ruud (rvtol+news@isolution.nl) wrote on VCXXXIV September MCMXCIII in
<URL:news:fd16av.12o.1@news.isolution.nl>:
%% Occidental schreef:
%%
%% > if ("$i$j" =~ /X/)
%% > if ($i.$j =~ /X/)
%%
%% I heard somewhere that the next version of Python will make
%%
%% 1+2 * 3
%%
%% behave differently from
%%
%% 1 + 2*3
%%
If you had written 'Perl6' instead of 'Python', I would have assumed
you were serieus.
Abigail
--
map{${+chr}=chr}map{$_=>$_^ord$"}$=+$]..3*$=/2;
print "$J$u$s$t $a$n$o$t$h$e$r $P$e$r$l $H$a$c$k$e$r\n";
------------------------------
Date: Fri, 21 Sep 2007 09:35:14 -0700
From: francis.moore@gmail.com
Subject: DBI problem
Message-Id: <1190392514.889967.285570@d55g2000hsg.googlegroups.com>
Hi,
I'm no perl programmer, but I need to fix some perl code that was
serving some web pages correctly until recently. Since then the name
of a server has changed and we think that this is what is causing the
issue.
The error we get is:
Can't call method "prepare" on an undefined value at line 77...
Which is caused by these lines:
my $dbHandle = DBI->connect("dbi:Sybase:server=ODB;database=ABC",
'user', 'password', {PrintError => 1});
my $sqlStatement=$reports{$report}->{'query'};
my $stHandle = $dbHandle->prepare($sqlStatement);
We think it's because the value of the ODB variable (the db server)
has changed recently, but we can't find the definition of this
variable to check the current value or change it to the correct
servername.
Can anyone give me a hint as to where this variable is likely to be
defined?
It's not in this perl file and I've grepped all the nearby directories
but without any luck.
Or how to view it, i.e. using a print statement to a file
Many thanks,
Frank.
------------------------------
Date: 21 Sep 2007 16:44:07 GMT
From: xhoster@gmail.com
Subject: Re: DBI problem
Message-Id: <20070921124408.919$Ii@newsreader.com>
francis.moore@gmail.com wrote:
> Hi,
>
> I'm no perl programmer, but I need to fix some perl code that was
> serving some web pages correctly until recently. Since then the name
> of a server has changed and we think that this is what is causing the
> issue.
>
> The error we get is:
>
> Can't call method "prepare" on an undefined value at line 77...
>
> Which is caused by these lines:
>
> my $dbHandle = DBI->connect("dbi:Sybase:server=ODB;database=ABC",
> 'user', 'password', {PrintError => 1});
> my $sqlStatement=$reports{$report}->{'query'};
> my $stHandle = $dbHandle->prepare($sqlStatement);
>
> We think it's because the value of the ODB variable (the db server)
> has changed recently,
There is no $ODB variable in your code. The name of the server you
are attempting to connect to in the above code is the literal string "ODB",
not the value of some variable named $ODB.
If the name of your server is not "ODB", then change "ODB" to whatever
the name of your server is.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Fri, 21 Sep 2007 09:57:12 -0700
From: francis.moore@gmail.com
Subject: Re: DBI problem
Message-Id: <1190393832.247167.211650@k79g2000hse.googlegroups.com>
Xho,
Thanks for your response.
But now I'm even more confused :-)
This web page was working until recently, when the DB server was
renamed.
However, the server has never been called ODB (although the server is
known colloquialy as the Operational DataBase, hence the initials ODB,
the servername is actually DCSVPA-09), so I can't see how it ever
worked.
And the fact that ODB is in uppercase makes me suspect that this is a
global variable of some sort.
I have to bow to your superior knowledge, but this just doesn't make
sense.
Could it be a DSN id or similar defined somewhere?
If so, I just don't know where to look.
Thanks again,
Frank.
------------------------------
Date: Fri, 21 Sep 2007 18:02:38 +0100
From: Brian Wakem <no@email.com>
Subject: Re: DBI problem
Message-Id: <5libpfF859tnU1@mid.individual.net>
francis.moore@gmail.com wrote:
> Xho,
>
> Thanks for your response.
> But now I'm even more confused :-)
> This web page was working until recently, when the DB server was
> renamed.
> However, the server has never been called ODB (although the server is
> known colloquialy as the Operational DataBase, hence the initials ODB,
> the servername is actually DCSVPA-09), so I can't see how it ever
> worked.
> And the fact that ODB is in uppercase makes me suspect that this is a
> global variable of some sort.
> I have to bow to your superior knowledge, but this just doesn't make
> sense.
> Could it be a DSN id or similar defined somewhere?
> If so, I just don't know where to look.
>
> Thanks again,
> Frank.
Have a look in your hosts file, is ODB in there?
--
Brian Wakem
------------------------------
Date: 21 Sep 2007 17:19:30 GMT
From: xhoster@gmail.com
Subject: Re: DBI problem
Message-Id: <20070921131932.019$fG@newsreader.com>
francis.moore@gmail.com wrote:
> Xho,
>
> Thanks for your response.
> But now I'm even more confused :-)
> This web page was working until recently, when the DB server was
> renamed.
> However, the server has never been called ODB (although the server is
> known colloquialy as the Operational DataBase, hence the initials ODB,
> the servername is actually DCSVPA-09), so I can't see how it ever
> worked.
Someplace ODB is getting mapped to DCSVPA-09. I strongly suspect that
this mapping is not happening inside Perl proper. I think the Sybase
client API library (which Perl uses, but which isn't actually part of Perl)
has its own configuration file, something like sql.ini, which may contain
this mapping.
> And the fact that ODB is in uppercase makes me suspect that this is a
> global variable of some sort.
> I have to bow to your superior knowledge, but this just doesn't make
> sense.
> Could it be a DSN id or similar defined somewhere?
Yes, I think that is probably the case. But the "somewhere" is probably
not in Perl itself, nor in DBI, but in some external configuration.
> If so, I just don't know where to look.
You probably need to consult a Sybase expert, or maybe system administrator
for the system your client is running on.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Fri, 21 Sep 2007 10:27:12 -0700
From: francis.moore@gmail.com
Subject: Re: DBI problem
Message-Id: <1190395632.976265.128880@57g2000hsv.googlegroups.com>
All,
I've found the ODB mapping in /etc/freetds.conf.
Changed the server name and it works again.
Many thanks to all that answered.
Frank.
------------------------------
Date: Fri, 21 Sep 2007 23:54:45 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: kenny the troll is dead
Message-Id: <_eOdnQs9Fd6lM2nbnZ2dnUVZ_gKdnZ2d@comcast.com>
I was actually *using perl.*
Fun night, but I'm waying going out as opposed to doing my hw. alyson, john
tesh had a with intel before he got to meet you, rats. I remember your
heater, that wonderful, solaris-compliant Albuquerque original. It's a mile
high here; we're going to freeze in this altitude.
Don and Dana were quite the bookends.
--
Wade Ward
"My aim is not only true, but deadly."
------------------------------
Date: 21 Sep 2007 10:49:41 -0400
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: List Variable becomes undefined inexplicably
Message-Id: <874phoqdiy.fsf@mithril.chromatico.net>
>>>>> "mb" == mattbreedlove <mattbreedlove@yahoo.com> writes:
>> it is Perl for the language and perl for the program. never
>> PERL which marks you as someone who doesn't know Perl.
mb> Is that kind of like saying someone must not know how to drive
mb> well unless they know how to fix cars?
No, it's more like saying that a mechanic who refers to bits of the
engine by the wrong names is unlikely to be competent.
PERL versus Perl or perl is a shibboleth: using the wrong one
indicates that you're likely to be a clueless novice. If you really
want people to think you are a clueless novice, and you really want
people to treat you as a clueless novice, by all means, carry on.
And continuing to use PERL after this has been pointed out generally
marks you as a clueless novice who's stubborn enough to persist in his
cluelessness, which means that wise people will, for the most part,
just silently plonk you.
Honestly, you came here for help, and the people you came to for help,
most of whom have more experience than you, have made a couple
recommendations. Now, the PERL/Perl/perl shibboleth is not really an
important one technically, but the way you react to it is very
telling. More important technically, and more telling, is the way you
reacted to the advice to use strictures and warnings. If you aren't
interested in listening to or following advice, why ask for it?
Charlton
--
Charlton Wilbur
cwilbur@chromatico.net
------------------------------
Date: Sat, 22 Sep 2007 04:42:16 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sat Sep 22 2007
Message-Id: <Jor6EG.1GC@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Alien-SVN-1.4.5.2
http://search.cpan.org/~mschwern/Alien-SVN-1.4.5.2/
A wrapper for installing the SVN Perl bindings
----
Apache2-Filter-Minifier-CSS-1.01
http://search.cpan.org/~gtermars/Apache2-Filter-Minifier-CSS-1.01/
CSS minifying output filter
----
Apache2-Filter-Minifier-JavaScript-1.01
http://search.cpan.org/~gtermars/Apache2-Filter-Minifier-JavaScript-1.01/
JS minifying output filter
----
Authen-SASL-Authd-0.01
http://search.cpan.org/~sasha/Authen-SASL-Authd-0.01/
Client authentication via Cyrus saslauthd or Dovecot authentication daemon.
----
Authen-TacacsPlus-0.17
http://search.cpan.org/~mikem/Authen-TacacsPlus-0.17/
Perl extension for authentication using tacacs+ server
----
BBS-Client-0.02
http://search.cpan.org/~cornelius/BBS-Client-0.02/
A Client Module For BBS Systems
----
CGI-Ex-Recipes-0.06
http://search.cpan.org/~berov/CGI-Ex-Recipes-0.06/
A usage example for CGI::Ex::App!
----
CPAN-Reporter-0.99_11
http://search.cpan.org/~dagolden/CPAN-Reporter-0.99_11/
Adds CPAN Testers reporting to CPAN.pm
----
Catalyst-View-TT-Alloy-0.00001
http://search.cpan.org/~cfranks/Catalyst-View-TT-Alloy-0.00001/
Template::Alloy (TT) View Class
----
DBIx-Class-HTML-FormFu-0.01002
http://search.cpan.org/~cfranks/DBIx-Class-HTML-FormFu-0.01002/
Fill a HTML::FormFu form from the database and vice-versa
----
Data-Rand-v0.0.1
http://search.cpan.org/~dmuey/Data-Rand-v0.0.1/
Efficient cryptographically strong random strings and lists of [un]given length and data.
----
DirDB-FTP-0.03
http://search.cpan.org/~davidnico/DirDB-FTP-0.03/
Perl extension to use a remote directory as a database
----
Game-Hack-Live-0.3
http://search.cpan.org/~pmarek/Game-Hack-Live-0.3/
Perl script to ease playing games
----
Games-FEAR-Log-0.02
http://search.cpan.org/~evank/Games-FEAR-Log-0.02/
Log analysis tool for F.E.A.R. dedicated servers
----
HTML-FormFu-0.01005
http://search.cpan.org/~cfranks/HTML-FormFu-0.01005/
HTML Form Creation, Rendering and Validation Framework
----
HTML-TableParser-0.37
http://search.cpan.org/~djerius/HTML-TableParser-0.37/
Extract data from an HTML table
----
Hook-Modular-0.03
http://search.cpan.org/~marcel/Hook-Modular-0.03/
making pluggable applications easy
----
IPA-1.05
http://search.cpan.org/~karasik/IPA-1.05/
Image Processing Algorithms
----
LaTeX-Driver-0.02
http://search.cpan.org/~andrewf/LaTeX-Driver-0.02/
Latex driver
----
Mail-Box-2.074
http://search.cpan.org/~markov/Mail-Box-2.074/
manage a mailbox, a folder with messages
----
Net-IDN-tools-0.99_20070921
http://search.cpan.org/~cfaerber/Net-IDN-tools-0.99_20070921/
----
Net-SIP-0.36
http://search.cpan.org/~sullr/Net-SIP-0.36/
Framework SIP (Voice Over IP, RFC3261)
----
Net-SIP-0.37
http://search.cpan.org/~sullr/Net-SIP-0.37/
Framework SIP (Voice Over IP, RFC3261)
----
Net-Z3950-Simple2ZOOM-1.00
http://search.cpan.org/~mirk/Net-Z3950-Simple2ZOOM-1.00/
Gateway between Z39.50 and SRU/SRW
----
Net-Z3950-ZOOM-1.20
http://search.cpan.org/~mirk/Net-Z3950-ZOOM-1.20/
Perl extension for invoking the ZOOM-C API.
----
Net-eBay-0.44
http://search.cpan.org/~ichudov/Net-eBay-0.44/
Perl Interface to XML based eBay API.
----
OpenOffice-UNO-0.04
http://search.cpan.org/~mbarbon/OpenOffice-UNO-0.04/
interface to OpenOffice's UNO runtime
----
POE-Loop-Prima-1.00
http://search.cpan.org/~karasik/POE-Loop-Prima-1.00/
a bridge that supports Prima event loop from POE
----
Prima-1.23
http://search.cpan.org/~karasik/Prima-1.23/
a perl graphic toolkit
----
SVG-2.36
http://search.cpan.org/~ronan/SVG-2.36/
Perl extension for generating Scalable Vector Graphics (SVG) documents
----
Shell-GetEnv-0.04
http://search.cpan.org/~djerius/Shell-GetEnv-0.04/
extract the environment from a shell after executing commands
----
Test-WWW-Simple-0.26
http://search.cpan.org/~mcmahon/Test-WWW-Simple-0.26/
Test Web applications using TAP
----
Text-WikiCreole
http://search.cpan.org/~jburnett/Text-WikiCreole/
Convert Wiki Creole 1.0 markup to XHTML
----
Text-WikiCreole-0.03
http://search.cpan.org/~jburnett/Text-WikiCreole-0.03/
Convert Wiki Creole 1.0 markup to XHTML
----
Tie-Hash-MultiValue-0.05
http://search.cpan.org/~mcmahon/Tie-Hash-MultiValue-0.05/
store multiple values per key
----
Tk-804.027_501
http://search.cpan.org/~srezic/Tk-804.027_501/
a graphical user interface toolkit for Perl
----
VUser-Email-0.3.2
http://search.cpan.org/~rsmith/VUser-Email-0.3.2/
vuser email support extention
----
VUser-Email-Postfix-SQL-0.1.1
http://search.cpan.org/~rsmith/VUser-Email-Postfix-SQL-0.1.1/
vuser extension for managing postfix users and domain in SQL
----
VUser-ExtLib-SQL-0.1.1
http://search.cpan.org/~rsmith/VUser-ExtLib-SQL-0.1.1/
Common functions for handling SQL with in vuser
----
VUser-Google-Apps-0.1.0
http://search.cpan.org/~rsmith/VUser-Google-Apps-0.1.0/
VUser extension for managing Google Apps for your domain
----
VUser-Radius-0.1.1
http://search.cpan.org/~rsmith/VUser-Radius-0.1.1/
vuser extension to manage RADIUS users
----
VUser-Radius-Acct-0.1.0
http://search.cpan.org/~rsmith/VUser-Radius-Acct-0.1.0/
vuser extension to view RADIUS accounting records
----
VUser-Radius-Acct-SQL-0.1.0
http://search.cpan.org/~rsmith/VUser-Radius-Acct-SQL-0.1.0/
SQL support for the VUser::Radius::Acct vuser extension
----
VUser-Radius-SQL-0.1.1
http://search.cpan.org/~rsmith/VUser-Radius-SQL-0.1.1/
SQL support for the VUser::Radius vuser extension
----
VUser-SpamAssassin-0.3.0
http://search.cpan.org/~rsmith/VUser-SpamAssassin-0.3.0/
vuser SpamAssassin support extension
----
VUser-SpamAssassin-SQL-0.1.0
http://search.cpan.org/~rsmith/VUser-SpamAssassin-SQL-0.1.0/
vuser SpamAssassin SQL support extension
----
VUser-SquirrelMail-0.1.1
http://search.cpan.org/~rsmith/VUser-SquirrelMail-0.1.1/
----
WWW-Bugzilla-1.1
http://search.cpan.org/~bmc/WWW-Bugzilla-1.1/
Handles submission/update of bugzilla bugs via WWW::Mechanize.
----
WWW-DirectUpload-0.01
http://search.cpan.org/~sepp/WWW-DirectUpload-0.01/
Perl module for uploading files to directupload.com
----
Web-Scraper-0.19
http://search.cpan.org/~miyagawa/Web-Scraper-0.19/
Web Scraping Toolkit inspired by Scrapi
----
XML-TreePP-0.31
http://search.cpan.org/~kawasaki/XML-TreePP-0.31/
Pure Perl implementation for parsing/writing xml files
----
utils_mail8.0.21a
http://search.cpan.org/~cml/utils_mail8.0.21a/
----
vsoapd-0.4.1
http://search.cpan.org/~rsmith/vsoapd-0.4.1/
vuser SOAP daemon.
----
vuser-0.4.1
http://search.cpan.org/~rsmith/vuser-0.4.1/
Virtual user management utility
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Fri, 21 Sep 2007 12:30:08 -0700
From: lerameur <lerameur@yahoo.com>
Subject: Re: perl and unix command
Message-Id: <1190403008.415287.158960@d55g2000hsg.googlegroups.com>
the command:
PATH="/usr/perl5/5.6.1/bin:$PATH" export PATH
works great. I have access to my perldoc pages.
thanks
ken
------------------------------
Date: Sat, 22 Sep 2007 04:12:38 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Perl modules for handling Majordomo lists
Message-Id: <5ljc1dF83s30U1@mid.individual.net>
Bill H wrote:
> Anyone know of any perl modules that handle majordomo lists on a linux
> server (adding, editing etc)?
http://search.cpan.org/search?query=majordomo
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 21 Sep 2007 17:42:48 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: re-launch piped external program
Message-Id: <8t8ds4-7c1.ln1@osiris.mauzo.dyndns.org>
Quoth rihad <rihad@mail.ru>:
> Hello, Perl hackers,
>
> I'm writing a Perl script that runs FreeBSD's ipfw(8) and writes
> certain commands to it through a pipe, line by line:
>
> open OUT, "|-", "ipfw", "/dev/stdin" or die "$! $?";
Don't use global filehandles. Use variable instead, and give them proper
names:
open my $IPFW, "|-", "ipfw", "/dev/stdin" or...
> while (1) {
> print OUT $command, "\n";
You can avoid the need for this "\n" by setting $\.
> }
>
> Sometimes $command causes parse errors (due to manipulation of a
> nonexistent rule, or similar), and ipfw dies... Is there any way to
> catch and acknowledge that fact, and re-run myprog for subsequent
> iterations?
If you attempt to write to a pipe which has been closed (say, because
the process on the other end has died) your program will be sent a
SIGPIPE. The default action for this is to terminate your program, but
you can catch it (see perldoc perlipc) and recover. Alternatively, you
can ignore it ($SIG{PIPE} = 'IGNORE') and check the return value from
print. If it failed, and $! == EPIPE (EPIPE can be imported from the
POSIX module), then your process has died. This may be simpler than
trying to use a signal handler (signals don't really behave terribly
well).
Note that you should explicitly close the filehandle if the process
dies, as that causes perl to wait for the child; if you don't, you'll
start accumulating zombie processes.
Ben
------------------------------
Date: 21 Sep 2007 16:54:50 GMT
From: xhoster@gmail.com
Subject: Re: re-launch piped external program
Message-Id: <20070921125451.907$mX@newsreader.com>
rihad <rihad@mail.ru> wrote:
> Hello, Perl hackers,
>
> I'm writing a Perl script that runs FreeBSD's ipfw(8) and writes
> certain commands to it through a pipe, line by line:
>
> open OUT, "|-", "ipfw", "/dev/stdin" or die "$! $?";
> while (1) {
> print OUT $command, "\n";
> }
>
> Sometimes $command causes parse errors (due to manipulation of a
> nonexistent rule, or similar), and ipfw dies... Is there any way to
> catch and acknowledge that fact, and re-run myprog for subsequent
> iterations?
If ipfw dies, then your process should be delivered a CHLD signal,
which can be captured by putting code in $SIG{CHLD};
my $foo;
while (1) {
$foo=1;
$SIG{CHLD}=sub {$foo=0};
open OUT, "|-", "ipfw", "/dev/stdin" or die "$! $?";
while ($foo) {
print OUT $command, "\n";
}
close OUT or warn "failed with $? $!";
};
There is no general reason to think that the program will die instantly
or that the signal will be delivered instantly, so you may not fall out of
the loop until several iterations after the $command that actually
triggered the error. So you are playing with fire. (especially since you
don't show us how $command ever changes, so there may be hidden problems
there as well).
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Fri, 21 Sep 2007 11:46:28 -0700
From: rihad <rihad@mail.ru>
Subject: Re: re-launch piped external program
Message-Id: <1190400388.550143.98860@22g2000hsm.googlegroups.com>
Thanks to you both, guys. I'll try the EPIPE trick as soon as I get
over this small problem:
$\ = "\n";
$| = 1;
open my $FW, "|-", "sudo", "ipfw", "/dev/stdin" or die "can't run
ipfw: $!";
$| = 1;
print $FW 'add';
sleep 10;
exit;
I gave ipfw erroneous input on purpose ('add' requires argument list).
No matter what I tried: ipfw's pre-mortem line on stderr "Line 1:
missing action" won't show up on the screen until after 10 seconds
have passed. And I can see ipfw hanging there during that time from
another console using ps. Looks like Perl holds on to the line for
some reason. Someone care to explain what I did wrong?
------------------------------
Date: 21 Sep 2007 21:23:34 GMT
From: xhoster@gmail.com
Subject: Re: re-launch piped external program
Message-Id: <20070921172336.753$Ys@newsreader.com>
rihad <rihad@mail.ru> wrote:
> Thanks to you both, guys. I'll try the EPIPE trick as soon as I get
> over this small problem:
>
> $\ = "\n";
> $| = 1;
> open my $FW, "|-", "sudo", "ipfw", "/dev/stdin" or die "can't run
> ipfw: $!";
> $| = 1;
> print $FW 'add';
> sleep 10;
> exit;
>
> I gave ipfw erroneous input on purpose ('add' requires argument list).
> No matter what I tried: ipfw's pre-mortem line on stderr "Line 1:
> missing action" won't show up on the screen until after 10 seconds
> have passed. And I can see ipfw hanging there during that time from
> another console using ps. Looks like Perl holds on to the line for
> some reason. Someone care to explain what I did wrong?
Maybe ipfw doesn't flush stderr until either the buffer is full or until
its stdin gets closed, which doesn't happen here until the parent program
exits.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Fri, 21 Sep 2007 17:35:56 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: TimeZone calculation on Windows Vista with DateTime::TimeZone
Message-Id: <cg8ds4-7c1.ln1@osiris.mauzo.dyndns.org>
Quoth Ami <ver_amitabh@yahoo.com>:
> On Sep 21, 3:36 am, Ben Morrow <b...@morrow.me.uk> wrote:
> > Quoth Ami <ver_amit...@yahoo.com>:
> > >
> > > Hi All,
> > > I am using Windows Vista with ActivePerl 5.8.8.822. I have
> > > downloaded the latest DateTime::TimeZone package from CPAN (DateTime-
> > > TimeZone-0.67). When I write a small script to work with it, I always
> > > get error stating that "Cannot determine local time zone.". After
> > > debugging, I came to know that DateTime package of Perl reads the
> > > "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
> > > \TimeZoneInformation\StandardName" to access this information which is
> > > supposed to contain a Windows name for the time zone (e.g.) but in
> > > Windows Vista, it contains some dll entry point information
> > > (@tzres.dll,-492).
> >
> > > The code snippet with which I am trying to work is as follows:
> >
> > > use DateTime::TimeZone;
> > > my $tz = DateTime::TimeZone->new( name => 'local' );
> > > $tz = DateTime::TimeZone::Local->TimeZone();
> >
> > > Can any one help me to make it working on Windows Vista?
> >
> > This is clearly a bug in DateTime::TimeZone, or rather an
> > incompatibility with Vista. It's probably worth filing a bug report on
> > rt.cpan.org.
> >
> > About the only workaround is to pick the appropriate timezone from the
> > list returned by DateTime::TimeZone->all_names and set %TZ% in the
> > environment to that value.
>
> Many Thanks for your reply.But being a new bee to perl, I am not
> sure how can retrieve the current time zone from the list returned by
> all_names() function. What should be the condition to match the
> current time zone from list?
I'm afraid I don't know. The correct answer is to call the Win32 API
function GetTimeZoneInformation or GetDynamicTimeZoneInformation, but
while it would be possible to do this using Win32::API it's not
something I can construct an example of off the top of my head. I think
for now you're just going to have to set it manually.
> How can I set the TZ in ENV variable. I tried with
> $ENV{'TZ'}='Asia/Calcutta';
> and
> $ENV{TZ}='America/Chicago';
> All time I get same date/time;
You probably need to set $ENV{TZ} in a BEGIN block before you load
DateTime::TimeZone, something like
BEGIN { $ENV{TZ} = 'Asia/Calcutta' }
use DateTime::TimeZone; # or Time::Local, or whatever
You could also set the variable in the 'real' environment, so it's
always present.
Ben
------------------------------
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 874
**************************************