[28269] in Perl-Users-Digest
Perl-Users Digest, Issue: 9633 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 21 21:05:48 2006
Date: Mon, 21 Aug 2006 18:05: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 Mon, 21 Aug 2006 Volume: 10 Number: 9633
Today's topics:
Re: -multiposted- <rvtol+news@isolution.nl>
constructing a scalar reference <skunktrunk@gmail.com>
Re: constructing a scalar reference anno4000@radom.zrz.tu-berlin.de
Re: constructing a scalar reference <uri@stemsystems.com>
Re: constructing a scalar reference <skunktrunk@gmail.com>
ioctl TIOCSCTTY errno -1 <vivekm1234@cyberspace.org>
Re: ioctl TIOCSCTTY errno -1 xhoster@gmail.com
Re: ioctl TIOCSCTTY errno -1 <vivekm1234@cyberspace.org>
Re: ioctl TIOCSCTTY errno -1 xhoster@gmail.com
Re: perl dbi driver for microsoft sql? <jgibson@mail.arc.nasa.gov>
Re: perl dbi driver for microsoft sql? <john@castleamber.com>
Re: Printing to a file Or STDOUT <No_4@dsl.pipex.com>
Re: References - problem understanding them <m@remove.this.part.rtij.nl>
Re: References - problem understanding them <David.Squire@no.spam.from.here.au>
Re: References - problem understanding them <uri@stemsystems.com>
Re: References - problem understanding them xhoster@gmail.com
Re: References - problem understanding them xhoster@gmail.com
Use of uninitialized value in string eq at ./xml_simple <Brett.R.Davis@gmail.com>
Re: Use of uninitialized value in string eq at ./xml_si <mritty@gmail.com>
Re: Use of uninitialized value in string eq at ./xml_si <mgarrish@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 22 Aug 2006 01:36:30 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: -multiposted-
Message-Id: <ecdn5p.1g8.1@news.isolution.nl>
usenet@DavidFilmer.com schreef:
> John W. Krahn:
>> This practice, known as multiposting, is pissing some of us off.
>
> Sheesh - I tested this damn thing with over 100 test posts and I never
> saw this.
>
> OK, OK - I'm turning off the bot. I gotta figure out how to do
> effective "real world" testing without actually posting back to
> usenet. Maybe I'll have the bot send me an e-mail or something...
That is how a bot of mine works: I have to reply to its email before it
posts a message. I wrote it quite a while ago, in procmail+sed, and it
is still operational (look for "newszilla-pmf" in google-groups for
details), but is hardly ever used, because newszilla is just too good.
I included in the source a way to skip the approval-by-email, but I
never activated that, because that would open a spam-path (from a
webpage almost directly to usenet). The bot can easily be adjusted to
send the moderation email to multiple addresses, so more than just me
can be involved in the approval/rejection procedure. In short, it is a
moderated bot, and it transforms data coming from a web-form into a
usenet posting.
(It doesn't really solve a problem, I wrote it mainly to show that it
could be done with what is available to an average client of my ISP.)
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 21 Aug 2006 13:43:29 -0700
From: "Dibosia" <skunktrunk@gmail.com>
Subject: constructing a scalar reference
Message-Id: <1156193008.889984.212180@75g2000cwc.googlegroups.com>
$r = {}; # a hashref
$r = []; # an arrayref
$r = ?; # a scalar ref
What is ? ? I want to pass a ref to a scalar (pass by reference)
without resorting to
my $r;
mySub( \$r );
I just want to use
my $r = (something);
mySub( $r );
to be consistent with
my $r = {}; # or my $r = [];
mySub( $r );
I know it's not a big drama on the surface, but I'm trying to overload
the method to return various results depending on the reference type,
and I dont want the \ in some calls and not others.
Thank-You
------------------------------
Date: 21 Aug 2006 20:47:26 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: constructing a scalar reference
Message-Id: <4kukeuFdrdeaU1@news.dfncis.de>
Dibosia <skunktrunk@gmail.com> wrote in comp.lang.perl.misc:
> $r = {}; # a hashref
> $r = []; # an arrayref
> $r = ?; # a scalar ref
>
> What is ? ? I want to pass a ref to a scalar (pass by reference)
> without resorting to
>
> my $r;
> mySub( \$r );
>
> I just want to use
>
> my $r = (something);
> mySub( $r );
>
> to be consistent with
>
> my $r = {}; # or my $r = [];
> mySub( $r );
>
> I know it's not a big drama on the surface, but I'm trying to overload
> the method to return various results depending on the reference type,
> and I dont want the \ in some calls and not others.
There is no such constructor.
do { \ my $x }
comes closest.
Anno
------------------------------
Date: Mon, 21 Aug 2006 17:30:03 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: constructing a scalar reference
Message-Id: <x7odudn5es.fsf@mail.sysarch.com>
>>>>> "a" == anno4000 <anno4000@radom.zrz.tu-berlin.de> writes:
a> Dibosia <skunktrunk@gmail.com> wrote in comp.lang.perl.misc:
>> $r = {}; # a hashref
>> $r = []; # an arrayref
>> $r = ?; # a scalar ref
>>
>> What is ? ? I want to pass a ref to a scalar (pass by reference)
>> without resorting to
>>
>> my $r;
>> mySub( \$r );
>>
>> I just want to use
>>
>> my $r = (something);
>> mySub( $r );
>>
>> to be consistent with
>>
>> my $r = {}; # or my $r = [];
>> mySub( $r );
>>
>> I know it's not a big drama on the surface, but I'm trying to overload
>> the method to return various results depending on the reference type,
>> and I dont want the \ in some calls and not others.
a> There is no such constructor.
a> do { \ my $x }
a> comes closest.
depending on what the OP really needs (vs what he says he wants) you can
also use the aliasing of @_. pass in a scalar var and access its alias
in $_[0] (change 0 to the right slot). you can even take a ref to that
inside the sub like this:
sub bar {
my $ref = \$_[0] ;
${$ref} = 'foo' ; # changes the passed in var
}
my $var ;
bar( $var ) ;
$var is now 'foo'
the OP also never stated why or what will be done with the scalar
ref. it it is meant to be passed in in lieu of a ref to a scalar var (as
in anno's anon scalar ref), and not used after the call, then you can
just pass in undef, use the arg inside a lexical (assign from @_ as
normal) and scalar deref it. it will be autovivified to a scalar ref for
you. something like this:
sub foo {
my( $sref ) = @_ ;
${$sref} = 'foo' ; # autovivs if $sref is undef
# now use $sref for other stuff.
}
foo( undef ) ; # no external change
foo( \ my $bar ) ; # $bar is 'foo'
this is useful to either pass in a buffer you have and want to use or to
let the sub use its own buffer and throw it away when done.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 21 Aug 2006 17:16:08 -0700
From: "Dibosia" <skunktrunk@gmail.com>
Subject: Re: constructing a scalar reference
Message-Id: <1156205767.941296.101780@75g2000cwc.googlegroups.com>
anno4000@radom.zrz.tu-berlin.de wrote:
> Dibosia <skunktrunk@gmail.com> wrote in comp.lang.perl.misc:
> > $r = {}; # a hashref
> > $r = []; # an arrayref
> > $r = ?; # a scalar ref
> >
> > What is ? ? I want to pass a ref to a scalar (pass by reference)
> > without resorting to
> >
> > my $r;
> > mySub( \$r );
> >
> > I just want to use
> >
> > my $r = (something);
> > mySub( $r );
> >
> > to be consistent with
> >
> > my $r = {}; # or my $r = [];
> > mySub( $r );
> >
> > I know it's not a big drama on the surface, but I'm trying to overload
> > the method to return various results depending on the reference type,
> > and I dont want the \ in some calls and not others.
>
> There is no such constructor.
>
> do { \ my $x }
>
> comes closest.
>
> Anno
Thanks to you and Uri. I thought perhaps there was something like this
that I was ignorant of. I guess what I was seeking was an "anonymous
scalar ref".
Seems like it might be handy in this case, but its not a difficult
workaround.
------------------------------
Date: Tue, 22 Aug 2006 01:03:54 +0530
From: Vivek.M <vivekm1234@cyberspace.org>
Subject: ioctl TIOCSCTTY errno -1
Message-Id: <tt1ke21t3espp546bcfomegfnt6c4uiobf@4ax.com>
Help! Aid! Assist! I get:
background 4 -1 16931
System returned -1
This is on a OpenBSD grex.cyberspace.org 3.8 GENERIC#0 i386. I ssh to
the box. I am trying to write a program that grabs "tell messages" to
my terminal /dev/ttypE (pseudo-terminal). /dev/tty should point to my
controlling terminal.
Why is ioctl failing? Why! Oh! Why! I'm rather new to Perl and Unix so
please tolerate my idiocy.
#!/usr/bin/perl
use POSIX;
open LOG, '>>/c/v/i/vivekm1234/log' or die "Error log file\n";
open TTY, "/dev/tty" or die "error opening tty\n";
defined(my $pid = fork) or die "Can't fork: $!";
exit if $pid;
sleep 5;
setsid or die "Can't start a new session: $!";
### DEBUG ###
$fileno = fileno(TTY);
$tpgrp = tcgetpgrp(fileno(TTY));
$pgrp = getpgrp();
if ($tpgrp == $pgrp) {
print "foreground $tpgrp $pgrp\n";
} else {
print "background $fileno $tpgrp $pgrp\n";
}
### END DEBUG ###
require '/usr/libdata/perl5/site_perl/i386-openbsd/sys/ioctl.ph';
$getp = &TIOCSCTTY or die "NO TIOCSCTTY";
my $null;
$retval=ioctl(TTY, $getp, $null) || -1;
printf "System returned %d\n", $retval;
close LOG;
close TTY;
------------------------------
Date: 21 Aug 2006 19:41:18 GMT
From: xhoster@gmail.com
Subject: Re: ioctl TIOCSCTTY errno -1
Message-Id: <20060821154127.377$kL@newsreader.com>
Vivek.M <vivekm1234@cyberspace.org> wrote:
> Help! Aid! Assist! I get:
> background 4 -1 16931
> System returned -1
> This is on a OpenBSD grex.cyberspace.org 3.8 GENERIC#0 i386. I ssh to
> the box. I am trying to write a program that grabs "tell messages" to
> my terminal /dev/ttypE (pseudo-terminal). /dev/tty should point to my
> controlling terminal.
>
> Why is ioctl failing? Why! Oh! Why! I'm rather new to Perl and Unix so
> please tolerate my idiocy.
Did you try looking in '$!' ?
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Tue, 22 Aug 2006 01:27:44 +0530
From: Vivek.M <vivekm1234@cyberspace.org>
Subject: Re: ioctl TIOCSCTTY errno -1
Message-Id: <5r3ke212r43g8pjrqe23pmf4onpckde2cq@4ax.com>
> On 21 Aug 2006 19:41:18 GMT, xhoster@gmail.com wrote:
>Did you try looking in '$!' ?
>
>Xho
Yup. "Input/output error" when i did a print $!. I suspect that this:
$retval=ioctl(TTY, $getp, $null) || -1; is more accurate since it
gives me the UNIX system error.
------------------------------
Date: 21 Aug 2006 20:24:38 GMT
From: xhoster@gmail.com
Subject: Re: ioctl TIOCSCTTY errno -1
Message-Id: <20060821162448.215$vM@newsreader.com>
Vivek.M <vivekm1234@cyberspace.org> wrote:
> > On 21 Aug 2006 19:41:18 GMT, xhoster@gmail.com wrote:
> >Did you try looking in '$!' ?
> >
> >Xho
> Yup. "Input/output error" when i did a print $!. I suspect that this:
> $retval=ioctl(TTY, $getp, $null) || -1; is more accurate since it
> gives me the UNIX system error.
According to man ioctl, all it does on error is give you -1 and tells you
to go look in errno (which in Perl, means to look in $!). So it looks like
Perl is giving you all the info that the system is giving it.
You probably have a systems problem rather than a Perl problem.
The first thing I'd do to debug it would either be strace -f the perl, or
to re-write your example code into the analogous C code, which shouldn't be
too hard, and see what happens there.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Mon, 21 Aug 2006 12:51:59 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: perl dbi driver for microsoft sql?
Message-Id: <210820061251597693%jgibson@mail.arc.nasa.gov>
In article <1155862258.180971.201760@h48g2000cwc.googlegroups.com>,
gavino <bootiack@yahoo.com> wrote:
> Sherm Pendley wrote:
> > "Paul Lalli" <mritty@gmail.com> writes:
> >
> > > gavino wrote:
> > >> where do i find dbi driver for micrsoft sql?
> > >
> > > The same place you find all Perl Modules - http://search.cpan.org
> >
> > Quite right.
> >
> > > Is
> > >
> > > http://search.cpan.org/~jwied/Msql-Mysql-modules-1.2219/mysql/lib/DBD/mysq
> > > l.pm
> > > what you're looking for?
> >
> > Actually, no. mSQL is not Microsoft SQL Server, it's a different product:
> >
> > <http://www.hughes.com.au/products/msql/>
> >
> > I couldn't find a MS-SQL specific DBD module - I think most people use
> > DBD::ODBC.
>
> HOW?
By first creating a workable ODBC client environment on your system and
then installing the DBD::ODBC module. Then you can use the facilities
of the DBI module to access your database through the ODBC layer.
See the FAQ at http://search.cpan.org/~jurl/DBD-ODBC-1.13/ODBC.pm
It doesn't look like an enitirely trivial process (I have not done it
myself), but you are more likely to get help here if you first make the
attempt to do it yourself, then post specific questions on the problems
you encounter.
--
Jim Gibson
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: 21 Aug 2006 20:04:31 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: perl dbi driver for microsoft sql?
Message-Id: <Xns9826995A6BA78castleamber@130.133.1.4>
Jim Gibson <jgibson@mail.arc.nasa.gov> wrote:
> By first creating a workable ODBC client environment on your system
> and then installing the DBD::ODBC module. Then you can use the
> facilities of the DBI module to access your database through the ODBC
> layer.
Odd, I never did the client environment thingy. I installed the Desktop
edition (MSDE?) of MS SQL (the free version) and IIRC it worked out of the
box when I installed DBD::ODBC:
use DBI;
my $dbh = DBI->connect(
"dbi:ODBC:driver={SQL Server};"
. "Server=$ENV{ COMPUTERNAME };database=SomeDataBaseName;",
'',
'',
{
RaiseError => 1,
AutoCommit => 1
}
);
has been quite some time, but I can't recall any kind of magic required
:-)
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: Tue, 22 Aug 2006 00:19:55 +0100
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: Printing to a file Or STDOUT
Message-Id: <uI6dneldpLwGonfZRVnytA@pipex.net>
Hal Vaughan wrote:
>
> I want to be able to print to either STDOUT or to a file, so if I have a
> series of print statements like:
>
> print $fh "This is a line of text\n";
You could just print to stdout (ie: just print) and do the redirection
to a file on the command line.
--
Just because I've written it doesn't mean that
either you or I have to believe it.
------------------------------
Date: Mon, 21 Aug 2006 20:12:21 +0200
From: Martijn Lievaart <m@remove.this.part.rtij.nl>
Subject: Re: References - problem understanding them
Message-Id: <pan.2006.08.21.18.12.19.225050@remove.this.part.rtij.nl>
On Mon, 21 Aug 2006 17:47:42 +0100, David Squire wrote:
> Jürgen Herz wrote:
>> xhoster@gmail.com wrote:
>>
>>>> Though it seems to be guaranteed
>>>> and should always work, maybe it's on some "List of things better not to
>>>> do" because of something like code comprehensibility.
>>> What alternative would you propose?
>>
>> I'm far from proposing anything. But using plain hash would also work at
>> least in my example:
>>
>> my %content2 = test2();
>> for (keys %content2)
>> { print "$_: ",$content2{$_},"\n" }
>>
>> sub test2
>> {
>> my %content2 = (one => "eins", two => "zwei");
>> return %content2;
>> }
>
>
> Sure, this will work, but the entire hash gets copied when the sub
> returns. For large data structures this can be very inefficient. Passing
> around references is much more memory and time efficient for large and
> complex data structures.
Although excelent advice in heneral, in this case I would expect Perl to
optimize it out. A return of something can be implemented as copy-destroy,
or as a 'move'. The second is much more efficient.
M4
--
Redundancy is a great way to introduce more single points of failure.
------------------------------
Date: Mon, 21 Aug 2006 19:20:07 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: References - problem understanding them
Message-Id: <ecctgn$rlh$1@gemini.csx.cam.ac.uk>
Martijn Lievaart wrote:
> On Mon, 21 Aug 2006 17:47:42 +0100, David Squire wrote:
>
>> Jürgen Herz wrote:
>>> xhoster@gmail.com wrote:
>>>
>>>>> Though it seems to be guaranteed
>>>>> and should always work, maybe it's on some "List of things better not to
>>>>> do" because of something like code comprehensibility.
>>>> What alternative would you propose?
>>> I'm far from proposing anything. But using plain hash would also work at
>>> least in my example:
>>>
>>> my %content2 = test2();
>>> for (keys %content2)
>>> { print "$_: ",$content2{$_},"\n" }
>>>
>>> sub test2
>>> {
>>> my %content2 = (one => "eins", two => "zwei");
>>> return %content2;
>>> }
>>
>> Sure, this will work, but the entire hash gets copied when the sub
>> returns. For large data structures this can be very inefficient. Passing
>> around references is much more memory and time efficient for large and
>> complex data structures.
>
> Although excelent advice in heneral, in this case I would expect Perl to
> optimize it out. A return of something can be implemented as copy-destroy,
> or as a 'move'. The second is much more efficient.
It doesn't though:
----
#!/usr/bin/perl
use strict;
use warnings;
my %content2 = test2();
print "\nIn main:\n";
print \%content2, "\n";
print \$content2{'one'}, "\n";
for (keys %content2)
{ print "$_: ",$content2{$_},"\n" }
sub test2
{
my %content2 = (one => "eins", two => "zwei");
print "In sub:\n";
print \%content2, "\n";
print \$content2{'one'}, "\n";
return %content2;
}
----
Output:
In sub:
HASH(0x18153c0)
SCALAR(0x1801380)
In main:
HASH(0x180d00c)
SCALAR(0x1801434)
one: eins
two: zwei
----
This is perl, v5.8.6
DS
------------------------------
Date: Mon, 21 Aug 2006 14:21:36 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: References - problem understanding them
Message-Id: <x73bbqne4v.fsf@mail.sysarch.com>
>>>>> "ML" == Martijn Lievaart <m@remove.this.part.rtij.nl> writes:
>> Sure, this will work, but the entire hash gets copied when the sub
>> returns. For large data structures this can be very inefficient. Passing
>> around references is much more memory and time efficient for large and
>> complex data structures.
ML> Although excelent advice in heneral, in this case I would expect
ML> Perl to optimize it out. A return of something can be implemented
ML> as copy-destroy, or as a 'move'. The second is much more
ML> efficient.
it is trickier than just that. and perl 6 will be doing lazy copies and
copy on write so that will be optimizable. it would be (almost?)
impossible to make perl5 do this internally as it uses a stack to handle
sub arguments and returns.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 21 Aug 2006 19:27:04 GMT
From: xhoster@gmail.com
Subject: Re: References - problem understanding them
Message-Id: <20060821152713.721$g9@newsreader.com>
Martijn Lievaart <m@remove.this.part.rtij.nl> wrote:
> On Mon, 21 Aug 2006 17:47:42 +0100, David Squire wrote:
> > Sure, this will work, but the entire hash gets copied when the sub
> > returns. For large data structures this can be very inefficient.
> > Passing around references is much more memory and time efficient for
> > large and complex data structures.
>
> Although excelent advice in heneral, in this case I would expect Perl to
> optimize it out.
You can expect, and maybe even reasonably, but it doesn't do so.
> A return of something can be implemented as
> copy-destroy, or as a 'move'.
What would a "move" do in the case that one of the things moved
has other references hanging around? You would need to be careful or
the optimization would result in behavioral changes.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 21 Aug 2006 19:34:28 GMT
From: xhoster@gmail.com
Subject: Re: References - problem understanding them
Message-Id: <20060821153437.931$S8@newsreader.com>
Uri Guttman <uri@stemsystems.com> wrote:
> >>>>> "x" == xhoster <xhoster@gmail.com> writes:
>
> >> But I still have a bad feeling doing that. So is it considered good
> >> (or bad) style relying on this behaviour?
>
> x> It is excellent style to rely on it. And it isn't like there is a
> choice. x> Pure Perl has no user-accessible malloc or free.
>
> >> Though it seems to be guaranteed
> >> and should always work, maybe it's on some "List of things better
> >> not to do" because of something like code comprehensibility.
>
> x> What alternative would you propose?
>
> there is another style choice. returning a ref to a lexical array/hash
> may be confusing but returning an anon array/hash could be less
> confusing.
Well, either way it is ref. So that is an alternative to a different thing
than I was thinking of alternating.
> so instead of
>
> my @array ;
>
> return \@array ;
>
> do
>
> my $aref = [] ;
>
> return $aref ;
>
> they do the exact same thing but it is clearer code IMO to explicitly
> create and return an anon array (or hash). not that i haven't done the
> former in some cases but i lean to doing the latter.
Yes, this is often a good move, although I don't do it as often as I
should.
>
> the only downside to the $aref version would be how you stuff it. you
> have to deref it with ->[] or @{} where in the former case you can do
> the slightly simpler direct access to the array.
This downside is also an upside. If you return a reference to the main
code then it probably needs to access the structure via dereferncing. The
benefit of using a reference inside the sub as well is that the structure
inside the sub is accessed the same way as the structure in the main code
is accessed. That makes it a lot easier to make modifications in which you
move code that used to be in the sub out to the main (or another sub), and
vice versa.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 21 Aug 2006 16:19:40 -0700
From: "Brett.R.Davis@gmail.com" <Brett.R.Davis@gmail.com>
Subject: Use of uninitialized value in string eq at ./xml_simple line 154.
Message-Id: <1156202380.858372.263130@m73g2000cwd.googlegroups.com>
I can't seem to get rid of this message :
Use of uninitialized value in string eq at ./xml_simple line 154.
Please see code below.
The message isn't helpful, and i have tried to understand it using
"diagnostics, strict, and warnings".
Thanks!
Brett
#initialized here
my $device_id_found=0;
for ($index = $cdef_row; $index <= $ib_matrix_max_rows;
$index = $index + 1) {
if ($device_id_found == 3) { $index =
$ib_matrix_max_rows; }
line 154 -> if ($device_id_found > 0) {
if (($ib_matrix_copy[$index][0] eq "regf")) {
if
($ib_matrix_copy[$index][$column_headings{'IC'}] eq "VER") {
$device_ib_version =
$ib_matrix_copy[$index][$part_column];
print "INFO : IB Version Found
$device_ib_version\n";
$device_id_found =
$device_id_found + 1;
}
elsif
($ib_matrix_copy[$index][$column_headings{'IC'}] eq "FAM") {
$device_family =
$ib_matrix_copy[$index][$part_column];
print "INFO : Device Family Found
: $device_family\n";
$device_id_found =
$device_id_found + 1;
------------------------------
Date: 21 Aug 2006 17:50:07 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Use of uninitialized value in string eq at ./xml_simple line 154.
Message-Id: <1156207807.253495.41040@h48g2000cwc.googlegroups.com>
Brett.R.Davis@gmail.com wrote:
> I can't seem to get rid of this message :
>
> Use of uninitialized value in string eq at ./xml_simple line 154.
>
> Please see code below.
>
> The message isn't helpful, and i have tried to understand it using
> "diagnostics, strict, and warnings".
It's telling you that one of the two values that you are comparing with
the eq operator on line 154 is undefined.
> #initialized here
> my $device_id_found=0;
> for ($index = $cdef_row; $index <= $ib_matrix_max_rows;
> $index = $index + 1) {
> if ($device_id_found == 3) { $index =
> $ib_matrix_max_rows; }
> line 154 -> if ($device_id_found > 0) {
> if (($ib_matrix_copy[$index][0] eq "regf")) {
> if
> ($ib_matrix_copy[$index][$column_headings{'IC'}] eq "VER") {
> $device_ib_version =
> $ib_matrix_copy[$index][$part_column];
> print "INFO : IB Version Found
> $device_ib_version\n";
> $device_id_found =
> $device_id_found + 1;
> }
> elsif
> ($ib_matrix_copy[$index][$column_headings{'IC'}] eq "FAM") {
> $device_family =
> $ib_matrix_copy[$index][$part_column];
> print "INFO : Device Family Found
> : $device_family\n";
> $device_id_found =
> $device_id_found + 1;
Well, which one of these lines is line 154? I count three separate eq
comparison in this code, two of which use the same variable. So one of
these variables is undefined:
$ib_matrix_copy[$index][0]
$ib_matrix_copy[$index][$column_headings{'IC'}]
Figure out which line Perl is complaining about, and then debug until
you figure out why that variable is undefined.
Paul Lalli
------------------------------
Date: 21 Aug 2006 18:03:29 -0700
From: "Matt Garrish" <mgarrish@gmail.com>
Subject: Re: Use of uninitialized value in string eq at ./xml_simple line 154.
Message-Id: <1156208609.194950.166380@m79g2000cwm.googlegroups.com>
Brett.R.Davis@gmail.com wrote:
> I can't seem to get rid of this message :
>
> Use of uninitialized value in string eq at ./xml_simple line 154.
>
> Please see code below.
>
> The message isn't helpful, and i have tried to understand it using
> "diagnostics, strict, and warnings".
>
It means what it says, which is that you're attempting to compare
values using the eq operator and one or both of the scalars is
undefined. That it's reported at the beginning of the block means you
have to figure out which of the comparisons inside has the undefined
value and either give it a default value before using it, or if you
really don't care, turn of the warnings for that block.
Matt
------------------------------
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 9633
***************************************