[25087] in Perl-Users-Digest
Perl-Users Digest, Issue: 7337 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 29 06:05:52 2004
Date: Fri, 29 Oct 2004 03:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 29 Oct 2004 Volume: 10 Number: 7337
Today's topics:
Attempting to create a C .h file to an Assembly .inc fi <dragontamer5788@yahoo.com>
Re: Attempting to create a C .h file to an Assembly .in <tassilo.von.parseval@rwth-aachen.de>
Re: Common file operations <do-not-use@invalid.net>
Re: Common file operations <bik.mido@tiscalinet.it>
Re: Common file operations <bik.mido@tiscalinet.it>
FAQ 6.16: How do I efficiently match many regular expre <comdog@panix.com>
IDEs <nospam@nospam.com>
Re: IDEs <nospam@nospam.com>
Re: Little question on regex. <do-not-use@invalid.net>
Re: modifying hash key (dispatch table) <do-not-use@invalid.net>
Re: OT: perl errors <jwillmore@adelphia.net>
Re: OT: perl errors <jeff@spamalanadingong.com>
Re: OT: perl errors <noreply@gunnar.cc>
Re: OT: perl errors <mritty@gmail.com>
Re: PERL 64bit Question <tassilo.von.parseval@rwth-aachen.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 29 Oct 2004 00:06:42 -0400
From: Percival <dragontamer5788@yahoo.com>
Subject: Attempting to create a C .h file to an Assembly .inc file
Message-Id: <2udtskF2947dfU1@uni-berlin.de>
Hello, I am reletivly newbish at Perl and would like to build a
translator between C .h files into Nasm assembly .inc files. The only
things that I will translate between them are constants, structures, and
possibly unions.
For those who don't know C, here is the problem. Constants are defined
in two ways,
#define MyConstant 500
/\ Don't worry about that one, i got that part of the program done.
enum {
CONSTANT = 0, CONSTANT2, CONSTANT3
};
Where the = is optional, whitespaces are the only delimiter, and
constants increase by one as they move to the right. Example:
enum { Red, White, Blue};
Sets Red equal to 0, White to 1, and Blue to 2
enum { Red, White = 5, Blue};
Sets red equal to 0, white to 5, and blue to 6
enum { Red = 10, White = 2, Blue};
Sets red equal to 10, white to 2, and blue to 3.
And constants should be translated to my assembler like so:
MyConstant equ 500
CONSTANT equ 0
CONSTANT2 equ 1
CONSTANT3 equ 2
The #define statement is straightforward, and I have that part of the
program complete, (as define always comes in the beginning of the line
and so forth)
But i do not have a plan on implementing the enum feature in C. What may
help is that newlines and tabs are all treated as whitespace in C, and
all whitespaces after the first are ignored, and if the character isn't
allowed in symbols whitespaces before and after it are ignored. '=',
',', '{' and '}' are the only ones that probably will appear in enum. So:
enum {
abc = 5,
def = 10,
ghi = 11
};
Is the same as:
enum{abc=5,def=10,ghi=11};
Is the same as
enum
{
abc= 5, def=10
ghi =11 }
;
Thanks for your help.
Percival
------------------------------
Date: Fri, 29 Oct 2004 06:50:07 +0200
From: "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de>
Subject: Re: Attempting to create a C .h file to an Assembly .inc file
Message-Id: <slrnco3ivv.r8.tassilo.von.parseval@localhost.localdomain>
Also sprach Percival:
> Hello, I am reletivly newbish at Perl and would like to build a
> translator between C .h files into Nasm assembly .inc files. The only
> things that I will translate between them are constants, structures, and
> possibly unions.
>
> For those who don't know C, here is the problem. Constants are defined
> in two ways,
[...]
> But i do not have a plan on implementing the enum feature in C. What may
> help is that newlines and tabs are all treated as whitespace in C, and
> all whitespaces after the first are ignored, and if the character isn't
> allowed in symbols whitespaces before and after it are ignored. '=',
> ',', '{' and '}' are the only ones that probably will appear in enum. So:
> enum {
> abc = 5,
> def = 10,
> ghi = 11
> };
>
> Is the same as:
> enum{abc=5,def=10,ghi=11};
> Is the same as
>
> enum
>
> {
>
> abc= 5, def=10
>
> ghi =11 }
>
>
> ;
h2xs, the utility that creates a Perl module skeleton from a C-header,
is capable of parsing enums. The parsing looks like this:
no warnings 'uninitialized';
# Remove C and C++ comments
$src =~ s#/\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)#$2#gs;
# The while loop iterates over one complete enum-block:
while ($src =~ /(\benum\s*([\w_]*)\s*\{\s([\s\w=,]+)\})/gsc) {
my ($enum_name, $enum_body) =
$1 =~ /enum\s*([\w_]*)\s*\{\s([\s\w=,]+)\}/gs;
my $val = 0;
for my $item (split /,/, $enum_body) {
my ($key, $declared_val) = $item =~ /(\w*)\s*=\s*(.*)/;
$val = length($declared_val) ? $declared_val : 1 + $val;
# $key is now the constant name, $val its value
}
}
For that to work, it's necessary to slurp the whole header into $src. It
doesn't work if you try to process the file linewise. Also, C comments
(that may show up in enums, too) have to be stripped.
Having a closer look at the above, I think it doesn't catch all cases.
Most notably, it should fail on:
enum id { CONSTANT };
That is: It should fail when only one key is in the enumeration.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: 29 Oct 2004 09:55:07 +0200
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: Common file operations
Message-Id: <yzdacu62c2s.fsf@invalid.net>
Ben Morrow <usenet@morrow.me.uk> writes:
> Quoth "Shmuel (Seymour J.) Metz" <spamtrap@library.lspace.org.invalid>:
> > In <31bvn0pnelmb5sgm3k5ds5ffcjavv4lfjn@4ax.com>, on 10/27/2004
> > at 04:34 PM, Michele Dondi <bik.mido@tiscalinet.it> said:
> > >Hey, and you said you had never heard about regexen...
> >
> > Correct. Check the spelling ;-)
>
> regex is the usual spelling in this group, and regexen the usual plural.
[totally off-topic:]
"Regexen" with the same stress pattern as "oxen"? Or with the stress
on the first 'e'? (Of course, "in this group" we only write, not talk,
but one has to pronounce these things occasionally, I suppose.)
------------------------------
Date: Fri, 29 Oct 2004 10:04:06 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Common file operations
Message-Id: <kuq3o0pr14hpdb16tsl3uv5e0sgucf2uam@4ax.com>
On Thu, 28 Oct 2004 10:36:45 -0300, "Shmuel (Seymour J.) Metz"
<spamtrap@library.lspace.org.invalid> wrote:
> 1. If I have a partial file name, how do I get the complete path?
It depends on what you mean with "partial file name"...
>The answer seems to be Cwd::abs_path
Indeed, since you want to get the "complete path", this could well be
the right tool. Only it's not clear to me if it *is* what you were
looking for, as you still write "seems".
> and issuing an ls command seem like overkill. I could use readdir
> if I don't need a recursive search, but I was hoping for an
> equivalent of SysFileTree in OS/2.
Unfortunately I'm not much familiar with SysFileTree (I guess it's a
system call, or more probably a system library call, isn't it?) and so
I guess are most other people here. What does it return?
>There doesn't seem to be a single service that will handle recursion.
>File::Find as documented doesn't do the matching. What I'm looking for
File::Find as documented lets *you* do whatever you like, including
matches. This is why in my first post I asked you if you knew about
regexen:
#!/usr/bin/perl -l
use strict;
use warnings;
use File::Find;
@ARGV=grep { -d or !warn "`$_': no such directory\n" } @ARGV;
die "Usage: $0 <dir> [<dirs>]\n" unless @ARGV;
find sub {
return unless /metz/i and -f;
print $File::Find::name;
}, @ARGV;
__END__
>is a directory tree-walking function that applies matching criteria
>and only returns the files meeting those criteria. If I drop the
>requirement for recursion then calling glob with the output of
>abs_path would work.
Again, File::Find seems to be the right tool for this. It will let you
walk through one or more directory trees and you can check for
yourself which files match your criteria, as per the simplicistic
example above, but probably in a more elaborate way.
>[2] Specifically, a .inf file for the OS/2 view command.
^^^
^^^
What does this footnote refer to?
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 29 Oct 2004 10:04:08 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Common file operations
Message-Id: <55s3o011qguibo2r9dh551f2afhs82okch@4ax.com>
On Thu, 28 Oct 2004 11:13:19 -0300, "Shmuel (Seymour J.) Metz"
<spamtrap@library.lspace.org.invalid> wrote:
>>Also, with modern perls it's better to
>> use warnings;
>
>Do you mean instead of the taint flag?
Instead of -w.
>>> my ($dir,$file)=@ARGV;
>
>>Hmmm, then I'd rather do (somthing like):
>> @ARGV == 2 or die "Usage: $0 <wildcard> <file>\n";
>
>ITYM in additon to the existing code.
Yes, but also instead of the cmt explaining what should be in @ARGV.
>>Then I suggest you do something like
>> s/^'//, s/'$// for $dir;
>
>Thanks. In this case efficiency is irelevant, but if I need to do
>something similar inside a loop, is the clear version as fast as the
>other?
IMHO even in a loop efficiency issues related to this kind of things
would be most probably irrelevant. Experience shows that rarely big
efficiency gains stem from such micro-optimizations.
However I *think* that as the regexen are much simpler, it should be
actually faster. I don't know if the C<for> statement modifier, used
only for topicalization here, adds any overhead.
Well, it's not just the same (hope it's fair to me to point this out),
but we can at least benchmark the two substitution solutions:
#!/usr/bin/perl
use strict;
use warnings;
use Benchmark qw/:all/;
cmpthese 500_000, {
single => sub {
my @a=qw/foo 'bar baz' 'foobarbaz'/;
s/'?([^\']*)'$/$1/ for @a;
},
double => sub {
my @a=qw/foo 'bar baz' 'foobarbaz'/;
s/^'//, s/'$// for @a;
}
};
__END__
Rate single double
single 85763/s -- -44%
double 154321/s 80% --
Indicating that "my" solution *may* be 80% faster than "yours". Also,
search 'WARNING' in perldoc perlre. You may be interested in reading
that.
>>Oh, this one too, then why not doing them both in one run?
>
>It was incremental Q&D code.
BTW: "Q&D"? (Sorry, I'm not a native English speaker.)
>>Also, still if you really *do* want to print all those info, then
>>for clarity resons you may consider an HERE doc instead.
>
>EXPN?
perldoc perlop
However, wrt the code you posted, something like:
print <<"EOF";
BEFORE:
\$dir = $dir
\$file = $file
AFTER:
\$dir = @{[ rmquotes $dir ]}
\$file = @{[ rmquotes $file ]}
EOF
sub rmquotes {
s/^'//, s/'$// for @_;
@_;
}
C:\TEMP>perl metz.pl 'foo' 'bar'
BEFORE:
$dir = 'foo'
$file = 'bar'
AFTER:
$dir = foo
$file = bar
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 29 Oct 2004 10:03:01 +0000 (UTC)
From: PerlFAQ Server <comdog@panix.com>
Subject: FAQ 6.16: How do I efficiently match many regular expressions at once?
Message-Id: <clt4gl$539$1@reader1.panix.com>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.
--------------------------------------------------------------------
6.16: How do I efficiently match many regular expressions at once?
The following is extremely inefficient:
# slow but obvious way
@popstates = qw(CO ON MI WI MN);
while (defined($line = <>)) {
for $state (@popstates) {
if ($line =~ /\b$state\b/i) {
print $line;
last;
}
}
}
That's because Perl has to recompile all those patterns for each of the
lines of the file. As of the 5.005 release, there's a much better
approach, one which makes use of the new "qr//" operator:
# use spiffy new qr// operator, with /i flag even
use 5.005;
@popstates = qw(CO ON MI WI MN);
@poppats = map { qr/\b$_\b/i } @popstates;
while (defined($line = <>)) {
for $patobj (@poppats) {
print $line if $line =~ /$patobj/;
}
}
--------------------------------------------------------------------
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-2002 Tom Christiansen and Nathan
Torkington, and other contributors as noted. All rights
reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
------------------------------
Date: Fri, 29 Oct 2004 02:05:08 -0400
From: "daniel kaplan" <nospam@nospam.com>
Subject: IDEs
Message-Id: <1099029938.288864@nntp.acecape.com>
For whatever my opinion is or isn't worth here, I gave up on Open-Perl-IDE
and went back to the AS Komodo IDE. O.P. just seemed to give me so many
headaches related to the modules (in my USE statements) before exectuing my
first line of code.
So despite the fact that I feel Komodo is slow to start, am just getting
around using it easier.
------------------------------
Date: Fri, 29 Oct 2004 02:48:20 -0400
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: IDEs
Message-Id: <1099032530.903403@nntp.acecape.com>
"daniel kaplan" <nospam@nospam.com> wrote in message
news:1099029938.288864@nntp.acecape.com...
> For whatever my opinion is or isn't worth here, I gave up on Open-Perl-IDE
> and went back to the AS Komodo IDE. O.P. just seemed to give me so many
> headaches related to the modules (in my USE statements) before exectuing
my
> first line of code.
>
> So despite the fact that I feel Komodo is slow to start, am just getting
> around using it easier.
Oh, I don't know how or who keeps up the FAQ, but at least two of the links
to IDEs found via perldoc -q "IDE" were links that were either dead or
didn't take me to the IDEs they claimed they would...
------------------------------
Date: 29 Oct 2004 10:37:56 +0200
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: Little question on regex.
Message-Id: <yzd1xfh3onv.fsf@invalid.net>
neoasimov@hotmail.com (NeoAsimov) writes:
> I want to select specific lines of C++ source codes.
>
> There is the pattern that I want to match:
>
> I want a line that have a "..." string in but not any "//" characters.
>
> Exemple:
>
> public void Foo("test") [This one match]
> // public void Foo("test") [This one doesn't match]
>
Could it be that you want to see all occurrences of C++ strings? In
that case, you need to distinguish between the two cases:
> // public void Foo("test")
and
> public void Foo("test") // this is my test function
A tricky case is when a string contains "//"; then you do not want to
treat the sequence as a comment starter.
This is a sort of solution, but doesn't handle the tricky case:
#! /usr/bin/perl -w
use strict;
use diagnostics;
while (<>) {
s!//.*!!;
print if (/".*"/);
}
It first removes anything after "//", then prints the line if it contains
at least two double quotes.
This also doesn't handle the case if a string is started on one line
and ended on the next. Depending on what you use this for, you may prefer
the program to err in one direction or the other (displaying too few
or too many).
------------------------------
Date: 29 Oct 2004 10:15:56 +0200
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: modifying hash key (dispatch table)
Message-Id: <yzd654u2b43.fsf@invalid.net>
Tad McClellan <tadmc@augustmail.com> writes:
> Jeff Thies <jeff@spamalanadingong.com> wrote:
> >>>my $sub_ref=$DISPATCH{modify_hash_key};
> >>>&$sub_ref($hashref);
>
> BTW: I would much prefer:
>
> $sub_ref->($hashref);
>
> for code dereferencing or, even "better":
>
> $DISPATCH{modify_hash_key}->($hashref); # look Ma! No temp variable!
Why are the versions with "->" preferable? Is it purely a matter of style?
------------------------------
Date: Fri, 29 Oct 2004 00:13:22 -0400
From: James Willmore <jwillmore@adelphia.net>
Subject: Re: OT: perl errors
Message-Id: <r46dnZdeIIXUXhzcRVn-hw@adelphia.com>
Jeff Thies wrote:
> I'm used to doing something like this when I'm debugging scripts:
>
> #!/usr/bin/perl -w
>
> use CGI::Carp 'fatalsToBrowser';
>
> my $a
>
> use NO_MODULE_FOUND;
>
> I would get explicit error messages about the missing semicolon and that
> perl couldn't find the module in @INC.
>
> The web server (perl 5.8, Enterprise Redhat,Apache/2.0.46) I'm running
> now does not throw those nice explicit errors. What I get now is just a
> plain 500 server error.
>
> This will drive me crazy. Is this an OS issue, an Apache issue or perl
> issue that my nice error messages have flown away?
>
> A fix?
>
> Jeff
Try ...
=begin
#!/usr/bin/perl -Tw
#if you use a script through the CGI
#ALWAYS!!! ENABLE TAINT CHECKING!!!
use CGI qw/:all/;
#you forgot the 'qw' in the original script
use CGI::Carp qw/fatalsToBrowser/;
print header();
#-or-
#print "Content-type: text/html\n\n";
my $a
use NO_MODULE_FOUND;
=cut
If the script is that "challenged", then using CGI::Carp won't help
- you'll still get a 500 error ... because the server really doesn't
know what to do. If you incorrectly "use" the CGI::Carp module,
then you get a 500 error (like you saw in the script you posted :-) ).
HTH
Jim
------------------------------
Date: Fri, 29 Oct 2004 06:34:47 GMT
From: Jeff Thies <jeff@spamalanadingong.com>
Subject: Re: OT: perl errors
Message-Id: <bwlgd.13121$ta5.6993@newsread3.news.atl.earthlink.net>
Gunnar Hjalmarsson wrote:
> Jeff Thies wrote:
>
>> I'm used to doing something like this when I'm debugging scripts:
>>
>> #!/usr/bin/perl -w
>>
>> use CGI::Carp 'fatalsToBrowser';
>>
<snip>
>>
>> The web server (perl 5.8, Enterprise Redhat,Apache/2.0.46) I'm running
>> now does not throw those nice explicit errors. What I get now is just
>> a plain 500 server error.
>>
>> This will drive me crazy. Is this an OS issue, an Apache issue or perl
>> issue that my nice error messages have flown away?
>>
>> A fix?
>
>
> Use some other version of CGI::Carp?
>
You're a genius!
A google search brought up this:
<URL: http://forums.devshed.com/archive/t-62391 >
Where there appears to be a bug in 1.24 which is what I have.
Thanks!
Jeff
------------------------------
Date: Fri, 29 Oct 2004 09:34:22 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: OT: perl errors
Message-Id: <2ueaucF2adlltU1@uni-berlin.de>
Jeff Thies wrote:
> Gunnar Hjalmarsson wrote:
>> Use some other version of CGI::Carp?
>
> You're a genius!
Nah, I've just experienced that the CGI distribution is a little shaky.
> A google search brought up this:
>
> <URL: http://forums.devshed.com/archive/t-62391 >
>
> Where there appears to be a bug in 1.24 which is what I have.
>
> Thanks!
Glad to be able to help.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 29 Oct 2004 04:05:42 -0400
From: Paul Lalli <mritty@gmail.com>
Subject: Re: OT: perl errors
Message-Id: <clstl8$4nn$1@misc-cct.server.rpi.edu>
Laura wrote:
> Paul Lalli wrote:
>>Laura wrote:
>>>Jeff Thies wrote:
>>>
>>>
>>>> I'm used to doing something like this when I'm debugging scripts:
>>>>
>>>>#!/usr/bin/perl -w
>>>>
>>>>use CGI::Carp 'fatalsToBrowser';
>>>>
>>>>my $a
>>>>
>>>>use NO_MODULE_FOUND;
>>>>
>>>>I would get explicit error messages about the missing semicolon and that
>>>>perl couldn't find the module in @INC.
>>>>
>>>>The web server (perl 5.8, Enterprise Redhat,Apache/2.0.46) I'm running
>>>>now does not throw those nice explicit errors. What I get now is just a
>>>>plain 500 server error.
>>>
>>>
>>>That means that the problem is probably in your HTML and not your Perl
>>>script.
>>
>>Uhm. Huh? What HTML? The above program didn't generate any HTML at
>>all. Obviously there is 'a problem' with the Perl script - that's the
>>whole point. However, 'the problem' - that is, that the browser is not
>>showing the compilation errors - has nothing to do with the Perl script,
>>and certainly nothing to do with any non-existent HTML. It has to do
>>with either his server configuration and/or the permissions set on the
>>file or directory.
>>
>>
>>
>>>You could look at the server log or try this: Push your cgi
>>>function statements into an array and then print them out all together.
>>>This way you can also include a statement to save them to a file and look
>>>at the bad html that led to the 500 error.
>>
>>"Bad HTML" does not lead to a 500 error. This is nonsensical. A 500
>>is, by definition "An Internal Server Error". There is no HTML
>>involved. Indeed, if the program manages to correctly output HTML,
>>chances are the server did not encounter errors executing the program.
>>"Bad HTML" will simply cause the browser to not render the webpage
>>correctly.
>>
>>All of this is irrelevant, of course, because again, the program listed
>>above did not create any HTML.
>>
>>The only correct solution to this problem is to view the errors stored
>>in the OP's server log.
>>
>
> Oh, I assumed that maybe he cut out some CGI.pm generated HTML. I may be
> wrong, but I think that if the header is not formed properly, you can get
> the 500 internal server error. For example, if you forget:
>
> print header();
>
> and then you print anything at all in a cgi program, the server may have a
> problem with the header being absent or wrong. I am only proposing this as
> a possibility because I had the same exact problem when I tried to do my
> header by hand and when I went with header(), the 500 error went away.
Failing to print an HTTP header is indeed a possible cause of a HTTP 500
error. However, 1) CGI::Carp prints its own header when fatalsToBrowser
is invoked, to avoid such a scenario; 2) the HTTP header is not HTML;
3) The OP said he was getting this error with just the smalle example
he posted above.
Paul Lalli
------------------------------
Date: Fri, 29 Oct 2004 06:29:48 +0200
From: "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de>
Subject: Re: PERL 64bit Question
Message-Id: <slrnco3hps.r8.tassilo.von.parseval@localhost.localdomain>
Also sprach Sparky:
> I've compiled PERL 5.8.2 on AIX 5.1 64bit, I think. Can someone tell
> me for sure from this output. The questions I have are, how is it
> possible, if this is in fact compiled as 64bit, that I can execute it
> on a 32bit AIX 5.1 system? Other programs I've used would fail with
> an error. How does one tell exactly that is compiled for 64bit from
> this output.
You have to look at two configure variables: use64bitint and
use64bitall. From the INSTALL file:
=head3 64 bit support.
If your platform does not have run natively at 64 bits, but can
simulate them with compiler flags and/or C<long long> or C<int64_t>,
you can build a perl that uses 64 bits.
There are actually two modes of 64-bitness: the first one is achieved
using Configure -Duse64bitint and the second one using Configure
-Duse64bitall. The difference is that the first one is minimal and
the second one maximal. The first works in more places than the second.
The C<use64bitint> option does only as much as is required to get
64-bit integers into Perl (this may mean, for example, using "long
longs") while your memory may still be limited to 2 gigabytes (because
your pointers could still be 32-bit). Note that the name C<64bitint>
does not imply that your C compiler will be using 64-bit C<int>s (it
might, but it doesn't have to). The C<use64bitint> simply means that
you will be able to have 64 bit-wide scalar values.
The C<use64bitall> option goes all the way by attempting to switch
integers (if it can), longs (and pointers) to being 64-bit. This may
create an even more binary incompatible Perl than -Duse64bitint: the
resulting executable may not run at all in a 32-bit box, or you may
have to reboot/reconfigure/rebuild your operating system to be 64-bit
aware.
> ./perl -Ilib -V
>
> Summary of my perl5 (revision 5.0 version 8 subversion 2)
> configuration:
> Platform:
> osname=aix, osvers=5.1.0.0, archname=aix-64int-ld
> uname='aix s11f30n01 1 5 0029449a4c00 '
> config_args='-Duse64bitint -Duselongdouble
> -Aprepend:libswanted=C128 '
> hint=recommended, useposix=true, d_sigaction=define
> usethreads=undef use5005threads=undef useithreads=undef
> usemultiplicity=undef
> useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
> use64bitint=define use64bitall=undef uselongdouble=define
And here it becomes evident that you are using the 'minimal' 64bit
version.
> usemymalloc=n, bincompat5005=undef
> Compiler:
> cc='cc -qnolm', ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE
> -D_POSIX_SOURCE -qmaxmem=16384 -qnoansialias -qlongdouble
> -DUSE_NATIVE_DLOPEN -q32 -D_LARGE_FILES -qlonglong',
> optimize='-O',
> cppflags=''
> ccversion='6.0.0.0', gccversion='', gccosandvers=''
> intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=87654321
This line tells that you are on a 32bit machine. 'use64bitint' will work
fine here, whereas 'use64bitall' most likely wont.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
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 7337
***************************************