[28771] in Perl-Users-Digest
Perl-Users Digest, Issue: 15 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 11 18:05:56 2007
Date: Thu, 11 Jan 2007 15:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 11 Jan 2007 Volume: 11 Number: 15
Today's topics:
DB_File tie error <jehutz@artsci.wustl.edu>
Re: DB_File tie error <glex_no-spam@qwest-spam-no.invalid>
Re: DB_File tie error <jehutz@artsci.wustl.edu>
Re: DB_File tie error xhoster@gmail.com
if (! mkdir $dir) joez3@yahoo.com
Re: Indirect function call via Name <uri@stemsystems.com>
Net::SSH::Perl make test fails <stahl.karl@gmail.com>
Perl 5.00404 - Label not found for "next " , next() fun <liora.keller@gmail.com>
Re: Perl 5.00404 - Label not found for "next " , next() <mritty@gmail.com>
Re: Perl 5.00404 - Label not found for "next " , next() <glex_no-spam@qwest-spam-no.invalid>
Re: Perl 5.00404 - Label not found for "next " , next() <liora.keller@gmail.com>
Re: Perl 5.00404 - Label not found for "next " , next() <liora.keller@gmail.com>
Re: Perl 5.00404 - Label not found for "next " , next() <jgibson@mail.arc.nasa.gov>
Re: Perl free e-books <john@castleamber.com>
Re: Perl free e-books <uri@stemsystems.com>
Problem using SWIG with perl <avinash.ca@gmail.com>
System Return Value? g4173c@motorola.com
Re: System Return Value? <mritty@gmail.com>
Re: System Return Value? g4173c@motorola.com
UTF-8 meta tags removed my yahoo/google mail <danparker276@yahoo.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 11 Jan 2007 11:00:13 -0800
From: "Janna" <jehutz@artsci.wustl.edu>
Subject: DB_File tie error
Message-Id: <1168542012.967302.217510@77g2000hsv.googlegroups.com>
Hello all,
I've convinced myself that the error message I'm getting from my Perl
script is sufficiently bizarre to ask for help here, but as always, it
may be that I'm making a stupid mistake as I'm fairly new to Perl.
I have a program that contains several blocks of code that are either
executed or not, depending on options specified in the command line or
through interaction with the user. Each of my 4 blocks involves
accessing a DBM file. I'll call the blocks LIT, CON, EXP, and ASSOC.
The order in which I just listed the blocks is the order in which they
appear in the program.
My problem is with the EXP block. At the beginning of the block is the
following code:
my $dbloc = "/data3/mcleod.3/aldi/janna/candid/BUILD2/humanexp.db";
my %exphash;
my $expdb = tie %exphash, "DB_File", $dbloc, O_RDWR|O_CREAT, 0640,
$DB_BTREE or die
"Cannot open this file $dbloc: $!\n";
Here's where it gets interesting. If the user specifies options such
that the EXP block is run by itself, or in any combination with the CON
and ASSOC blocks, everything's fine. If, however, the LIT block
executes, I get an error message that *starts with* "Cannot open this
file /data3/mcleod.3/aldi/janna/candid/BUILD2/humanexp.db:" If the
program is running interactively, there's no further information. If
it's running with options specified at the command line, following the
colon in the original error message is "No such file or directory".
Here is some of the original code, for the first three blocks:
LIT block
unless ($litweight == 0 and $onehitlitweight == 0) {
#Open the BTREE with the publicationsmy $dbloc =
'/data3/mcleod.3/aldi/janna/candid/BUILD2/humanpubs.db';
$DB_BTREE->{'flags'} = R_DUP;
my %pubhash;
my $pubdb = tie %pubhash, "DB_File", $dbloc, O_RDWR|O_CREAT, 0640,
$DB_BTREE or die "Cannot open $dbloc: $!\n";
#Open the BTREE with totalpubs
my $totalloc = '/data3/mcleod.3/aldi/janna/candid/BUILD2/totalpubs.db';
$DB_BTREE->{'flags'} = R_DUP;
my %totalpubhash;
my $totalpubdb = tie %totalpubhash, "DB_File", $totalloc,
O_RDWR|O_CREAT, 0640, $DB_BTREE or die "Cannot open $totalloc: $!\n";
undef $pubdb;
untie %pubhash;
undef $totalpubdb;
untie %totalpubhash;
}
CON block
unless ($conweight == 0) {
#Load BTREE of Homologene data.
my $dbloc = '/data3/mcleod.3/aldi/janna/candid/BUILD2/humanhomol.db';
my %homolhash;
my $homoldb = tie %homolhash, "DB_File", $dbloc, O_RDWR|O_CREAT, 0640,
$DB_BTREE or die "Cannot open $dbloc: $!\n";
undef $homoldb;
untie %homolhash;
}
EXP block
unless ($expweight == 0) {
my %tissuehash;
foreach (my $count=0; $count<@exptissues; $count++) {
$tissuehash{$exptissues[$count]} = 1;}
# Load exphash
my $dbloc = "/data3/mcleod.3/aldi/janna/candid/BUILD2/humanexp.db";
my %exphash;
my $expdb = tie %exphash, "DB_File", $dbloc, O_RDWR|O_CREAT, 0640,
$DB_BTREE or die "Cannot open this file $dbloc: $!\n";
undef $expdb;
untie %exphash;
}
There's more code I can include if needed, and I've chopped out the
guts of each block where the operations with the hashes are performed.
That said...any insight?
------------------------------
Date: Thu, 11 Jan 2007 14:29:13 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: DB_File tie error
Message-Id: <45a69d67$0$10303$815e3792@news.qwest.net>
Janna wrote:
> Here is some of the original code, for the first three blocks:
>
> LIT block
> unless ($litweight == 0 and $onehitlitweight == 0) {
> #Open the BTREE with the publicationsmy $dbloc =
> '/data3/mcleod.3/aldi/janna/candid/BUILD2/humanpubs.db';
That's exactly how your code appears??.. mmm.. that whole line is
commented out, so dbloc isn't defined.
Let perl help you.
use strict;
use warnings;
------------------------------
Date: 11 Jan 2007 12:38:25 -0800
From: "Janna" <jehutz@artsci.wustl.edu>
Subject: Re: DB_File tie error
Message-Id: <1168547905.625998.40550@i39g2000hsf.googlegroups.com>
I'm sorry - when I pasted the code into my original message, everything
was pasted as one line, and I apparently missed a line break when I
re-entered them. It really appears in the code as:
#Open the BTREE with the publications
my $dbloc = '/data3/mcleod.3/aldi/janna/candid/BUILD2/humanpubs.db';
$DB_BTREE->{'flags'} = R_DUP;
my %pubhash;
my $pubdb = tie %pubhash, "DB_File", $dbloc, O_RDWR|O_CREAT, 0640,
$DB_BTREE or die "Cannot open $dbloc: $!\n";
Also, I have "use strict; use warnings;" at the beginning of my script,
and also in the blocks, just in case. If perl wants to help me, I
suppose it's going to have to talk a little louder.
J. Gleixner wrote:
> Janna wrote:
>
> > Here is some of the original code, for the first three blocks:
> >
> > LIT block
> > unless ($litweight == 0 and $onehitlitweight == 0) {
> > #Open the BTREE with the publicationsmy $dbloc =
> > '/data3/mcleod.3/aldi/janna/candid/BUILD2/humanpubs.db';
>
> That's exactly how your code appears??.. mmm.. that whole line is
> commented out, so dbloc isn't defined.
>
> Let perl help you.
>
> use strict;
> use warnings;
------------------------------
Date: 11 Jan 2007 22:38:58 GMT
From: xhoster@gmail.com
Subject: Re: DB_File tie error
Message-Id: <20070111174109.797$xR@newsreader.com>
"Janna" <jehutz@artsci.wustl.edu> wrote:
...
>
> Here's where it gets interesting. If the user specifies options such
> that the EXP block is run by itself, or in any combination with the CON
> and ASSOC blocks, everything's fine. If, however, the LIT block
> executes, I get an error message that *starts with* "Cannot open this
> file /data3/mcleod.3/aldi/janna/candid/BUILD2/humanexp.db:" If the
> program is running interactively, there's no further information. If
> it's running with options specified at the command line, following the
> colon in the original error message is "No such file or directory".
...
>
> EXP block
> unless ($expweight == 0) {
> my %tissuehash;
> foreach (my $count=0; $count<@exptissues; $count++) {
> $tissuehash{$exptissues[$count]} = 1;}
> # Load exphash
> my $dbloc = "/data3/mcleod.3/aldi/janna/candid/BUILD2/humanexp.db";
> my %exphash;
> my $expdb = tie %exphash, "DB_File", $dbloc, O_RDWR|O_CREAT, 0640,
> $DB_BTREE or die "Cannot open this file $dbloc: $!\n";
Add some additional diagnostic things here.
my $expdb = tie %exphash, "DB_File", $dbloc, O_RDWR|O_CREAT, 0640,
$DB_BTREE or do {
warn "-e ", -e $dbloc, " -f ", -f $dbloc;
warn "@{[stat $dbloc]}";
die "Cannot open this file $dbloc: $!\n";
};
>
> undef $expdb;
> untie %exphash;
> }
>
> There's more code I can include if needed, and I've chopped out the
> guts of each block where the operations with the hashes are performed.
Have you run the program with those guts chopped out to see if the error
reproduces that way?
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 11 Jan 2007 14:39:31 -0800
From: joez3@yahoo.com
Subject: if (! mkdir $dir)
Message-Id: <1168555171.496404.252620@k58g2000hse.googlegroups.com>
I have the following if statment in some code that I got at work:
if (! mkdir $dir)
When I try to run this code no matter what I set $dir to it fails with:
Not enough arguments for mkdir at test.pl line 11, near "$dir ) "
Execution of test.pl aborted due to compilation errors.
Why doesn't this code work on windows? Is there a way to make it work?
Thanks,
Zim
------------------------------
Date: Thu, 11 Jan 2007 13:17:46 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Indirect function call via Name
Message-Id: <x74pqx1l85.fsf@mail.sysarch.com>
>>>>> "R" == Ronny <ro.naldfi.scher@gmail.com> writes:
R> anno4000@radom.zrz.tu-berlin.de schrieb:
>> > our $func="bar";
>> > # Of course the following would not work
>> > &$func(@_);
>>
>> What makes you think it doesn't work? Switch off strict 'refs' and
>> it does.
R> Thanks a lot!! I should have known this already!
you should still use a dispatch table as was mentioned before. it is
safer and smarter. symrefs are just using the symbol table as a hash so
why not use your own hash? it is safer as only the subs you allow can be
called and you can use different keys vs the actual sub names. there is
NO advantage to using symrefs for this and only downsides.
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: 11 Jan 2007 10:06:09 -0800
From: "Ishmael" <stahl.karl@gmail.com>
Subject: Net::SSH::Perl make test fails
Message-Id: <1168538768.937499.12170@k58g2000hse.googlegroups.com>
I'm trying to install Net::SSH::Perl. I've installed all the necessary
modules, including Math::GMP (what torture). I've run perl Makefile.PL
and have received no errors or warnings. Alas, when I run 'make test',
I get the following error message. Any idea what this means? Or how
to fix it? Thanks for your help!
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/01-compile.....ok
t/02-buffer......ok
t/03-packet......ok 1/10syswrite() on unopened filehandle FH at
/home/kstahl/PERL/Net-SSH-Perl-1.30/blib/lib/Net/SSH/Perl/Packet.pm
line 276.
Use of uninitialized value in numeric eq (==) at
/home/kstahl/PERL/Net-SSH-Perl-1.30/blib/lib/Net/SSH/Perl/Packet.pm
line 52.
Connection closed by remote host. at t/03-packet.t line 44
# Looks like you planned 10 tests but only ran 1.
# Looks like your test died just after 1.
t/03-packet......dubious
Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 2-10
Failed 9/10 tests, 10.00% okay
t/04-config......ok
t/05-cipher......ok
t/06-circular....ok
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
t/03-packet.t 255 65280 10 18 180.00% 2-10
Failed 1/6 test scripts, 83.33% okay. 9/116 subtests failed, 92.24%
okay.
make: *** [test_dynamic] Error 11
------------------------------
Date: 11 Jan 2007 10:35:37 -0800
From: "Liora" <liora.keller@gmail.com>
Subject: Perl 5.00404 - Label not found for "next " , next() function
Message-Id: <1168540537.160835.145350@o58g2000hsb.googlegroups.com>
I am running a perl sript that has the next() function, but some of my
systems can not find the function next() :
this is the error
Label not found for "next "
I checked the list of functions for 5.00404, and next() is build in.
Any idea why perl can not see this function?
Thanks,
Liora
------------------------------
Date: 11 Jan 2007 10:44:53 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Perl 5.00404 - Label not found for "next " , next() function
Message-Id: <1168541093.744544.143720@77g2000hsv.googlegroups.com>
Liora wrote:
> I am running a perl sript that has the next() function
next is not a function. It's a control loop modifier.
>, but some of my systems can not find the function next() :
Yes they can.
> this is the error
>
> Label not found for "next "
Uh-huh. And what makes you think that means it can't find next? It
very specifically says that it's the label that can't be found.
> I checked the list of functions for 5.00404, and next() is build in.
Is there any particular reason you're using such an ancient version of
Perl?
> Any idea why perl can not see this function?
Please read the built in Perl documentation for all the error messages,
`perldoc perldiag`. Or simply add the line:
use diagnostics;
to the beginning of your program. You will see the following text
printed out:
Label not found for "next %s"
(F) You named a loop to continue, but you're not
currently in a loop of that name, not even if you count
where you were called from. See "last" in perlfunc.
So clearly you're doing something wrong. Unfortunately, you haven't
shown any code that would let us help you fix it.
Paul Lalli
------------------------------
Date: Thu, 11 Jan 2007 12:53:14 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Perl 5.00404 - Label not found for "next " , next() function
Message-Id: <45a686e8$0$509$815e3792@news.qwest.net>
Liora wrote:
> I am running a perl sript that has the next() function, but some of my
> systems can not find the function next() :
>
> this is the error
>
> Label not found for "next "
>
> I checked the list of functions for 5.00404, and next() is build in.
>
> Any idea why perl can not see this function?
Post an example. Also, it's 'next;', not 'next();'.
perldoc -f next
------------------------------
Date: 11 Jan 2007 10:58:23 -0800
From: "Liora" <liora.keller@gmail.com>
Subject: Re: Perl 5.00404 - Label not found for "next " , next() function
Message-Id: <1168541903.143874.307140@i56g2000hsf.googlegroups.com>
Paul,
Thanks for your reaply, I am new at posting.
this is a script, I did not write, but it is running on most systems I
installed it on.
Here is the code:
open (NETFILE, "$NETSTAT |") ;
while (<NETFILE>) {
chomp $_ ;
$LINE = $_ ;
if (( $LINE =~ /Name/ ) || ( $LINE =~ /^$/ )) {
next() ;
}
else {
@DevLine = split (/\s+/, $LINE) ;
}
$Intf = $DevLine[0] ;
$Mtu = $DevLine[1] ;
$NetDest = $DevLine[2] ;
$NetDest =~ s/\..*//g ;
$Address = $DevLine[3] ;
$Address =~ s/\..*//g ;
$Ipkts = $DevLine[4] ;
$Ierrs = $DevLine[5] ;
$Opkts = $DevLine[6] ;
$Oerrs = $DevLine[7] ;
$Colls = $DevLine[8] ;
## print "$Intf $Mtu $NetDest $NetDest $Ipkts $Ierrs $Opkts
$Oerrs $Colls
0\n" ;
printf "%-6s%-6s%-20s%-20s%-12s%-12s%-12s%-6s%-8s%-5s\n", $Intf, $Mtu,
$NetDest,
$NetDest, $Ipkts, $Ierrs, $Opkts, $Oerrs, $Colls, 0 ;
}
Thanks,
Liora
Paul Lalli wrote:
> Liora wrote:
> > I am running a perl sript that has the next() function
>
> next is not a function. It's a control loop modifier.
>
> >, but some of my systems can not find the function next() :
>
> Yes they can.
>
> > this is the error
> >
> > Label not found for "next "
>
> Uh-huh. And what makes you think that means it can't find next? It
> very specifically says that it's the label that can't be found.
>
> > I checked the list of functions for 5.00404, and next() is build in.
>
> Is there any particular reason you're using such an ancient version of
> Perl?
>
> > Any idea why perl can not see this function?
>
> Please read the built in Perl documentation for all the error messages,
> `perldoc perldiag`. Or simply add the line:
> use diagnostics;
> to the beginning of your program. You will see the following text
> printed out:
>
> Label not found for "next %s"
> (F) You named a loop to continue, but you're not
> currently in a loop of that name, not even if you count
> where you were called from. See "last" in perlfunc.
>
> So clearly you're doing something wrong. Unfortunately, you haven't
> shown any code that would let us help you fix it.
>
> Paul Lalli
------------------------------
Date: 11 Jan 2007 11:06:39 -0800
From: "Liora" <liora.keller@gmail.com>
Subject: Re: Perl 5.00404 - Label not found for "next " , next() function
Message-Id: <1168542399.587527.283480@o58g2000hsb.googlegroups.com>
J.
Do I have any environment variables set before I run perl?
Thanks,
Liora
J. Gleixner wrote:
> Liora wrote:
> > I am running a perl sript that has the next() function, but some of my
> > systems can not find the function next() :
> >
> > this is the error
> >
> > Label not found for "next "
> >
> > I checked the list of functions for 5.00404, and next() is build in.
> >
> > Any idea why perl can not see this function?
>
> Post an example. Also, it's 'next;', not 'next();'.
>
> perldoc -f next
------------------------------
Date: Thu, 11 Jan 2007 13:33:23 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Perl 5.00404 - Label not found for "next " , next() function
Message-Id: <110120071333234960%jgibson@mail.arc.nasa.gov>
In article <1168541903.143874.307140@i56g2000hsf.googlegroups.com>,
Liora <liora.keller@gmail.com> wrote:
Please do not top-post. Please read the Posting Guidelines for this
group before you post again if you wish to increase the probability of
getting a useful answer.
> Paul,
>
> Thanks for your reaply, I am new at posting.
> this is a script, I did not write, but it is running on most systems I
> installed it on.
>
> Here is the code:
>
> open (NETFILE, "$NETSTAT |") ;
>
> while (<NETFILE>) {
>
> chomp $_ ;
> $LINE = $_ ;
>
> if (( $LINE =~ /Name/ ) || ( $LINE =~ /^$/ )) {
> next() ;
> }
> else {
> @DevLine = split (/\s+/, $LINE) ;
> }
>
> $Intf = $DevLine[0] ;
> $Mtu = $DevLine[1] ;
> $NetDest = $DevLine[2] ;
> $NetDest =~ s/\..*//g ;
> $Address = $DevLine[3] ;
> $Address =~ s/\..*//g ;
> $Ipkts = $DevLine[4] ;
> $Ierrs = $DevLine[5] ;
> $Opkts = $DevLine[6] ;
> $Oerrs = $DevLine[7] ;
> $Colls = $DevLine[8] ;
>
> ## print "$Intf $Mtu $NetDest $NetDest $Ipkts $Ierrs $Opkts
> $Oerrs $Colls
> 0\n" ;
> printf "%-6s%-6s%-20s%-20s%-12s%-12s%-12s%-6s%-8s%-5s\n", $Intf, $Mtu,
> $NetDest,
> $NetDest, $Ipkts, $Ierrs, $Opkts, $Oerrs, $Colls, 0 ;
>
> }
Is this the entire program? I doubt it. Your program is trying to call
a subroutine (next()) that is named the same as a Perl built-in
keyword. That can only lead to trouble. Is there a next() subroutine
defined in your program (the part you are not showing us)? If so,
rename it and rename the call to next() you have shown above.
Put the following at the beginning of your program:
use strict;
use warnings;
Try to reduce a test program to the minimum lines of code that
demonstrate the problem you are having. Indent loops and other block
statements to improve readability.
Good luck!
--
Jim Gibson
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: 11 Jan 2007 18:00:12 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Perl free e-books
Message-Id: <Xns98B57A19FCB0Ecastleamber@130.133.1.4>
"Shuo Shi" <moya0901@126.com> wrote:
> John,It is very nice of you! I am moving by your kindness.
And I am, sadly, moved by your ignorance.
Don't top post
Don't reply using HTML
> However, I
> tried to look through the material from your below link, it is still
> not pdf format, and the pdf book which you refer to is not real what I
> want,
It's clear that you want a professional book in PDF format. There are a
few free, but I guess that the one you want is a book that you have to pay
for. Like I wrote earlier on, then pay for it, or borrow it. By paying you
indirectly support the Perl community. By downloading it you don't.
If you are not able to find a pdf file other then by begging in a Perl
group I don't have much hope for your programming capabilities.
IMO a part of programming involves ethics. And while I think it's not a
problem to glimpse over a downloaded pirated book once in a while, like I
think (note the I) to listen to downloaded music in a while isn't going to
kill the music industry.
But I also do think that buying a book (or CDs / DVDs) is a good thing.
And if more ebooks become available without weird limiting protection
schemes I am sure to buy those instead of the paper version if the price
is right. People who pirate somehow make publishers willing to do so panic
here and there. While this might not be justified, I mean, pirated books
do happen. And protection is pissing customers off, while pirates already
have the unprotected version in a torrent or two.
Buying books might make this happen:
http://www.apress.com/free/index.html
As for Perl, there is plenty of /good/ and /free/ material out there. The
non-free material is often written by professionals that have been
supporting the Perl community for years. Show some respect, sooner then
you expect it will be paying back.
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: Thu, 11 Jan 2007 13:22:44 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Perl free e-books
Message-Id: <x7zm8pzamj.fsf@mail.sysarch.com>
>>>>> "SS" == Shuo Shi <moya0901@126.com> writes:
SS> John,It is very nice of you! I am moving by your
SS> kindness. However, I tried to look through the material from your
SS> below link, it is still not pdf format, and the pdf book which you
SS> refer to is not real what I want, my hope is that I could get a
SS> formal pdf book, just like <<Profssional Perl Programming >> which
SS> is from Wrox book concern ...... etc. If you have, would you
go to learn.perl.org and you will find the book beginning perl which is
totally free, good quality and in pdf format. you can also print the
perldocs in almost any format you want. look for pod to pdf conversion
utilities if you must use that. but you can print the perldocs from man
format, plain text, ps or others. so don't keep whining you must have
pdf format if you are just going to print the docs. and the docs are
your best resource for learning perl. there are over 1000 pages of them.
don't print them all, look in the top level doc called just 'perl' and
it lists them all by category.
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: 11 Jan 2007 11:38:35 -0800
From: "None" <avinash.ca@gmail.com>
Subject: Problem using SWIG with perl
Message-Id: <1168544315.609952.84190@p59g2000hsd.googlegroups.com>
Hi,
I was trying to use SWIG to expose some C++ functions to perl. But, I
ran into some issues here. I don't know why, but I see that a macro in
SWIG replaces "NORMAL" with "PL_op->op_next"...
I ran the following test:
Files:
test.cxx:
#include "test.h"
test.h:
enum User
{
NORMAL = 1,
FOREIGN = 2
};
test.i:
/* File : test.i */
%module test
%{
#include "test.h"
%}
/* Let's just grab the original header file here */
%include "test.h"
If I run the Makefile (similar to the one in Examples/Perl5 directory
in SWIG), it gives the following error :
In file included from test_wrap.cxx:1464:
test.h:5: error: `PL_op' redeclared as different kind of symbol
/prj/qisdcrm/QChat/perl-5.6.1-Linux/lib/5.6.1/i686-linux/CORE/thrdvar.h:25:
error: previous declaration of `OP*PL_op'
test.h:5: error: declaration of `PL_op'
/prj/qisdcrm/QChat/perl-5.6.1-Linux/lib/5.6.1/i686-linux/CORE/thrdvar.h:25:
error: conflicts with previous declaration `OP*PL_op'
test.h:5: error: expected `}' before '->' token
test.h:5: error: expected unqualified-id before '->' token
test.h:8: error: expected declaration before '}' token
make[1]: *** [perl5_cpp] Error 1
It seems that some macro replaces "NORMAL" with "PL_op->op_next". I ran
a "grep" for "NORMAL" in the SWIG directory, but could not find
anything that replaces it. Can anyone help me with this?
Thanks,
Avinash.
------------------------------
Date: 11 Jan 2007 10:01:59 -0800
From: g4173c@motorola.com
Subject: System Return Value?
Message-Id: <1168538519.419620.264610@i39g2000hsf.googlegroups.com>
Hi:
I've been reading perldoc -f system and have been trying:
system ("verix -i ${design}.ctl") == 0 or die "ERROR: verix -i
${design}.ctl Failed!, Please check verix.log\n";
To get the return value.
I see the program doing:
**> exit 1
However it doesn't execute the die command. I've also tried this in and
If statement and other things, but without any luck. Any ideas what
else I could try?
Thanks is advanced for any help here!
Tom
------------------------------
Date: 11 Jan 2007 10:10:41 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: System Return Value?
Message-Id: <1168539041.086552.35660@o58g2000hsb.googlegroups.com>
g41...@motorola.com wrote:
> I've been reading perldoc -f system and have been trying:
>
> system ("verix -i ${design}.ctl") == 0 or die "ERROR: verix -i
> ${design}.ctl Failed!, Please check verix.log\n";
>
> To get the return value.
>
> I see the program doing:
>
> **> exit 1
What does it mean that the program is "doing" that? Is that output
that the verix program generates? Or is that a line of code in verix
that you think it should be executing?
> However it doesn't execute the die command.
Then system() is pretty clearly returning 0.
> I've also tried this in and
> If statement and other things, but without any luck. Any ideas what
> else I could try?
I don't really understand what your question is, or what problem you're
trying to solve. My *guess* is that you are under the belief that the
verix program is exiting with a status of 1, and that the Perl program
is therefore wrong because it's not executing the die() statement. Is
that correct? If so, I respectfully disagree.
If the die() statement is not executing, then system() returned 0.
Period. No other way around it. Your assumption about what verix
exited with, therefore, is wrong. Why not simply run the verix command
in a shell, and echo out the value of $? to see what it actually is?
You can also try capturing the value of system, and/or print the value
of $? from within the Perl script:
my $retval = system ("verix -i ${design}.ctl");
if ($retval != 0) {
die "ERROR: verix -i ${design}.ctl Failed: $retval ($?)\n";
} else {
warn "I think something's wrong - system() returned 0 ($?)\n";
}
Paul Lalli
------------------------------
Date: 11 Jan 2007 10:24:37 -0800
From: g4173c@motorola.com
Subject: Re: System Return Value?
Message-Id: <1168539876.617164.99200@o58g2000hsb.googlegroups.com>
> You can also try capturing the value of system, and/or print the value
> of $? from within the Perl script:
Good idea, tried that and got:
**> exit 1
0
This is what Verix program does after it finds an error, however
doesn't
seem to set the return value correctly.
Thanks for the help!
Tom
------------------------------
Date: 11 Jan 2007 11:44:44 -0800
From: "danparker276@yahoo.com" <danparker276@yahoo.com>
Subject: UTF-8 meta tags removed my yahoo/google mail
Message-Id: <1168544684.045977.106370@77g2000hsv.googlegroups.com>
I set UTF-8 in the header and with meta tags. But my yahoo or google
mail web browser removes the meta tags I have, and displays it as ISO.
My emails work fine in outlook and other mail readers. Is there
anything that can be done to make sure yahoo and google use utf-8
instead of iso?
------------------------------
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 15
*************************************