[16057] in Perl-Users-Digest
Perl-Users Digest, Issue: 3469 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 24 00:05:37 2000
Date: Fri, 23 Jun 2000 21:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <961819511-v9-i3469@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 23 Jun 2000 Volume: 9 Number: 3469
Today's topics:
Re: Anyone use ActivePerl on Win95 or Win98 <nnickee@nnickee.com>
Archive::Tar and memory limits jgrinwal@my-deja.com
Bogus newsgroup comp.lang.perl (was: Re: Error in POSIX <rootbeer@redcat.com>
Calling sed from a perl script <edge@gecko.org>
Re: Calling sed from a perl script <rootbeer@redcat.com>
cgi/SSI question... <alexescott@my-deja.com>
Re: cgi/SSI question... <rootbeer@redcat.com>
Re: cgi/SSI question... <rob13@rock13.com>
Re: cgi/SSI question... <richh@panola.com>
Re: chomp on Array? <aqumsieh@hyperchip.com>
Re: chomp on Array? (Tad McClellan)
Code Review <crdevilb@mtu.edu>
Re: Consistently getting "(in cleanup) Can't call metho <johnlin@chttl.com.tw>
deleting mutiple files? <pdmos23@geocities.com>
Re: deleting mutiple files? <memmett@fraser.sfu.ca>
Re: Help - Brain Teaser (Greg Bacon)
Re: install Apache::Cookie for Win32? was: mod_perl set <randy@theory.uwinnipeg.ca>
IO::Socket::INET forking server problem nawkboy@my-deja.com
move from Unix to NT - - MSQL to Perl scripts broken cheena88@my-deja.com
OpenFile then Chomp <TheEx0rcist@fanclub.org>
Re: OpenFile then Chomp (Greg Bacon)
Re: OpenFile then Chomp <richh@panola.com>
oracle DB connection <hanbit@tng.co.kr>
oracle DB connection <hanbit@tng.co.kr>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 23 Jun 2000 17:15:53 -0500
From: Nnickee <nnickee@nnickee.com>
Subject: Re: Anyone use ActivePerl on Win95 or Win98
Message-Id: <93355BEE3A14AF4E.B52AF0F71695CA46.C60AFEDCDEECD0C2@lp.airnews.net>
On Fri, 23 Jun 2000 16:30:02 GMT, someone claiming to be Joel
<jllawhead@sunherald.com> said:
>Ferk Da Jerk wrote:
>> I downloaded ActivePerl. All the stuff was installed in the folder
>> C:\Perl\. When you work on a Unix system the heading would be
>> #!/usr/local/bin/perl but not on Windows. What am I supposed to replace it
>> with?
>You can use either c:\perl\bin or c:\perl\bin\perl
or simply #!perl (why type out the full path when you don't need to?)
------------------------------
Date: Fri, 23 Jun 2000 22:10:59 GMT
From: jgrinwal@my-deja.com
Subject: Archive::Tar and memory limits
Message-Id: <8j0n97$n68$1@nnrp1.deja.com>
I have a file archival script under ActiveState Perl that is maxing out
the memory resources of my server. My script has a list of about 500
2MB files which it needs to put into one or more compressed tar files.
I am looking for a way to check memory resources after Tar->read(before
Tar->add_files)and flush the in-memory archive if memory utilization is
over 80 percent.
Pseudo code would be similar to
$ARCHIVE = "1";
foreach (@files) {
$ARC = $ARCHIVE . "tar.gz";
$T->read($ARC,1);
if (<memory resources over-used>) {
$T = Tar->new();
$ARCHIVE++;
$ARC = $ARCHIVE . "tar.gz";
}
$T->add_files($_);
$T->write($ARC,1);
}
If you have a suggestion, it would make my day.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 23 Jun 2000 17:57:29 GMT
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Bogus newsgroup comp.lang.perl (was: Re: Error in POSIX.pm when
Message-Id: <PINE.GSO.4.10.10006231054470.10836-100000@USER2.TELEPORT.COM>
On Fri, 23 Jun 2000, Drew Simonis wrote about the bogus newsgroup
comp.lang.perl:
> That NG will never die. Lots of posters still in it. I know its
> on the servers I read from.
Of course, that's no excuse; it should be removed from those servers.
There's a frequent posting in news.announce.newgroups about "Bogus Usenet
Groups" which explains about this issue. Here's an older copy of this
message, showing that c.l.p hasn't existed since 1995(!); the explanation
is at the end of the message.
http://www.ou.edu/research/electron/internet/use-bogu.htm
A fairly up-to-date (and quite lengthy) list of current newsgroups may
be downloaded from one of these URLs.
ftp://ftp.uu.net/uunet-info/newsgroups.gz
ftp://ftp.uu.net/uunet-info/newsgroups.Z
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 24 Jun 2000 00:42:43 GMT
From: Edge <edge@gecko.org>
Subject: Calling sed from a perl script
Message-Id: <8j1061$tbo$1@nnrp1.deja.com>
If I run :
sed -e "s/$item/$item2/" <old file> > <new file>
from command line (replacing $item/$item2 with the "real" value) it
works great. I'm trying to include that same command in a perl script:
`sed -e "s/$item/$item2/" <old file> > <new file>`;
I get the following on execution:
"sed: -e expression #1, char 71: Unterminated `s' command"
I've tried every way I can think of on escaping that command but
obviously I missed (at least) one. Can anyone help?
BTW, $item and $item2 are colon seperated lines, $item2 replaces one
variable from $item
ex:
$item= 1:2:3:4
$item2= a:2:3:4
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 23 Jun 2000 21:03:41 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Calling sed from a perl script
Message-Id: <Pine.GSO.4.10.10006232100230.23149-100000@user2.teleport.com>
On Sat, 24 Jun 2000, Edge wrote:
> Subject: Calling sed from a perl script
There's not usually much reason to do that, but okay...
> If I run :
> sed -e "s/$item/$item2/" <old file> > <new file>
> from command line (replacing $item/$item2 with the "real" value) it
> works great. I'm trying to include that same command in a perl script:
> `sed -e "s/$item/$item2/" <old file> > <new file>`;
> I get the following on execution:
>
> "sed: -e expression #1, char 71: Unterminated `s' command"
Well, that error is coming from sed. If you want to see what you were
telling sed to do, try changing that line of code to print, maybe like
this:
print qq{Command was `sed -e "s/$item/$item2/" ....`\n};
I have a hunch you'll see the trouble right away. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 24 Jun 2000 00:24:47 GMT
From: Alex <alexescott@my-deja.com>
Subject: cgi/SSI question...
Message-Id: <8j0v43$sr4$1@nnrp1.deja.com>
Hi -
I have a normal HTML file that I'd like to run a cgi script from, but
i pass nothing to it and get nothing from it. Just every time the page
is loaded, the script executes. I thought i could just SSI it (i.e. <!--
#include "../cgi-bin/whatever.cgi"-->) but the script never executes...
how do I do this? does the include statement need to be in the head, or
body, or outside all of it?
--- this is on an IIS4 server
thx
-Alex
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 23 Jun 2000 17:59:12 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: cgi/SSI question...
Message-Id: <Pine.GSO.4.10.10006231757460.23149-100000@user2.teleport.com>
On Sat, 24 Jun 2000, Alex wrote:
> Subject: cgi/SSI question...
It looks as if you have a question about CGI programming, or something
like that. Perhaps you wish to search for the docs, FAQs, and newsgroups
about CGI programming and similar activities. Reading the newsgroup
comp.infosystems.www.authoring.cgi may help you to get started. Good luck
with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 23 Jun 2000 21:05:14 -0400
From: "Rob - Rock13.com" <rob13@rock13.com>
Subject: Re: cgi/SSI question...
Message-Id: <3954094A.5019937@rock13.com>
Alex wrote:
>
> Hi -
> I have a normal HTML file that I'd like to run a cgi script from, but
> i pass nothing to it and get nothing from it. Just every time the page
> is loaded, the script executes. I thought i could just SSI it (i.e. <!--
> #include "../cgi-bin/whatever.cgi"-->) but the script never executes...
> how do I do this? does the include statement need to be in the head, or
> body, or outside all of it?
Put the include where ever you want the results to appear.
You forgot the virtual. You'll also need SSI enabled, but I hope you
knew that.
<!--#include virtual="cgi-bin/blah.cgi" -->
--
Rob - http://rock13.com/
Web Stuff: http://rock13.com/webhelp/
------------------------------
Date: Fri, 23 Jun 2000 21:08:00 -0500
From: "Rich H" <richh@panola.com>
Subject: Re: cgi/SSI question...
Message-Id: <sl863s64e7f17@corp.supernews.com>
If <!--#include virtual="/cgi-bin/whatever.cgi" --> doesn't work, try
<!--#exec cgi="/cgi-bin/whatever.cgi" -->
You didn't say mention what the script was supposed to do. You may not be
able to call it with ssi.
Rich
Alex <alexescott@my-deja.com> wrote in message
news:8j0v43$sr4$1@nnrp1.deja.com...
> Hi -
> I have a normal HTML file that I'd like to run a cgi script from, but
> i pass nothing to it and get nothing from it. Just every time the page
> is loaded, the script executes. I thought i could just SSI it (i.e. <!--
> #include "../cgi-bin/whatever.cgi"-->) but the script never executes...
> how do I do this? does the include statement need to be in the head, or
> body, or outside all of it?
> --- this is on an IIS4 server
> thx
> -Alex
> Before you buy.
------------------------------
Date: Fri, 23 Jun 2000 17:37:32 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: chomp on Array?
Message-Id: <7AVGZ0GUXS.FSF@MERLIN.HYPERCHIP.COM>
"Markachev, Naiden [SKY:4Y21:EXCH]" <naidenm@americasm01.nt.com> writes:
> chomp works on both types scalars and lists. In case of a list though it
> removes trailing '\n' from all members of that list if present.
^^^^
^^^^
Not exactly. It removes the character defined in $/ from the end of each
line in the array. By default, $/ is "\n" (not '\n', which is two
characters). But nothing prevents you from changing $/, which affects
chomp() directly.
Of course, all of this is discussed in the docs. So the OP should have
consulted perldoc before posting.
--Ala
------------------------------
Date: Fri, 23 Jun 2000 07:59:47 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: chomp on Array?
Message-Id: <slrn8l6nq3.vh.tadmc@maxim.metronet.com>
On Fri, 23 Jun 2000 07:31:03 -0500, spurcell <skpurcell@hotmail.com> wrote:
>I thought that chomp
Why "think"?
Read the docs for chomp() and _know_!
>would take off the last newline in a string.
>chomp(my @data = <DATA>);
>
>Question: Does anyone know why this works?
Because that is what the description of chomp() says it is
supposed to do.
>And does it do each line, or does
>it just chomp the last line in the text that is read in.
What happened when you tried it?
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 24 Jun 2000 01:12:23 GMT
From: Colin DeVilbiss <crdevilb@mtu.edu>
Subject: Code Review
Message-Id: <XVT45.16499$dF.656090@news1.rdc1.il.home.com>
following my sig is a script designed to convert something akin to a CSV
file to the MobileDB Palm database format.
what I would like are some constructive (destructive? :) ) comments on
issues of (in order):
1: ``Perl''ish-ness (idioms, etc)
2: readability (clarity, refactoring, etc)
3: efficiency
also, if someone can give me an ``intelligent'' way to decide on a
method of parsing if Parse::RecDescent is not present, I would be
appreciative.
TIA.
--
Colin DeVilbiss
crdevilb@mtu.edu
#!/usr/bin/perl -w
use strict;
use Getopt::Std;
use Parse::RecDescent;
use constant MAX_FIELDS => 20;
use constant REC_HEAD => pack('C5x2', 255, 255, 255, 1, 255);
use constant REC_TAIL => pack('C', 255);
my $VERSION = 0.90;
$Parse::RecDescent::skip = '';
++$::RD_HINT;
{
local $/;
my $csv_parser = new Parse::RecDescent(<DATA>);
sub parse_csv {
chomp $_[0];
@{ $csv_parser->line(shift) };
}
}
sub usage {
print STDERR <<USAGE;
$0 v$VERSION: create a MobileDB database from a CSV (or similar) file
$0 [-n] <name> [-f] <infile> [-o] <outfile> [-v] [-h]
-h: display this help message
-v: display extra information as the file is processed (verbose)
-n: the name of the Palm database to be created (limit 32 chars)
(defaults to 'new_db')
-f: the name of the CSV file (defaults to stdin)
-o: the name of the pdb file (defaults to stdout)
USAGE
exit 1;
}
sub max {
my $max = shift;
($max < $_) && ($max = $_) for @_;
$max;
}
sub bound {
my ($min, $max, $val) = @_;
return $min if $val < $min;
return $max if $val > $max;
$val;
}
sub fieldwidth {
my $datum = shift;
defined $datum ?
bound 10, 160, 5 * length $datum :
10;
}
sub make_rec {
my ($len, $cur_field) = (shift, 0);
splice(@_, scalar @_, (@_ - $len), ('') x ($len - @_));
join '' => REC_HEAD, (map { pack('CZ*x', $cur_field++, $_) } @_), REC_TAIL;
}
my %opt;
getopts('hvn:f:o:', \%opt);
my $verbose = $opt{v};
my $name = $opt{n} || shift || 'new_db';
my $infile = $opt{f} || shift || '-';
my $outfile = $opt{o} || shift || '-';
usage if $opt{h} || @ARGV;
$verbose && print STDERR <<END;
$0 v$VERSION
name: "$name"
infile: "$infile"
outfile: "$outfile"
END
#-----------------------------------------------------------
# read in the data itself
open IN, "$infile" or die "couldn't open $infile for input: $!";
# read in the first line (field titles, limited to MAX_FIELDS)
my @fields = parse_csv scalar(<IN>);
splice @fields, MAX_FIELDS;
# read in the data itself, each record limited to the number of fields
# in the field titles
my @data = map { my @rec = parse_csv $_;
splice(@rec, scalar @fields);
[ @rec ];
} <IN>;
close IN;
# @width specifies the sensible width of each field within the database
my @width = map { my $f = $_;
max(map { sprintf '%03d', fieldwidth $_->[$f] }
(\@fields, @data)
)
} 0..$#fields;
splice @width,
scalar @width,
(@width - MAX_FIELDS),
('000') x (MAX_FIELDS - @width);
open OUT, ">$outfile" or die "couldn't open $outfile for input: $!";
binmode OUT;
#-----------------------------------------------------------
# print out the database header (see palm SDK for details)
my $apploc = 8 * (@data + 14);
my $db_hdr = pack('a32nnNNNNNNa4a4NNn' =>
$name, # name
8, # attributes
0, # version
time, # creation date
time, # modification date
time, # last backup date
0, # database number (?)
$apploc, # location of application info
0, # 'sorting info'
'Mdb1', # application type
'Mdb1', # creator ID
@data + 4, # 'unique ID seed'
0, # chunk ID of next list
@data + 4 # 'unique ID seed'
);
print OUT $db_hdr;
#-----------------------------------------------------------
# add headers for each of the data records in the database
my $cur_rec = 0;
# $fw_calc is our calculation of where the next record is going to start
my $fw_calc = tell(*OUT) + 200 + (8 * (@data + 14));
# header type 1 (field names)
my $rec_list = pack('NCxn', $fw_calc, 1, ++$cur_rec);
$fw_calc += 8 + @fields * 2 + length(join '' => @fields);
# more required headers:
# type 4: preference data (unused)
# type 5: data types (all 'str')
# type 6: field lengths (as text strings)
for ([4, 3], [5, 5], [6, 5]) {
my ($type, $size) = @$_;
$rec_list .= pack('NCxn', $fw_calc, $type, ++$cur_rec);
$fw_calc += 8 + ($size * MAX_FIELDS);
}
# headers for all of the actual data records
# type 2: actual data
for (@data) {
$rec_list .= pack('NCxn', $fw_calc, 2, ++$cur_rec);
$fw_calc += 8 + (@fields * 2) + length(join '' => @$_);
}
print OUT $rec_list;
#-----------------------------------------------------------
# 2 bytes of filler (?)
my $filler = pack('x2'); # two bytes of filler
print OUT $filler;
#-----------------------------------------------------------
# add the application info
my $app_info = pack('nA16A16A16A16A16A16A16x144c16cx3',
0, # renamed categories
"Unfiled", # category names
"FieldLabels", # 0 - 6 (first seven)
"DataRecords",
"DataRecordsFout",
"Preferences",
"DataType",
"FieldLengths",
# x144 for nine missing (blank) category names ,
0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, # category ID's
0x8, 0x9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF,
0xF); # last unique ID
# x3 is 1 reserved byte and 1 reserved word
print OUT $app_info;
#-----------------------------------------------------------
# put the actual data in (finally! :) )
# field labels
print OUT make_rec(scalar @fields, @fields);
# preferences (blah)
print OUT make_rec(MAX_FIELDS, (pack 'C', 1) x MAX_FIELDS);
# data types (all 'str')
print OUT make_rec(MAX_FIELDS, ('str') x MAX_FIELDS);
# field widths
print OUT make_rec(MAX_FIELDS, @width);
# the actual data records
for(@data) {
print OUT make_rec(scalar @fields, @$_);
}
close OUT;
__END__
line: /\s*/ term commaterm(s?) /\s*/ { $return = [ $item[2], @{$item[3]} ] }
commaterm: delim term
term: '"' quotechar(s?) '"' { $return = join '' => @{$item[2]} }
| /[^",]*[^", ]/
quotechar: '\\"' { $return = '"' }
| '\\\\' { $return = '\\' }
| /[^"]/
delim: /\s*,\s*/
------------------------------
Date: Sat, 24 Jun 2000 09:33:57 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: Consistently getting "(in cleanup) Can't call method "FETCH"...
Message-Id: <8j132o$js7@netnews.hinet.net>
"Thorbjørn Ravn Andersen" wrote
> Has anyone else seen this error message consistently?
Me!!! Can you search on my previous post on comp.lang.perl.misc:
Error at line 0 ? [Was: Exceptions that can't be caught by eval {} and local $SIG]
In that thread, I narrowed down the problem into a small testing script.
#!perl -w
use strict;
use diagnostics;
use DBI;
my $connect=DBI->connect(
'dbi:Oracle:dbserver','scott','tiger', # use a valid connection string here
{RaiseError=>0,PrintError=>0}
) or die 'connect failed';
# do nothing, this is the end of testing script
This will produce the same warning as yours.
Best regards.
John Lin
------------------------------
Date: Sat, 24 Jun 2000 01:51:05 GMT
From: Pasquale <pdmos23@geocities.com>
Subject: deleting mutiple files?
Message-Id: <39541577.3ABF0958@geocities.com>
--------------A6AC307A3042C564A1DBFF40
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
kind of a newbie at all this, but I have a script that assigns a
reference number to multiple files, i.e.: 3left.jpg, 3right.jpg,
3up.jpg, etc... I would like to delete all files at once, which is
complicated by the fact that the name following the reference number is
unknown. I've been looking through the perl docs and haven't found
much. I did try unlink("$basedir/imgs/$num*.jpg"), but it doesn't
work. Any suggestions or if this is even possible would be appreciated.
Thanks,
Pasquale
--------------A6AC307A3042C564A1DBFF40
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
kind of a newbie at all this, but I have a script that assigns a reference
number to multiple files, i.e.: 3left.jpg, 3right.jpg, 3up.jpg, etc...
I would like to delete all files at once, which is complicated by the fact
that the name following the reference number is unknown. I've been
looking through the perl docs and haven't found much. I did try
<i>unlink("$basedir/imgs/$num*.jpg")</i>, but it doesn't work. Any
suggestions or if this is even possible would be appreciated.
<br>Thanks,
<br>Pasquale</html>
--------------A6AC307A3042C564A1DBFF40--
------------------------------
Date: 23 Jun 2000 20:14:40 -0700
From: Matt Emmett <memmett@fraser.sfu.ca>
Subject: Re: deleting mutiple files?
Message-Id: <yvw9hfaj7otb.fsf@fraser.sfu.ca>
How about:
unlink <$basedir/imgs/$num*.jpg>;
See the perlfunc man page, or perldoc -f unlink.
Matt
Pasquale <pdmos23@geocities.com> writes:
> --------------A6AC307A3042C564A1DBFF40
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> kind of a newbie at all this, but I have a script that assigns a
> reference number to multiple files, i.e.: 3left.jpg, 3right.jpg,
> 3up.jpg, etc... I would like to delete all files at once, which is
> complicated by the fact that the name following the reference number is
> unknown. I've been looking through the perl docs and haven't found
> much. I did try unlink("$basedir/imgs/$num*.jpg"), but it doesn't
> work. Any suggestions or if this is even possible would be appreciated.
>
> Thanks,
> Pasquale
>
> --------------A6AC307A3042C564A1DBFF40
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>
> kind of a newbie at all this, but I have a script that assigns a reference
> number to multiple files, i.e.: 3left.jpg, 3right.jpg, 3up.jpg, etc...
> I would like to delete all files at once, which is complicated by the fact
> that the name following the reference number is unknown. I've been
> looking through the perl docs and haven't found much. I did try
> <i>unlink("$basedir/imgs/$num*.jpg")</i>, but it doesn't work. Any
> suggestions or if this is even possible would be appreciated.
> <br>Thanks,
> <br>Pasquale</html>
>
> --------------A6AC307A3042C564A1DBFF40--
------------------------------
Date: Fri, 23 Jun 2000 22:17:26 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Help - Brain Teaser
Message-Id: <sl7ofmu3e7f59@corp.supernews.com>
What's your Perl question?
Greg
--
Is a Smith & Wesson the original point and click interface?
------------------------------
Date: Fri, 23 Jun 2000 19:52:52 -0500
From: "Randy Kobes" <randy@theory.uwinnipeg.ca>
Subject: Re: install Apache::Cookie for Win32? was: mod_perl setup for w2k?
Message-Id: <8j10td$lee$1@canopus.cc.umanitoba.ca>
<Tom_Roche@ncsu.edu> wrote in
message news:3952706F.4FDA2611@ncsu.edu...
> Tom Roche 6/16/00 6:52PM
> >> I`ve also found Randy Kobes` mod_perl binaries at
> >> ftp://theoryx5.uwinnipeg.ca/pub/other/
> >> and am planning to try perl-win32-bin-0.6.exe.
[ ... ]
> However, the site that I want to port from Solaris Apache to Windows
> Apache uses Apache::Cookie, so I got
>
> > [error] Can't locate Apache/Cookie.pm in @INC
> After a bit of research, I'm wondering:
[ ... ]
> ? Is this libapreq related? If so, is there a libapreq for win32? I've
> seen the ominous
>
> [modperl] Re: failure: libapreq + win32
> Doug MacEachern (dougm@cp.net)
> Mon, 10 May 1999 14:40:20 -0700 (PDT)
>
> and am hoping someone's gotten this working in the past year (oh
> please :-) Otherwise, is there a workaround?
Apache::Request and Apache::Cookie both require
libapreq, and this hasn't been ported to Win32 yet.
However, it's being worked on, and hopefully will be
available soon.
best regards,
randy kobes
------------------------------
Date: Fri, 23 Jun 2000 22:13:00 GMT
From: nawkboy@my-deja.com
Subject: IO::Socket::INET forking server problem
Message-Id: <8j0nd0$ndl$1@nnrp1.deja.com>
My forking perl server is configured to listen to port 2400. Although
clients can successfully interact with the server, the socket
connections and forked processes are not being closed properly. This
is evidenced by the output from netstat and ps. Unfortunately, I do
not understand the problem well enough to diagnosis it. I have tried
to give enough information below that someone more familar with
writting servers in perl will be able to quickly see what is wrong.
Any help will be greatly appreciated. I am intending to read "An
Advanced 4.4BSD Interprocess Communication Tutorial" this weekend in
the hopes of gaining greater insight into the problem.
-----Connection example------(ERROR is a valid response is this context)
$ telnet nigel 2400
Trying 10.10.0.106...
Connected to nigel.
Escape character is '^]'.
hi
ERROR
quit
Connection closed by foreign host.
$
------------netstat -a|grep 2400---------------
--After connecting and disconnecting several times------
*.2400 *.* 0 0 0 0
LISTEN
nigel.2400 nigel.33359 32768 0 32768 0
TIME_WAIT
nigel.2400 nigel.33361 32768 0 32768 0
TIME_WAIT
nigel.2400 nigel.33362 32768 0 32768 0
TIME_WAIT
--While one client is connected--------
*.2400 *.* 0 0 0 0
LISTEN
*.2400 *.* 0 0 8576 0
BOUND
nigel.2400 nigel.33361 32768 0 32768 0
TIME_WAIT
nigel.2400 nigel.33362 32768 0 32768 0
TIME_WAIT
nigel.33368 nigel.2400 32768 0 32768 0
ESTABLISHED
nigel.2400 nigel.33368 32768 0 32768 0
ESTABLISHED
-No one is connected and server has been running for a few minutes--
*.2400 *.* 0 0 0 0
LISTEN
*.2400 *.* 0 0 8576 0
BOUND
*.2400 *.* 0 0 8576 0
BOUND
*.2400 *.* 0 0 8576 0
BOUND
nigel.2400 nigel.33368 32768 0 32768 0
TIME_WAIT
----ps -ef|grep t22----------
sirsi 12110 4178 0 15:02:59 pts/2 0:00 perl -Mblib
t/t22_run_server
sirsi 12112 12110 0 15:03:07 pts/2 0:00 perl -Mblib
t/t22_run_server
sirsi 12414 11543 0 15:13:48 pts/5 0:00 grep t22
sirsi 12270 12143 0 15:08:51 pts/2 0:00 perl -Mblib
t/t22_run_server
sirsi 12135 12112 0 15:05:52 pts/2 0:00 perl -Mblib
t/t22_run_server
sirsi 12143 12135 0 15:06:04 pts/2 0:00 perl -Mblib
t/t22_run_server
-------------------Relevant Code Section--------------------------------
--
#All of this is inside of the XXX::Main object.
package XXX::Main;
use vars qw($VERSION @ISA);
@ISA = qw();
$VERSION = '0.01';
require 5.005_03;
use strict;
use XXX::Log;
use XXX::Translator;
use IO::Socket;
use Socket;
#----------------------------------------------
sub REAP {
my $waitedpid = wait();
$MAIN::SIG{'CHLD'} = \&REAP;
}
#----------------------------------------------
$MAIN::SIG{'CHLD'} = \&REAP;
#----------------------------------------------
sub new {
my $class=shift;
my $self=bless {}, ref($class)||$class;
$self->_init(@_);
return $self;
}#new
#----------------------------------------------
#other methods, etc
#
#----------------------------------------------
sub start {
my $self=shift;
#blah blah
$main_sock = new IO::Socket::INET (
'LocalPort' => $self->{'port'},
'Listen' => 5,
'Proto' => 'tcp',
'Reuse' => 1,
);
die "Socket could not be created. Reason: $!\n" unless
($main_sock);
while ($new_sock = $main_sock->accept()) {
$pid = fork();
die "Cannot fork: $!" unless defined($pid);
if ($pid == 0) {
# Child process
$translator = XXX::Translator->new({
'log_obj' => $log_obj,
'apiserver_path' =>
$self->{'apiserver_path'},
'library' => $self->
{'library'},
});
INNER_LOOP: while (defined ($buf = <$new_sock>)) {
# do something with $buf ....
chomp $buf;
$log_obj->log("[MAIN] PID $$ buf is
${buf}\n", 0);
$reply=$translator->translate($buf);
last unless (defined $reply);
chomp $reply;
print $new_sock "$reply\015\012";
}#while
shutdown($new_sock, 2);
}## else 'tis the parent process, which goes back to
accept()
}#while
close ($main_sock);
return;
}#start
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 23 Jun 2000 22:37:46 GMT
From: cheena88@my-deja.com
Subject: move from Unix to NT - - MSQL to Perl scripts broken
Message-Id: <8j0oro$oci$1@nnrp1.deja.com>
Our web site has been moved to an NT server and was on a Unix server.
Some database scripts were developed in MSQL 2.0 and going through an
API library interface to Perl which then was processed by the cgi
script. Now that we are on an NT, our scripts will not run,
obviously. I am trying to find out if MSQL 2.0 is available on an NT
and if Perl is already installed, is there an API library for the NT
server? Or is there another suggestion to get these databases and
search scripts to work again.
I am not a backend guru, just need to find the information so that I
have something to tell the higher ups.
Please HELP.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 24 Jun 2000 00:13:10 +0200
From: "TheEx0rcist" <TheEx0rcist@fanclub.org>
Subject: OpenFile then Chomp
Message-Id: <8j0ne1$vi4$1@news4.isdnet.net>
Hi,
Is there a faster/more efficient way to do this :
sub getFirstLine
{
my $file = shift;
my $line;
open (FILE,$file) or die ("$file : $!");
$line = <FILE>;
close (FILE);
chomp $line;
return $line;
};
It is very crictical because the first line is extracted from thousands of
files so speed is an issue!
Thanks for your help !
--
TheEx0rcist.
------------------------------
Date: Fri, 23 Jun 2000 22:29:25 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: OpenFile then Chomp
Message-Id: <sl7p65ine7f144@corp.supernews.com>
In article <8j0ne1$vi4$1@news4.isdnet.net>,
TheEx0rcist <TheEx0rcist@fanclub.org> wrote:
: Is there a faster/more efficient way to do this :
:
: sub getFirstLine
: {
: my $file = shift;
: my $line;
:
: open (FILE,$file) or die ("$file : $!");
: $line = <FILE>;
: close (FILE);
:
: chomp $line;
:
: return $line;
: };
You might try C<chomp($line = `head -1 $file`);>. Programming Perl is
an empircal science. :-)
: It is very crictical because the first line is extracted from thousands of
: files so speed is an issue!
Disk I/O tends to be very slow. It's hard to give you useful advice
without knowing what's going on in the rest of your program. Would
it be helpful to you to precompute the first lines and throw them
into a file? Take a look at mjd's Memoize module to see if it might
help you (look at the persistent mode). Depending on your filesystem,
you may be able to load its cache with the data you want.
Greg
--
VMS is a text-only adventure game. If you win you can use Unix.
-- Bill Davidsen
------------------------------
Date: Fri, 23 Jun 2000 21:19:23 -0500
From: "Rich H" <richh@panola.com>
Subject: Re: OpenFile then Chomp
Message-Id: <sl86p5ise7f45@corp.supernews.com>
Try this
open (FILE,$file) or die ("$file : $!");
chomp($line = <FILE>);
close (FILE);
Rich
TheEx0rcist <TheEx0rcist@fanclub.org> wrote in message
news:8j0ne1$vi4$1@news4.isdnet.net...
> Hi,
>
> Is there a faster/more efficient way to do this :
>
> sub getFirstLine
> {
> my $file = shift;
> my $line;
>
> open (FILE,$file) or die ("$file : $!");
> $line = <FILE>;
> close (FILE);
>
> chomp $line;
>
> return $line;
> };
>
> It is very crictical because the first line is extracted from thousands of
> files so speed is an issue!
>
> Thanks for your help !
>
> --
> TheEx0rcist.
>
>
------------------------------
Date: Sat, 24 Jun 2000 12:29:31 +0900
From: "¾ÈÅ¿í" <hanbit@tng.co.kr>
Subject: oracle DB connection
Message-Id: <8j1a6u$46l$1@newsfeed.unitel.co.kr>
I want a data insert into oracle DB using perl.
There was no error message but it couldn't inserted into DB
here is source code. I want a reply.
Have a nice day
------------------------------
Date: Sat, 24 Jun 2000 12:32:49 +0900
From: "¾ÈÅ¿í" <hanbit@tng.co.kr>
Subject: oracle DB connection
Message-Id: <8j1ad4$46r$1@newsfeed.unitel.co.kr>
I want a data insert into oracle DB using perl.
There was no error message but it couldn't inserted into DB
here is source code. I want a reply.
Have a nice day
#!/usr/local/bin/perl
$ENV{'ORACLE_HOME'} = "/oracle/app/oracle/product/7.3.4";
$ENV{'NLS_LANG'} = "American_America.KO16KSC5601";
require "cgi-lib.pl";
require "teria-lib.pl";
&ReadParse;
#$memnum = $in{'memnum'};
#$insSQL = "insert into ROLLBOOK_TBL
(memnum,nhanja,nhangu,curjob,curoll,prejob,prroll,birthd,birthp,memadd,memte
l,offtel,cacade,carrel,memcert,membook)
values(".$memnum,$nhanja,$nhangu,$curjob,$curoll,$prejob,$prroll,$birthd,$bi
rthp,$memadd,$memtel,$offtel,$cacade,$carrel,$memcert,$membook .")";
#DB Connection
use DBI;
use CGI;
$new=new CGI;
$drh = DBI->install_driver('Oracle');
die unless $drh;
$dbh = $drh->connect('DB','user','passwd');
die unless $dbh;
$dbh->{LongReadLen} = 16384;
#$cursor = $dbh->prepare($insSQL);
#$cursor->execute;
$memnum=$new->param('memnum');
$nhanja=$new->param('nhanja');
$nhangu=$new->param('nhangu');
$curjob=$new->param('curjob');
$curoll=$new->param('curoll');
$prejob=$new->param('prejob');
$prroll=$new->param('prroll');
$birthd=$new->param('birthd');
$birthp=$new->param('birthp');
$memadd=$new->param('memadd');
$memtel=$new->param('memtel');
$offtel=$new->param('offtel');
$cacade=$new->param('cacade');
$carrel=$new->param('carrel');
$memcert=$new->param('memcert');
$membook=$new->param('membook');
#Form action
$actInput = $in{'actInput'};
if($actInput eq
bmit"){
$insSQL = "insert into ROLLBOOK_TBL (memnum,nhanja,nhangu,curjob,curoll,prejob,prroll,birthd,birthp,memadd,memtel,offtel,cacade,carrel,memcert,membook) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$cursor = $dbh->prepare($insSQL);
$cursor->execute($memnum,$nhanja,$nhangu,$curjob,$curoll,$prejob,$prroll,$birthd,$birthp,$memadd,$memtel,$offtel,$cacade,$carrel,$memcert,$membook);
#$memnum=$cursor->fetchrow_array;
#$cursor->fetch;
#$memnum++;
$db
h->disconnect;
}
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 3469
**************************************