[24846] in Perl-Users-Digest
Perl-Users Digest, Issue: 6997 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 13 09:06:31 2004
Date: Mon, 13 Sep 2004 06:05:07 -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 Mon, 13 Sep 2004 Volume: 10 Number: 6997
Today's topics:
" (Tony)
Re: " <zebee@zip.com.au>
Re: " <bernard.el-haginDODGE_THIS@lido-tech.net>
Re: " <mark.clements@kcl.ac.uk>
Re: " <tintin@invalid.invalid>
Get the index of array element <ec_au_ravi2000@yahoo.com>
Re: Get the index of array element (Anno Siegel)
Re: Get the index of array element <bernard.el-haginDODGE_THIS@lido-tech.net>
Re: Get the index of array element <bart.lateur@pandora.be>
Re: Perl opting for double-byte chars? <see@sig.invalid>
Re: Perl opting for double-byte chars? <see@sig.invalid>
Re: Perl opting for double-byte chars? <see@sig.invalid>
upgrading Perl / solaris 5.7 <r.mcglue@qub.ac.uk>
Re: upgrading Perl / solaris 5.7 <tony_curtis32@yahoo.com>
Re: Xah Lee's Unixism <ville@spammers.com>
Re: Xah Lee's Unixism <mnahkola@trein.ntc.nokia.com>
Re: Xah Lee's Unixism jmfbahciv@aol.com
Re: Xah Lee's Unixism jmfbahciv@aol.com
Re: Xah Lee's Unixism <firstname@lastname.pr1v.n0>
XML::Generator::DBI - use of uninitialized value on lin (Radhika)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 13 Sep 2004 00:20:34 -0700
From: aemee@hotmail.com (Tony)
Subject: "
Message-Id: <8b060d80.0409122320.1d36fc76@posting.google.com>
Hi,
Whenever I run the system command in perl and try to make sure it runs
sucessfully otherwise do something else, even for the most basic
system commands, I get "Inappropriate ioctl for device"
For example, the code:
$testdate = system("date") or die "can't run /usr/bin/date: $!";
print "$testdate";
returns:
Mon Sep 13 17:01:38 UTC 2004
can't run /usr/bin/date: Inappropriate ioctl for device at test.pl
line 7, <STDIN> line 4.
So it runs the command successfully, but dies anyway. Yes I know
there's another way to do date, this is just an example of the problem
I have. I need to use the system() command for other things, but no
matter what command I do I get the above. I have tried
$varname=system(command) and then testing $varname, but that doesn't
return anything.
Can anyone help? I don't want to use another module, I'm sure I must
be missing something here. Thanks in advance!
operating system is fedora linux, perl version is v5.8.3.
Tony
------------------------------
Date: Mon, 13 Sep 2004 07:40:35 GMT
From: Zebee Johnstone <zebee@zip.com.au>
Subject: Re: "
Message-Id: <slrnckajcb.hha.zebee@zeus.zipworld.com.au>
In comp.lang.perl.misc on 13 Sep 2004 00:20:34 -0700
Tony <aemee@hotmail.com> wrote:
> Hi,
> $testdate = system("date") or die "can't run /usr/bin/date: $!";
> print "$testdate";
>
from perldoc -f system
(you knew someone was going to mention that, didn't you....)
@args = ("command", "arg1", "arg2");
system(@args) == 0
or die "system @args failed: $?"
You can check all the failure possibilities by
inspecting `$?' like this:
$exit_value = $? >> 8;
$signal_num = $? & 127;
$dumped_core = $? & 128;
Read the whole thing, you will likely be enlightened.
Zebee
------------------------------
Date: Mon, 13 Sep 2004 09:52:37 +0200
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: "
Message-Id: <Xns9563647996CA1elhber1lidotechnet@62.89.127.66>
aemee@hotmail.com (Tony) wrote:
> Hi,
> Whenever I run the system command in perl and try to make sure it
> runs sucessfully otherwise do something else, even for the most
> basic system commands, I get "Inappropriate ioctl for device"
[...]
Why don't you read a function's documentation before you use it?
perldoc -f system
--
Cheers,
Bernard
------------------------------
Date: Mon, 13 Sep 2004 10:36:29 +0200
From: Mark Clements <mark.clements@kcl.ac.uk>
Subject: Re: "
Message-Id: <41455c0e$1@news.kcl.ac.uk>
Tony wrote:
> Hi,
> Whenever I run the system command in perl and try to make sure it runs
> sucessfully otherwise do something else, even for the most basic
> system commands, I get "Inappropriate ioctl for device"
>
> For example, the code:
>
> $testdate = system("date") or die "can't run /usr/bin/date: $!";
> print "$testdate";
are you sure it is running /usr/bin/date? Your error message is making
an assumption about the path of date that may not be correct.
> returns:
>
> Mon Sep 13 17:01:38 UTC 2004
> can't run /usr/bin/date: Inappropriate ioctl for device at test.pl
> line 7, <STDIN> line 4.
>
system returns the exit status of the invoked program and not its output.
perldoc -f system
perldoc -f perlop (you need to look at `` (backticks) or qx{}
> So it runs the command successfully, but dies anyway. Yes I know
> there's another way to do date, this is just an example of the problem
System is returning 0 signifying a successful command invocation. You
need to invert the sense of your test for success if you are going to
use system.
ie
die "$!" if system("date");
but since you want to capture the output you need to use backticks or qx
eg
my $output = qx(date);
By the way, you need to put a little more thought into your subject lines.
Mark
------------------------------
Date: Mon, 13 Sep 2004 21:07:19 +1200
From: "Tintin" <tintin@invalid.invalid>
Subject: Re: "
Message-Id: <2ql693F10rn12U1@uni-berlin.de>
"Tony" <aemee@hotmail.com> wrote in message
news:8b060d80.0409122320.1d36fc76@posting.google.com...
[did your finger slip when writing the subject line?]
> Whenever I run the system command in perl and try to make sure it runs
> sucessfully otherwise do something else, even for the most basic
> system commands, I get "Inappropriate ioctl for device"
>
> For example, the code:
>
> $testdate = system("date") or die "can't run /usr/bin/date: $!";
> print "$testdate";
>
> returns:
>
> Mon Sep 13 17:01:38 UTC 2004
> can't run /usr/bin/date: Inappropriate ioctl for device at test.pl
> line 7, <STDIN> line 4.
>
> So it runs the command successfully, but dies anyway. Yes I know
> there's another way to do date, this is just an example of the problem
> I have. I need to use the system() command for other things, but no
> matter what command I do I get the above. I have tried
> $varname=system(command) and then testing $varname, but that doesn't
> return anything.
>
> Can anyone help? I don't want to use another module, I'm sure I must
> be missing something here. Thanks in advance!
Seriously, where did you learn to use system? Did you read the
documentation for it, or did you see an example somewhere. If you saw an
example, it was obviously a bad example.
------------------------------
Date: 13 Sep 2004 03:07:55 -0700
From: "ravi" <ec_au_ravi2000@yahoo.com>
Subject: Get the index of array element
Message-Id: <ci3rhr$ss4@odak26.prod.google.com>
In the following piece of code
foreach $element (@array) {
# Is there a special variable to know the index
# of the array element
}
Is there a efficient way to know the index of the array element inside
the given loop, assuming i dont have a count variable.
------------------------------
Date: 13 Sep 2004 10:37:42 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Get the index of array element
Message-Id: <ci3t9m$686$1@mamenchi.zrz.TU-Berlin.DE>
ravi <ec_au_ravi2000@yahoo.com> wrote in comp.lang.perl.misc:
> In the following piece of code
>
> foreach $element (@array) {
>
> # Is there a special variable to know the index
> # of the array element
No.
> }
>
> Is there a efficient way to know the index of the array element inside
> the given loop, assuming i dont have a count variable.
You'll need an index variable in one form or another. The basic
possibilities are either
my $i = 0;
foreach $element ( @array ) {
# index in $i
$i ++;
}
or
for ( 0 .. $#array ) {
my $element = $array[ $_];
# index in $_
}
Anno
------------------------------
Date: Mon, 13 Sep 2004 12:33:36 +0200
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: Get the index of array element
Message-Id: <Xns95637FC4AF84Felhber1lidotechnet@62.89.127.66>
"ravi" <ec_au_ravi2000@yahoo.com> wrote:
> In the following piece of code
>
> foreach $element (@array) {
>
> # Is there a special variable to know the index
> # of the array element
No, there isn't.
> }
>
> Is there a efficient way to know the index of the array element
> inside the given loop, assuming i dont have a count variable.
for my $idx (0 .. $#array) {
# $array[$idx] is the current element
# $idx is the current index
}
--
Cheers,
Bernard
------------------------------
Date: Mon, 13 Sep 2004 12:14:07 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Get the index of array element
Message-Id: <uk3bk09gqt76t7o70bt5ocahnolgcvue6l@4ax.com>
Anno Siegel wrote:
> my $i = 0;
> foreach $element ( @array ) {
> # index in $i
> $i ++;
> }
If I use that kind of code structure, I always put the last statement in
a "continue" block, even if it doesn't sever any other particular
practical purpose.
my $i = 0;
foreach $element ( @array ) {
# index in $i
} continue {
$i ++;
}
At least it'll behave properly if even if at one point you choose to
insert a "next" statement in there.
--
Bart.
------------------------------
Date: Sun, 12 Sep 2004 22:05:51 -0400
From: Bob Walton <see@sig.invalid>
To: =?ISO-8859-1?Q?B=EBelphazoar?= <http://joecosby.com/code/mail.pl>
Subject: Re: Perl opting for double-byte chars?
Message-Id: <4145007F.2020404@sig.invalid>
Bëelphazoar wrote:
> On Sun, 12 Sep 2004 03:00:11 GMT, $_@_.%_ wrote:
>
>
>>Bëelphazoar <http://joecosby.com/code/mail.pl> wrote in message-id:
>><9i57k0hfs4ov5orh4cji217f55icn6lnrq@4ax.com>
...
>>Try perldoc encode
>
> No documentation found for "encode".
>
Try also updating to Perl version 5.8.4.
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: Sun, 12 Sep 2004 22:06:29 -0400
From: Bob Walton <see@sig.invalid>
Subject: Re: Perl opting for double-byte chars?
Message-Id: <4144fef2$1_2@127.0.0.1>
Bëelphazoar wrote:
> On Sun, 12 Sep 2004 03:00:11 GMT, $_@_.%_ wrote:
>
>
>>Bëelphazoar <http://joecosby.com/code/mail.pl> wrote in message-id:
>><9i57k0hfs4ov5orh4cji217f55icn6lnrq@4ax.com>
...
>>Try perldoc encode
>
> No documentation found for "encode".
>
Try also updating to Perl version 5.8.4.
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: Sun, 12 Sep 2004 22:18:44 -0400
From: Bob Walton <see@sig.invalid>
Subject: Re: Perl opting for double-byte chars?
Message-Id: <414501d1$1_2@127.0.0.1>
Ala Qumsieh wrote:
> Bëelphazoar wrote:
>
>> Thanks very much, do you know what package/module encode is in, off
>> the top of your head?
>>
>> It may not be in the installation I'm using
>
>
> perldoc Encode
>
> case matters except on broken OSes.
For perldoc, that is true: case doesn't seem to matter on broken OSes.
When calling modules, though, it does matter -- maybe even more. The
broken OS finds the module file in spite of the fact that the wrong case
was specified, and indicates that the module is located to Perl. But
Perl still can't call it because the proper-cased name is not there.
The net result is a non-functioning module combined with no error message.
>
> --Ala
>
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: Mon, 13 Sep 2004 11:56:55 +0100
From: R McGlue <r.mcglue@qub.ac.uk>
Subject: upgrading Perl / solaris 5.7
Message-Id: <ci3udf$5h7$1@news.qub.ac.uk>
Hi
Perl 5.005_02 on the system i want to upgrade to
perl_s-5.8.5-sol9-sparc-local.gz are there any issues i need to worry
about or can i simply do a pkgadd??
thanks
------------------------------
Date: Mon, 13 Sep 2004 08:00:09 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: upgrading Perl / solaris 5.7
Message-Id: <877jqy9vdy.fsf@limey.hpcc.uh.edu>
>> On Mon, 13 Sep 2004 11:56:55 +0100,
>> R McGlue <r.mcglue@qub.ac.uk> said:
> Hi Perl 5.005_02 on the system i want to upgrade to
> perl_s-5.8.5-sol9-sparc-local.gz are there any issues i need
> to worry about or can i simply do a pkgadd?? thanks
See:
http://www.science.uva.nl/pub/solaris/solaris2.html#q3.75
Add your own version somewhere else (blastwave package, source
to /usr/local) and symlink /usr/bin/perl accordingly.
hth
t
------------------------------
Date: 13 Sep 2004 09:39:00 +0300
From: Ville Vainio <ville@spammers.com>
Subject: Re: Xah Lee's Unixism
Message-Id: <du73c1mk70b.fsf@mozart.cc.tut.fi>
>>>>> "Grant" == Grant Edwards <grante@visi.com> writes:
Grant> shit about international agreements? Bush thinks he's
Grant> entitled to declare anybody and everybody an "enemy
Grant> combatant" and lock them up in secret forever. Add a
Grant> moustache and he'd make a pretty good Stalin.
I'll raise you a Hitler, in a (probably vain) attempt to invoke the
Godwin's law.
--
Ville Vainio http://tinyurl.com/2prnb
------------------------------
Date: Mon, 13 Sep 2004 09:02:49 GMT
From: Mikko Nahkola <mnahkola@trein.ntc.nokia.com>
Subject: Re: Xah Lee's Unixism
Message-Id: <slrnckalat.m01.mnahkola@localhost.localdomain>
Steve O'Hara-Smith wrote:
> lin8080 <lin8080@freenet.de> wrote:
>> Steve O'Hara-Smith schrieb:
>> > One thing I always found amusing is the amount of science *fiction*
>> > written in the first half of this period about what would happen if the
>> > worlds computers became linked together.
>> as long as nothing new goes in, nothing. Maybe we read yesterdays
>> papers?
> Most of the SF carried the assumption that once a certain level of
> complexity was reached the network would "wake up" as some kind of self aware
> intelligence.
Well, taking a wild assumption and running with it is one of the really
well-tried and proven-good ways to get started when writing fiction,
right?
Although some of the later or better researched pieces of fiction did
have either a strong randomness element or a purposefully designed one
to the awareness thing - or probably both...
The Star Trek episode (TNG) was a particularly silly one IMHO.
One (fairly recent book) had even a seemingly feasible scenario - a
trojan planted inside the most popular OS, with a self-learning system
for supporting a certain armed underground resistance movement, that
eventually gained some form of awareness - and that was killed by
an "antivirus" application. And all this would still be in the future
too. (Anyone else read that book?)
--
Mikko Nahkola <mnahkola@trein.ntc.nokia.com>
#include <disclaimer.h>
#Not speaking for my employer. No warranty. YMMV.
------------------------------
Date: Mon, 13 Sep 04 10:39:16 GMT
From: jmfbahciv@aol.com
Subject: Re: Xah Lee's Unixism
Message-Id: <41458c14$0$2648$61fed72c@news.rcn.com>
In article <87pt4r771o.fsf@p4.internal>,
Bulent Murtezaoglu <bm@acm.org> wrote:
>>>>>> "jmf" == jmfbahciv <jmfbahciv@aol.com> writes:
>[...]
> jmf> Would rather he do like Italy? They are letting them go.
> jmf> Then these released people go blow up something else. [...]
> bm> Why are those the only two choices? Do you think people turn
> bm> into bomb-wielding terrorists by feat of mere suspicion?
>
> jmf> Oh, sigh! [emoticon begins to hit head against wall because
> jmf> it feels better]
>
>I didn't mean to upset you. But sigh indeed.
<GRIN> I'm about to sigh back at you.
> .. Offtopic in all groups
>too.
I don't know where you are so I can't trim newsgroups. I'm in a.f.c.
> ..Maybe we should get jailed? Who knows _what else_ we might be
>up to? Can't be too cautious these days. What color was that alert
>now? Better call the authorities.
>
> bm> I don't think the US abuses the 'enemy combatant' device as
> bm> much as we fear, yet.
>
> jmf> Hint..the US isn't abusing enemy combatants.
>
>Um, I said 'the enemy combatant device' not the people themselves.
>There's no doubt that the people themselves are being abused. That's
>the whole point of a separate status, no? I thought the 'enemy
>combatant' designation was devised to go around both the US law,
Sigh! US law doesn't apply in Afghanistan nor any other country.
> ...and
>the Geneva Convention pertaining to POWs.
What people are not getting treated using the Geneva Convetion
terms?
> ... As for the _US_ doing it,
>yes you are correct, the nation itself isn't doing it. Indeed the
>whole reason for the invention of this odd locution was the thought
>that the nation would have expected its gov't to at least appear
>to stay within certain boundaries. Maybe they needen't have bothered?
>
> >> ... But if the people in the US are convinced that the choice
> >> is between getting blown up and secret detentions w/o judicial
> >> oversight then it will get far worse than we fear. [...]
>
> jmf> WHAT SECRET DETENTIONS?
>
>Responding in "hints" and ALL CAPS brings us to the ludicrous situation
>where a Turk gets to give a pointer to the ACLU to an American:
>
>http://www.aclu.org/SafeandFree/SafeandFree.cfm?ID=13079&c=207
I'm not going to be able to get out to read that one. Just
mentioning the ACLU gives me the bias that you're listening
with a BS filter. ACLU has gone bonkers in that they've
become completely inconsist these days.
>
>;)
>
>cheers,
>
>BM
>
>
> >> I am beginning to think the US gov't and populace alike might
> >> be believing the "they hate us for our freedoms" line and
> >> trying to get rid of the said freedoms in the hope that it will
> >> appease the terrorists.
>
> jmf> Now there you actually made a point, but not the one you
> jmf> think you did.
>
>Let's hear it.
The ACLU types that you're listening to are giving away our
(the US) freedoms to people who don't want us to have them.
IOW, these liberal types are working in concert with these
militants.
<snip...I hate the way your software prefixes these posts>
/BAH
------------------------------
Date: Mon, 13 Sep 04 10:41:22 GMT
From: jmfbahciv@aol.com
Subject: Re: Xah Lee's Unixism
Message-Id: <41458c92$0$2648$61fed72c@news.rcn.com>
In article <du73c1mk70b.fsf@mozart.cc.tut.fi>,
Ville Vainio <ville@spammers.com> wrote:
>>>>>> "Grant" == Grant Edwards <grante@visi.com> writes:
>
> Grant> shit about international agreements? Bush thinks he's
> Grant> entitled to declare anybody and everybody an "enemy
> Grant> combatant" and lock them up in secret forever. Add a
> Grant> moustache and he'd make a pretty good Stalin.
>
>I'll raise you a Hitler, in a (probably vain) attempt to invoke the
>Godwin's law.
This law doesn't work in a.f.c. newsgroup. It just gets us
started talking about computers and guns and big [rhummm,rhummm]
vehicles.
/BAH
Subtract a hundred and four for e-mail.
------------------------------
Date: Mon, 13 Sep 2004 14:37:01 +0200
From: Morten Reistad <firstname@lastname.pr1v.n0>
Subject: Re: Xah Lee's Unixism
Message-Id: <d944ic.o5e.ln@via.reistad.priv.no>
In article <du73c1mk70b.fsf@mozart.cc.tut.fi>,
Ville Vainio <ville@spammers.com> wrote:
>>>>>> "Grant" == Grant Edwards <grante@visi.com> writes:
>
> Grant> shit about international agreements? Bush thinks he's
> Grant> entitled to declare anybody and everybody an "enemy
> Grant> combatant" and lock them up in secret forever. Add a
> Grant> moustache and he'd make a pretty good Stalin.
>
>I'll raise you a Hitler, in a (probably vain) attempt to invoke the
>Godwin's law.
OK, I'll raise that with a Ghengis Khan and a Pol Pot.
-- mrr
------------------------------
Date: 12 Sep 2004 19:00:39 -0700
From: radhika_o@yahoo.com (Radhika)
Subject: XML::Generator::DBI - use of uninitialized value on line 180 and 187
Message-Id: <75b9c2f.0409121800.6dce6bdf@posting.google.com>
I am using XML::Generator::DBI module along with XML::SAX::Writer
module to generate xml files. For every column data in the database I
get the error
Use of uninitialized value in string eq at
/opt/perl/lib/site_perl/5.8.5/XML/Gen
erator/DBI.pm line 180, <INPUT> line 2.
Use of uninitialized value in string eq at
/opt/perl/lib/site_perl/5.8.5/XML/Gen
erator/DBI.pm line 187, <INPUT> line 2.
I looked at the code for the module and it seems like there is a
variable @stack that is not initialized and is compared against.
Has anyone run into this earlier? Is there a fix for this?
------------------------------
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 V10 Issue 6997
***************************************