[22237] in Perl-Users-Digest
Perl-Users Digest, Issue: 4458 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 23 21:06:33 2003
Date: Thu, 23 Jan 2003 18:05:07 -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, 23 Jan 2003 Volume: 10 Number: 4458
Today's topics:
Re: Checking IP Ranges in one line <bongie@gmx.net>
Re: Converting a string to a valid date.. <krahnj@acm.org>
Re: Converting a string to a valid date.. <glex_nospam@qwest.net>
Re: Dynamically Declaring Variables (Jay Tilton)
Re: Is there a better way to check to see if a date li <krahnj@acm.org>
Re: Is there a better way to check to see if a date li <jurgenex@hotmail.com>
Re: Is there a better way to format numbers to use comm <dragnet@internalysis.com>
Re: Is there a better way to format numbers to use comm (Tad McClellan)
Re: Need a Perl Programmer <dha@panix2.panix.com>
Re: parse scalar into array <REMOVEsdnCAPS@comcast.net>
Perl 5.8 and Swig incompatible? <andreas.schmidt.2002@gmx.de>
Re: Perl Batch Job without DOS window popup <jurgenex@hotmail.com>
Re: Perl Batch Job without start of a DOS box <jurgenex@hotmail.com>
STDERR Redirection within script <sawyerj@uci.edu>
Re: STDERR Redirection within script (Sam Holden)
To create a static html page with perl script from the (Jim Carter)
Re: To extract a specific portion of a text file (John Smith)
Re: unlink() (Tad McClellan)
What does this header mean? <bbsouth@bellsouth.net>
Re: What does this header mean? (Walter Roberson)
Re: What does this header mean? <bbsouth@bellsouth.net>
Re: What does this header mean? (Jay Tilton)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 24 Jan 2003 01:21:49 +0100
From: "Harald H.-J. Bongartz" <bongie@gmx.net>
Subject: Re: Checking IP Ranges in one line
Message-Id: <1197399.ACQyWIK1a2@nyoga.dubu.de>
Janek Schleicher wrote:
> What's about
> /^64.(15[2-9]).(.*)/
/^64\.(15[2-9])\.(.*)/
But this kind of pattern will also become quite complex for arbitrary IP
ranges.
Ciao,
Harald
--
Harald H.-J. Bongartz <bongie@gmx.net>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
"We have a firm commitment to NATO, we are a part of NATO. We have a
firm commitment to Europe. We are a part of Europe."
-- George W. Bush Jr.
------------------------------
Date: Fri, 24 Jan 2003 00:10:22 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Converting a string to a valid date..
Message-Id: <3E308416.B8BDCBC1@acm.org>
Bullet wrote:
>
> This isnt exactly a perfect test .. but.. I ran this on a linux box which
> doesnt have any other users - so I know the load is pretty much steady on
> the box.. and its negligble. . Uptime shows - 3:24pm up 4 days, 9:47,
> 1 user, load average: 0.00, 0.00, 0.00 So I am pretty sure the results
> can be trusted.. but I got some surprising results. . my original code -
> is longer.. but heres what I found..
>
> Testing d_convert:
> Started-1043352458
> Finished-1043352464
> Testing d_convert2:
> Started-1043352464
> Finished-1043352476
>
> As you can see.. in 100,000 iterations.. my version took about 6 seconds ..
> while the other version (where the code is actually shorter) took 12
> seconds.. or approx twice as long..
Interesting. Lets see what Perl's Benchmark module has to say on the subject.
sub d_convert{
%shortmonths =
("Jan"=>'01',"Feb"=>'02',"Mar"=>'03',"Apr"=>'04',"May"=>'05',"Jun"=>'06',
"Jul"=>'07',"Aug"=>'08',"Sep"=>'09',"Oct"=>'10',"Nov"=>'11',"Dec"=>'12');
$conv_date = $_[0];
$conv_date =~ s/,//;
@de = split(/\s/,$conv_date);
if (length($de[2]) == 1) {
$de[2] = '0'.$de[2];
}
return "$de[3]:$shortmonths{$de[1]}:$de[2] $de[0]"
}
#$date_in = "17:42:50 Jan 30, 2003 PST";
#print &d_convert($date_in);
my %shortmonths =
qw( Jan 1 Feb 2 Mar 3 Apr 4 May 5 Jun 6
Jul 7 Aug 8 Sep 9 Oct 10 Nov 11 Dec 12 );
sub d_convert1 {
my @de = split /,?\s+/, $_[ 0 ];
return sprintf '%04d-%02d-%02d %s', $de[3], $shortmonths{$de[1]}, @de[2,0];
}
use Benchmark 'cmpthese';
cmpthese( 200_000, {
original => sub { my $date = d_convert( "17:42:50 Jan 30, 2003 PST" ) },
modified => sub { my $date = d_convert1( "17:42:50 Jan 30, 2003 PST" ) },
} );
__END__
And the results are:
Benchmark: timing 200000 iterations of modified, original...
modified: 49 wallclock secs (49.86 usr + -0.05 sys = 49.81 CPU) @ 4015.26/s (n=200000)
original: 57 wallclock secs (57.80 usr + 0.00 sys = 57.80 CPU) @ 3460.21/s (n=200000)
Rate original modified
original 3460/s -- -14%
modified 4015/s 16% --
John
--
use Perl;
program
fulfillment
------------------------------
Date: Thu, 23 Jan 2003 18:49:33 -0600
From: Jeff D Gleixner <glex_nospam@qwest.net>
Subject: Re: Converting a string to a valid date..
Message-Id: <030Y9.1029$H14.72563@news.uswest.net>
Not really a fair benchmark on the algorithm, since the speed-up is due to
%shortmonths being a global in one and always re-created in the original.
Making it a global in the original code does show the original to be faster and
making each shortmonths hash (along with the other variables! be sure to use
"my" in your subroutines/methods) a lexical within each subroutine is, of
course, slower but also shows the original to be faster.
In the long run, unless you're processing hundreds of thousands of these, it's
not going to matter.
See ya
------------------------------
Date: Thu, 23 Jan 2003 23:17:34 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Dynamically Declaring Variables
Message-Id: <3e307118.60246840@news.erols.com>
dave@fraleigh.net (Dave Fraleigh) wrote:
: I'm trying to write a statement that will take values read from a
: config file and declare variables based on these values...
The string eval thing feels like an attempt to wriggle around actually
using evil symbolic references, but it's just adding problems to a
fundamentally bad idea.
Know why you _need_ to wreck the symbol table before proceeding.
: $theHashSymbol = "\%";
: $theReferenceSymbol = "\$";
: $theName = "subjects";
: $theReference = "\\\{key\\\$subject\\\}";
: $theFileName = "subjects.csv";
: $theElements = "surname,given,initial"
^
Missing semicolon. ^
: $theCreateReferenceLine = $theReferenceSymbol . $theName . "TestRef =
: "\"" . $theReference . "\";";
^
^ typo
In future, post code that can actually compile.
[snip rest of code]
: I'm trying to force my script to generate a variable called
: "%subjectsTestHash" which contains the hash value tossed by a function
: "theFunction()".
:
: I can't use the variable that I've "created" by evaluating the
: dynamically-created statement.
The program never checks that any string eval succeeded.
Check $@ after each one.
After correcting the mistakes and adding the following lines
sub theFunction { foo => 1, bar => 2, baz => 3, } # dummy function
use Data::Dumper;print Dumper( \%subjectsTestHash );
the program spews the expected contents of %subjectsTestHash .
Whatever the trouble, it's somewhere we haven't been shown.
Look first at the mysteriously absent theFunction() sub.
But that's going through a gosh darn lot of work just to end up in a
position where the variables created can only be accessed through
symrefs or more string evals. What is unacceptable about using a
proper data structure?
#!perl
use warnings;
use strict;
my %private_namespace;
my $theName = 'subjects';
my $theReference = '{key$subject}';
my $theFileName = 'subjects.csv';
$private_namespace{$theName} = {
TestRef => $theReference,
TestFile => $theFileName,
TestHash => {
theFunction($theFileName, "keylookup")
}
};
sub theFunction {
# whatever really belongs in this sub
}
__END__
------------------------------
Date: Thu, 23 Jan 2003 23:43:49 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Is there a better way to check to see if a date lies within a certain range of dates
Message-Id: <3E307DDC.C349C3BA@acm.org>
Mothra wrote:
>
> I currently use the code snippet below to figure out if a date lies between
> a certain range. What it does is convert the date to epoch and does
> the compare. My questions is:
> Is there a way to do this without converting to epoch?
Yes, there is.
> Does someone have a better way to do this?
I don't know if it's better but: :-)
use strict;
use warnings;
my $start_date = '20010104'; # jan 04 2001
my $end_date = '20010321'; # mar 21 2001
while ( <DATA> ) {
my $test_date = join '', ( /\d+/g )[ 2, 0, 1 ];
if ( $test_date >= $start_date and $test_date <= $end_date ) {
chomp;
print "$_ is between!\n"
}
}
__DATA__
04/09/2002
05/10/2001
02/25/2001
02/01/2001
01/02/2001
John
--
use Perl;
program
fulfillment
------------------------------
Date: Thu, 23 Jan 2003 23:10:15 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Is there a better way to check to see if a date lies within a certain range of dates
Message-Id: <rD_X9.1006$IN1.979@nwrddc02.gnilink.net>
Mothra wrote:
> I currently use the code snippet below to figure out if a date lies
> between a certain range. What it does is convert the date to epoch
> and does the compare. My questions is:
> Is there a way to do this without converting to epoch? Does
> someone have a better way to do this?
Of course there is.
> my $start_date = 'jan 04 2001';
> my $end_date ='mar 21 2001';
Use a more sensible date format like ISO: "2001-03-21".
Then your problem is reduced to a trivial textual (aka lexicographic)
comparison.
if ($thisdate gt $start_date and $thisdate lt $end_date) {
#thisdate is between startdate and enddate
}
jue
------------------------------
Date: Thu, 23 Jan 2003 23:54:42 GMT
From: Marc Bissonnette <dragnet@internalysis.com>
Subject: Re: Is there a better way to format numbers to use commas?
Message-Id: <Xns930CC100D494Adragnetinternalysisc@206.172.150.13>
"Harald H.-J. Bongartz" <bongie@gmx.net> wrote in
news:3357203.W3vcA9nGfl@nyoga.dubu.de:
> Marc Bissonnette wrote:
>> "Harald H.-J. Bongartz" <bongie@gmx.net> wrote in
>> news:2445168.9nIL9k8Hjm@nyoga.dubu.de:
>>> See perldoc -q 'with commas':
>>> How can I output my numbers with commas added?
>>
>> Wow, thanks - That's one of those (for me, anyways) "black box" type
>> of solutions where I get a brain-ache trying to comprehend what the
>> command is doing (for those who don't look it up in perldoc, my big
>> massive hunk of code can be replaced with:
>>
>> $number=1234567891011;
>> $number=~s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/$1,/g;
>> print "$number\n";
>
> Maybe easier to understand, but more code, this should also work:
>
> my $num = 1234567891011;
> (my $numformatted = reverse $num) =~ s/(\d{3})(?=\d)/$1,/g;
> my $numformatted = reverse $numformatted;
>
> This reverses the number, then replaces every sequence of three numbers
> (if followed by another number) by this sequence and a comma. Then the
> result is reversed again.
>
> (If you want to print the number directly, please keep in mind, that
> "print reverse $tmp" won't work, but "print scalar reverse $tmp" will.)
Many thanks to you, Michael and Uri for helping me understand this.
I'm just moving into learning / using more of the 'symbolic' (probably
bad term) use of perl, instead of the much longer-form that I tend to
use, as evidenced in my example. This was definitely a good start, but I
think that in order to truly grasp it better (i.e. using more symbols
than perl-words in my code), I'm going to need to start smaller and
simpler than this :)
--
Marc Bissonnette
Perl CGI. MySQL Databases. Dynamic Web Content Control.
http://www.internalysis.com
Looking for a new ISP? http://www.canadianisp.com
------------------------------
Date: Thu, 23 Jan 2003 17:56:04 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Is there a better way to format numbers to use commas?
Message-Id: <slrnb3108k.c0f.tadmc@magna.augustmail.com>
Harald H.-J. Bongartz <bongie@gmx.net> wrote:
> Marc Bissonnette wrote:
>> "Harald H.-J. Bongartz" <bongie@gmx.net> wrote in
>> news:2445168.9nIL9k8Hjm@nyoga.dubu.de:
>>> See perldoc -q 'with commas':
>>> How can I output my numbers with commas added?
>> $number=1234567891011;
>> $number=~s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/$1,/g;
>> print "$number\n";
>
> Maybe easier to understand, but more code, this should also work:
>
> my $num = 1234567891011;
> (my $numformatted = reverse $num) =~ s/(\d{3})(?=\d)/$1,/g;
> my $numformatted = reverse $numformatted;
Maybe easier to understand, _and_ less code (but likely more cycles),
this should also work (from the 5.6.1 version of perlfaq5, modified
to be bound to $num, the double-reverse method was in there too):
1 while $num =~ s/^([-+]?\d+)(\d{3})/$1,$2/;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 23 Jan 2003 23:14:36 +0000 (UTC)
From: "David H. Adler" <dha@panix2.panix.com>
Subject: Re: Need a Perl Programmer
Message-Id: <slrnb30tqs.1mt.dha@panix2.panix.com>
In article <x7adhrpq0h.fsf@mail.sysarch.com>, Uri Guttman wrote:
>>>>>> "GB" == Grayson Bathgate <gbathgate2000@yahoo.com> writes:
>
> GB> Can anyone assist me in a small perl project? Please email me your
> GB> resume if you want a contract job.
>
> GB> We have Perl 5.003 soon to be upgraded to 5.6.
>
> post it on the perl jobs list: http://jobs.perl.org
>
> (waiting for the adlerbot).
Jeez, can't you guys do *anything* without me? :-)
You have posted a job posting or a resume in a technical group.
Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.
Had you read and understood the Usenet user manual posted frequently to
"news.announce.newusers", you might have already known this. :) (If
n.a.n is quieter than it should be, the relevent FAQs are available at
http://www.faqs.org/faqs/by-newsgroup/news/news.announce.newusers.html)
Another good source of information on how Usenet functions is
news.newusers.questions (information from which is also available at
http://www.geocities.com/nnqweb/).
Please do not explain your posting by saying "but I saw other job
postings here". Just because one person jumps off a bridge, doesn't
mean everyone does. Those postings are also in error, and I've
probably already notified them as well.
If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.
http://jobs.perl.org may be of more use to you
Yours for a better usenet,
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"I may have been away with the Grapefruit-Powered Electric Zebras by
the time I wrote this post." - Richard Jones in
<359b9f7b.112710@news.demon.co.uk>
------------------------------
Date: Thu, 23 Jan 2003 20:04:00 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: parse scalar into array
Message-Id: <Xns930CD6A123CDDsdn.comcast@216.166.71.239>
monkeys paw <fm_duendeBASURA@yahoo.com> wrote in news:mnWX9.10715$rM2.9761
@rwcrnsc53:
> How can i take a string and put each char into an
> array. For instance, i have $i = 134675. I simply
> need to add each digit together like so:
[...]
> @each_digit = parsing_func($i);
>
> where @each_digit would result in:
>
> qw(1 3 4 6 7 5)
use Lingua::EN::Inflect qw(NUMWORDS);
$i = 134675;
@each_digit = NUMWORDS($i, group => 1);
;-)
--
Eric
print scalar reverse sort qw p ekca lre reh
ts uJ p, $/.r, map $_.$", qw e p h tona e;
------------------------------
Date: Thu, 23 Jan 2003 17:08:23 -0800
From: Andreas Schmidt <andreas.schmidt.2002@gmx.de>
Subject: Perl 5.8 and Swig incompatible?
Message-Id: <20030123170823.540f71cc.andreas.schmidt.2002@gmx.de>
Hi,
I have perl, v5.8.0 built for i386-linux-thread-multi and SWIG-1.3.17.
When compiling the examples that come with the installation, I get
compiler errors, each time:
In file included from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/perl.h:3368,
from example_wrap.c:228:
/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/proto.h:246: parse error before "off64_t"
/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/proto.h:248: parse error before "Perl_do_sysseek"
/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/proto.h:248: parse error before "off64_t"
/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/proto.h:248: warning: data definition has no type or storage class
/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/proto.h:249: parse error before "Perl_do_tell"
/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/proto.h:249: warning: data definition has no type or storage class
/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/proto.h:1378: parse error before "Perl_PerlIO_tell"
/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/proto.h:1378: warning: data definition has no type or storage class
/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/proto.h:1379: parse error before "off64_t"
It is always this error, for all examples. With perl, v5.6.1, everything works fine.
Are you also getting these errors? Can Perl 5.8 and SWIG generally run together?
Thanks! Andi
------------------------------
Date: Thu, 23 Jan 2003 23:16:00 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Perl Batch Job without DOS window popup
Message-Id: <QI_X9.644$A17.499@nwrddc01.gnilink.net>
Dominik wrote:
> Is it possible to run a batch job in XP without having the DOS windows
> always poped up when the perl job runs?
>
> I think it must be possible to run the job as a background job and
> have the DOS window suppressed during the run.
Is there anything wrong with the answer given in the thread
"Attempting to run a simple Win Perl script without the use of a window"
just 4 hours earlier?
> Can anyone help on this?
google is your friend
jue
------------------------------
Date: Thu, 23 Jan 2003 23:18:28 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Perl Batch Job without start of a DOS box
Message-Id: <8L_X9.653$A17.218@nwrddc01.gnilink.net>
Dominik wrote:
> Ist it possible to run a perl script on XP as an batch job without the
> popup of a DOS window?
And a second post about the same subject just 80 minutes later.
A subject that was answered just a few hours earlier already to begin with.
Are you trying to swamp this NG?
jue
------------------------------
Date: Thu, 23 Jan 2003 17:15:27 -0800
From: "Jeffrey Sawyer" <sawyerj@uci.edu>
Subject: STDERR Redirection within script
Message-Id: <b0q44q$534$1@news.service.uci.edu>
I am trying to redirect the verbose output of a sendmail command to STDERR,
but the output is not appering in the STDERR file. Here is my code
# open debug file is needed
$debug_filename = "/usr/tmp/debug";
open (STDERR,">$debug_filename");
.....
.....
.....
open(SENDMAIL, "|/usr/lib/sendmail -v $params{'TO'} > STDERR")
or die "Could not fork sendmail: $!\n";
while(<EMAIL>) {
print SENDMAIL $_;
}
close(SENDMAIL) or die "Sendmail did not close nicely";
Does anyone have any ideas?
Note: This command does work.
print STDERR "Start debug\n" unless (!$debug);
------------------------------
Date: 24 Jan 2003 01:39:37 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: STDERR Redirection within script
Message-Id: <slrnb316ap.muf.sholden@flexal.cs.usyd.edu.au>
On Thu, 23 Jan 2003 17:15:27 -0800, Jeffrey Sawyer <sawyerj@uci.edu> wrote:
> I am trying to redirect the verbose output of a sendmail command to STDERR,
> but the output is not appering in the STDERR file. Here is my code
>
> # open debug file is needed
> $debug_filename = "/usr/tmp/debug";
>
> open (STDERR,">$debug_filename");
Checking if the open succeeds seems an obvious thing to do if output is
not ending up in the opened file... You test the open below, so I won't
bother showing how :)
Turning on warnings (and strict) would be good too (you may already)...
> open(SENDMAIL, "|/usr/lib/sendmail -v $params{'TO'} > STDERR")
That STDERR is not the STDERR filehandle, that's redirecting output to
a file named 'STDERR', that may be what you want, but if so it's
deserving of a comment confirming that...
--
Sam Holden
------------------------------
Date: 23 Jan 2003 16:36:50 -0800
From: carterave@yahoo.com (Jim Carter)
Subject: To create a static html page with perl script from the command line...
Message-Id: <9c2a26b6.0301231636.570f0ac7@posting.google.com>
Hi guys,
Right now, I have a script, "test.pl" in C:\InetPub\Scripts (IIS
location on Windows 2000). What it does is, when I type
"http://localhost/Scripts/test.pl" in the URL box of IE browser, it
gives me an output of results in html format.
The contents of the script, test.pl are as below:
----------------------------------------------------------
#! C:/perl/bin/perl
use CGI ':standard';
use CGI::Carp 'fatalsToBrowser';
print "Content-type:text/html\n\n";
print "<TABLE BORDER=5><TR> <TH align=left>
<FONT color=red>Names</FONT></TH><TH
align=left><FONT color=red>Corresponding Files </FONT></TH>
</TR>";
open (INPUT, "C:\\Temp\\names.txt") || die " Can not open the file:
$!";
@array = <INPUT>;
foreach (@array)
{
($key, $files);
($key,$files) = split (/\t/);
print "<TR><TD><FONT color=green>$key</FONT></TD><TD><FONT
color=blue size = 2>$files</FONT></TD></TR>";
}
print "</TABLE>";
------------------------------------------------------
Now, every time I want to see the results in the html page, I need to
type the above URL address.
What I want is the following:
When I execute "test.pl" from my command line prompt, it should give
me the same output in an html page. I mean, when I run the "test.pl"
command form the CMD, the html page should pop up with the same output
that I am getting now with the URL address.
How can I go about to achieve this little task?
Thanks in advance,
Jimmy
------------------------------
Date: 23 Jan 2003 15:35:42 -0800
From: clearguy02@yahoo.com (John Smith)
Subject: Re: To extract a specific portion of a text file
Message-Id: <500f84f3.0301231535.16de3ac5@posting.google.com>
Thanks Tad!
I sincerely thank you for all your answers. Your first script is not
valid for my current situation.
I tried your second script (that you have posted in your last message
today). When I include spaces just in front of the second or third or
other vlaues in the first "Test Key" field, then your script gives
only first line (i.e Requirement Key : test_hello_there) and it
ignores the rest of the values in the first "Test Key" field.
I want all the values in the first Test Key.
How can I modify your script so that I can see all the values in the
first "Test Key" field no matter whether we change the white space in
front of them?
Thanks in advances,
John
------------------------------
Date: Thu, 23 Jan 2003 17:58:56 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: unlink()
Message-Id: <slrnb310e0.c0f.tadmc@magna.augustmail.com>
Jay Tilton <tiltonj@erols.com> wrote:
> Try a debug print immediately before those lines, e.g.
>
> print "Getting ready to unlink. This time for sure!\n";
> # put unlink()s here
I like warn() better than print() for making debugging output
as STDERR is not buffered like STDIN is.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 23 Jan 2003 18:46:14 -0600
From: "Brett" <bbsouth@bellsouth.net>
Subject: What does this header mean?
Message-Id: <KX%X9.3144$zt5.930@news.bellsouth.net>
I'm running a CGI script that has an .exe extension on Win2k Server. The
.exe extension is linked to run Perl. I get this message when I run the
script:
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:
Can't open perl script "C:\Inetpub\domain.com\cgi-bin\Count.exe": No such
file or directory
The directory is correct and file does exist. Is this coming from the
script or Perl? What does it mean exactly?
Thanks
Brett
------------------------------
Date: 24 Jan 2003 01:00:59 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: What does this header mean?
Message-Id: <b0q38b$rut$1@canopus.cc.umanitoba.ca>
In article <KX%X9.3144$zt5.930@news.bellsouth.net>,
Brett <bbsouth@bellsouth.net> wrote:
:I'm running a CGI script that has an .exe extension on Win2k Server. The
:.exe extension is linked to run Perl. I get this message when I run the
:script:
:CGI Error
:The specified CGI application misbehaved by not returning a complete set of
:HTTP headers. The headers it did return are:
:Can't open perl script "C:\Inetpub\domain.com\cgi-bin\Count.exe": No such
:file or directory
:The directory is correct and file does exist. Is this coming from the
:script or Perl? What does it mean exactly?
I'm not quite sure how you are invoking perl, but one thing I would
check out is that perl is possibly expecting the file name in
Unix file-name format: c:/Inetpub/domain.com/cgi-bin/Count.exe
You should also check for special characters in the filename part of
the message just in case it's trying to invoke some strange filename
that includes a non-graphic character.
--
Warhol's Law: every Usenet user is entitled to his or her very own
fifteen minutes of flame -- The Squoire
------------------------------
Date: Thu, 23 Jan 2003 19:03:00 -0600
From: "Brett" <bbsouth@bellsouth.net>
Subject: Re: What does this header mean?
Message-Id: <nb0Y9.3182$zt5.2651@news.bellsouth.net>
I solved the problem by unlinking the exe to Perl
I do have this problem:
4. Why does the counter show "888888" all the time?
Answer: The counter is running in strict mode (look at count.cfg file). When
the counter runs in strict mode, if the browser does not return the
environment variable HTTP_REFERER, the counter will display the image 888888
instead of serving the counter. The environment variable HTTP_REFERER should
contain the web page running the counter. Some browsers do not return this
variable in <img GET method.
Technical notes: The way HTTP_REFERER environment variable gets available to
a CGI program is as follows: The browser sends a header like Referer:
http://foo.com/page.html, then according to the CGI 1.1 specification the
server can add HTTP_ followed by the header name and make it available to
CGI program as environment variable. But according to CGI spec, the server
can decide not to make these variables available to the CGI program. In this
case, the counter will show 888888. Also, if the browser decides not the
send the Referer header to the server, there will not be any environment
variable called HTTP_REFERER, and the counter will show 888888. Good news
is, netscape and MS IE both send Referer when <img src is is used to set an
inline image, and apache and all good web servers also make this variable
available to the CGI programs.
I'm running IIS 5. If IE sends the necessary header info and all good
servers also (IIS5), which else could be causing this?
Thanks,
Brett
"Brett" <bbsouth@bellsouth.net> wrote in message
news:KX%X9.3144$zt5.930@news.bellsouth.net...
> I'm running a CGI script that has an .exe extension on Win2k Server. The
> .exe extension is linked to run Perl. I get this message when I run the
> script:
>
> CGI Error
> The specified CGI application misbehaved by not returning a complete set
of
> HTTP headers. The headers it did return are:
> Can't open perl script "C:\Inetpub\domain.com\cgi-bin\Count.exe": No such
> file or directory
>
> The directory is correct and file does exist. Is this coming from the
> script or Perl? What does it mean exactly?
>
> Thanks
> Brett
>
>
>
begin 666 blues.gif
M1TE&.#EA$0`*`)$``/___P``_P```````"'Y! $```(`+ `````1``H```(7
9C(^B*^C!UDNQ35/MS1?7#GT=-XI;50``.P``
`
end
------------------------------
Date: Fri, 24 Jan 2003 01:55:59 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: What does this header mean?
Message-Id: <3e309b71.71089998@news.erols.com>
"Brett" <bbsouth@bellsouth.net> wrote:
: I solved the problem by unlinking the exe to Perl
:
: I do have this problem:
:
: 4. Why does the counter show "888888" all the time?
[explanation of mysterious counter program nobody has seen and CGI
specs elided]
Your question is about the server and its CGI implementation.
Perl's involvement is only incidental to the problem.
Readers of comp.infosystems.www.authoring.cgi or
comp.infosystems.www.servers.ms-windows are more capable of answering
your questions.
Try posting to one of those groups.
------------------------------
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.
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 4458
***************************************