[7821] in Perl-Users-Digest
Perl-Users Digest, Issue: 1446 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 10 10:17:15 1997
Date: Wed, 10 Dec 97 07:01:14 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 10 Dec 1997 Volume: 8 Number: 1446
Today's topics:
Re: ... rumours run amok (Chris Nandor)
Re: accessing a file in directory other than cgi script <barnett@houston.Geco-Prakla.slb.com>
Re: awk to perl <tim@doulos.co.uk>
Re: CGI suggestions for online shopping?? <pos@pc-design.de>
Re: Communication through pipes with su, Using Pipe wit (Marek Rouchal)
Dynamic array names <cleighto@*ctron.com>
Re: Help with a regex (Andrew M. Langmead)
Re: Is Perl V5 available for NT 4.0 <webmaster@hsv.com.au>
Re: libwww - LWP::UserAgent (hangman)
Re: mkdir not mking my dir <pos@pc-design.de>
perl module for accessing an ms-access db file on a uni <khemani@plexstar.com>
PERL RESOURCE KIT--Great Price!! <107740.2076@CompuServe.COM>
Re: PERL<-->databases ???(newbie) <robnet@hem1.passagen.se>
Re: Pie chart with GD.pm (Michael Fuhr)
problems with MIME::Lite and MIME-tools josef.ender@softronic.ch
question about libwww (response-object) md4calle@mdstud.chalmers.se
Re: question about libwww (response-object) <aas@sn.no>
Re: question about libwww (response-object) (Calle ]sman)
Re: Referring to Perl modules on the net? (Kartik Subbarao)
Re: Removing Files older than 14 days <pos@pc-design.de>
Re: Returning information from an nslookup ?? <pos@pc-design.de>
Sporadic NFS and TCP Connect Problems in Solaris 2.5.1/ <schattev@imb-jena.de>
Re: Sporadic NFS and TCP Connect Problems in Solaris 2. (Casper H.S. Dik - Network Security Engineer)
use lib "$local_lodules_path" <mehta@mama.indstate.edu>
Re: What is wrong with this script? <Greg.Allen@csfp.co.uk>
Re: What is wrong with this script? (I R A Aggie)
Re: Writing fixed-length records to file <barnett@houston.Geco-Prakla.slb.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 10 Dec 1997 08:07:42 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: ... rumours run amok
Message-Id: <pudge-1012970807430001@ppp-42.ts-1.kin.idt.net>
In article <34894898.4599701@news.dircon.co.uk>, lenkerWEEDS@dircon.co.uk wrote:
# Randal Schwartz wrote:
# > Larry Wall has no plans to make Perl4 be Y2K!
Yeah, it was going to say that "There are no plans to make Perl4 be Y2K,"
but then I made plans to make Perl4 Y2K (Step 1: Make Perl4 Y2K), so
Randal had to change that one. :)
--
Chris Nandor pudge@pobox.com http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6'])
#== MacPerl: Power and Ease ==#
#== Publishing Date: Early 1998. http://www.ptf.com/macperl/ ==#
------------------------------
Date: Wed, 10 Dec 1997 07:43:14 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
To: tschwartz@infomedics.com
Subject: Re: accessing a file in directory other than cgi script?
Message-Id: <348E9C70.C154045F@houston.Geco-Prakla.slb.com>
none@nowhere.com wrote:
> Is it possible to open a file in a perl cgi script that is in a
> superdirectory (or any other directory for that matter) than the one
> which is in the script itself?
>
> I've got a directory 'cgi-bin' under my root directory, and I'd like to
> run a script from it which opens a file in my root directory. I thought
> maybe something like:
>
> open(FILE, "../myfile.htm"); # this is a reference to the
Well, first, make this read: open(FILE,"../myfile.htm") or die ("Unable
to access file: $!\n");
This checks to make sure the open is successful, and issues an error if it
is not. $! contains the operating system error message that was
generated. Perhaps your not in the directory you think you are....?.
Where does the error go? STDOUT. For a CGI, I have no idea where it is
directed. Error logs? I suspect your getting an error here....
> superdirectory, right?
>
> would do it, but it doesn't. I also tried:
>
> open(FILE, "/myfile.htm"); # isn't this how you refer to a
> document in your root directory?
This should work just fine, assuming several things:1. The file exists
2. You have access to it as the web server
3. You web server is set up to allow this (is this an issue?)
See above.
>
>
> but neither of these successfully open the file. I know that if I place
> the file in the same directory as the script itself and use:
>
> open(FILE, "myfile.htm"); # refering to the file in the current
> directory
>
See above.
> it will open it with no problem, so either I'm using incorrect syntax to
> specify the directory, or you simply can't access files in directories
> other than your script. Can anyone give me some insight?
>
> If possible, please e-mail me at:
>
> tschwartz@infomedics.com
>
Ok.
> Thanks in advance!
>
> Ted Schwartz
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------
------------------------------
Date: Tue, 9 Dec 1997 18:11:17 +0000
From: Tim Pagden <tim@doulos.co.uk>
Subject: Re: awk to perl
Message-Id: <xYV5oAAFnYj0QAPn@doulos.co.uk>
In article <zDxJuFARkDi0QAXQ@doulos.co.uk>, Tim Pagden
<tim@doulos.co.uk> writes
>Well...
>
>I've tried search engines, browsing (and text-searching) the key Web
>pages (anything linked to from www.perl.com) and the FAQs - just about
>everything in fact - but can I find the ftp site or URL for downloading
>the awk2perl utility? Nope.
>
>So come on chaps, someone please advise...
Thanks chaps, I am indebted to you for your help. a2p it is, not
awk2perl!
--
Tim Pagden, Tel: +44 1425 471 223
DOULOS, Fax: +44 1425 471 573
Church Hatch, Email: tim@doulos.co.uk
22 Market Place, Web: www.doulos.co.uk
Ringwood,
BH24 1AW ** Visit The Winning Edge **
Hampshire ** www.doulos.co.uk **
UK ** for many tips and models **
** for VHDL and Verilog **
------------------------------
Date: Wed, 10 Dec 1997 14:53:00 +0100
From: Carsten Posingies <pos@pc-design.de>
Subject: Re: CGI suggestions for online shopping??
Message-Id: <348E9EBC.FB46CC94@pc-design.de>
Jeff Hughes wrote:
> Was hoping some of you could point me somewhere or give some suggestions
> as to the best way to keep track of online shoppers. My main concern being
> things like AOL Gateways where many people could be coming from, so I can't
> just store 'baskets' and orders by REMOTE_ADDR.
> thanks
What about cookies?
Case
------------------------------
Date: 10 Dec 1997 10:00:40 +0100
From: Marek.Rouchal@-nospam-hl.siemens.de (Marek Rouchal)
Subject: Re: Communication through pipes with su, Using Pipe with fork
Message-Id: <66llno$rtg@buffalo.HL.Siemens.DE>
In article <3486FA0A.D5E@arl.mil>, Howell Caton (ISTD/TD) <caton> wrote:
> Greetings: I want to use pipe with fork to pipe data to and from the
> same executable, but I don't know how to associate READHANDLE and
> WRITEHANDLE with the executable. Do I use "open" like this?
>
> open(READHANDLE, "doit|");
> open(WRITEHANDLE, "|doit");
>
> I don't think so! The idea solution would be for someone to point
> me to an example where this is done. Thanks!
In article <66i067$cfr@dfw-ixnews12.ix.netcom.com>, jeff@yoak.com (Jeff Yoak) writes:
> bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to
> "kf8nh") wrote:
> >Your problem is that you can't open a command pipe for both input and output
> >like that. Take a look at the IO::Open2 and IO::Open3 modules to create
> >bidirectional pipes to commands.
>
> Hmmm. Couldn't find these, but I'm guessing it was supposed to be
> IPC::Open2 and Open3. Those descriptions sound like just what I need
> but I still had a hard time making it work. I finally threw up my
> hands in disgust and implements a solution that involved temporary
> files and doesn't require getting the output directly from the
> command.
You are better off with Open2/Open3. You need "use IPC::Open2;" or
"use IPC::Open3;", though. AFAIK these modules come with the standard
perl 5.00x where x >= 3. See "perldoc IPC::Open3". Note that with
"use IO::Handle;" you may use OO syntax for the filehandles, too, e.g.
use IO::Handle;
use IPC::Open3;
my $stdin = FileHandle->new;
my $stdout = FileHandle->new;
my $stderr = FileHandle->new;
my @cmd = qw(nslookup); # your command here!
my $pid = open3($stdin,$stdout,$stderr,@cmd);
# check $pid for success!
$stdin->print("mox.perl.com\n");
while(<$stdout>) {
# parse the output here...
}
HTH,
Marek
PS. If you want to reply by Email, please remove -nospam- from
the address. Thank you.
--
Marek Rouchal Phone : +49 89/636-25849
SIEMENS AG, HL CAD SYS Fax : +49 89/636-23650
Balanstr. 73 mailto:Marek.Rouchal@-nospam-hl.siemens.de
81541 Muenchen PCmail:Marek.Rouchal.PC@-nospam-hl.siemens.de
------------------------------
Date: Wed, 10 Dec 1997 08:21:31 -0500
From: Corey Leighton <cleighto@*ctron.com>
Subject: Dynamic array names
Message-Id: <66m5gf$c3q$2@mer-news.ctron.com>
Anyone have any suggestions on how I can dynamically name arrays? I
want to do something like this:
open (DIR,"<SOMEPATH>");
@dir = readdir(DIR):
closedir(DIR);
foreach $file (dirs){
@$file = <some stuff>
...
... some more stuff
}
I want to create an array named by each of the files in the <SOMEPATH>.
the files in the array change so I need something dynamic.
--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Corey Leighton cleighto@*ctron.com
Cabletron Systems, Inc. ext. 5510
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
------------------------------
Date: Wed, 10 Dec 1997 14:48:03 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Help with a regex
Message-Id: <EKzAG3.DAI@world.std.com>
sanguish@digifix.com (Scott Anguish) writes:
>I'm attempting to breakdown different file entries...
>Filename.1.0.PIs.tgz
>Filename.1.3.W.tgz
>Filename.PI.tgz
>Flex.files.2.0.tgz
>The parts are
>filename,version (optional), keyletters some combination of PIWMs
>(optional) followed by a known file extension..
How about if you split the filename apart on the periods, store the
required sections and then check if any of the rest describe an
optional section.
@parts = split /\./;
$filename = shift @parts;
$extention = pop @parts;
$keyletters = pop @parts if $parts[-1] =~ /^[PIWMs]+$/;
@version = join '.', @parts;
--
Andrew Langmead
------------------------------
Date: Thu, 11 Dec 1997 00:44:03 +1100
From: "Andrew Quested" <webmaster@hsv.com.au>
Subject: Re: Is Perl V5 available for NT 4.0
Message-Id: <66m69l$olp$1@news.mel.aone.net.au>
>Is Perl V5 available for NT 4.0 and if so how do I get a copy?
Yes, you can download it from:
http://www.activestate.com/software/default.htm
Andrew Quested.
------------------------------
Date: 10 Dec 97 08:09:18 GMT
From: hangman@post1.com (hangman)
Subject: Re: libwww - LWP::UserAgent
Message-Id: <348e4e2e.0@news.swiftech.com.sg>
how do u do this in a POST method ?
In article <65kldo$cso@shoga.wwa.com>, scribble@shoga.wwa.com says...
>
>rv33100@glaxowellcome.co.uk writes:
>>I'm using libwww version 5.16. Now I tried to simulate a HTML-Form with
>>the LWP::UserAgent. I send my request to the server, nearly everything
>>worked right, nearly !!! Filling the Request in
>>$request->content("Query") I don't succeed to get at the server the
>>Query_String.
>
>The content() method has to do with the body of the request not the
>query string. The query string is part of the URL.
>
>Very likely you are constructing $request by yourself -- in that case
>the safest thing to do is construct a URI::URL first, add your query
>string to it with equery(), and when that is ready construct $request
>with something like new HTTP::Request GET => $url;
>
>Alternatively you can just stick the query string to your URL with a
>"?", but you are responsible for encoding ("escaping") it.
>
>Finally, that might not be the only thing that is wrong. You need to
>be sure what your CGI program is dumping.
>
------------------------------
Date: Wed, 10 Dec 1997 15:14:56 +0100
From: Carsten Posingies <pos@pc-design.de>
To: Leon Andrews <leon@staff.netchannel.co.uk>
Subject: Re: mkdir not mking my dir
Message-Id: <348EA3E0.D9F866D1@pc-design.de>
Leon Andrews wrote:
> If I do...
>
> $thedir = "/export/home/nc/NC/html/talk/boards/dir_name";
> mkdir $thedir, oct("775");
>
> then the dir is successfully created.
>
> if I do
>
> $thedir = "/export/home/nc/NC/html/talk/boards/$directory";
> mkdir $thedir, oct("775");
>
> where $directory is exactly "dir_name", nothing happens.
Tried that? ->
$directory = "dir_name";
$thedir = "/export/home/nc/NC/html/talk/boards/".$directory;
mkdir $thedir, oct("775");
Regards,
Case
------------------------------
Date: Wed, 10 Dec 1997 08:59:18 -0500
From: Yash Khemani <khemani@plexstar.com>
Subject: perl module for accessing an ms-access db file on a unix box?
Message-Id: <348EA036.BA02115B@plexstar.com>
hi folks,
is there a module available for accessing an ms-access
db file on a unix box (a sun sparc running solar 2.5.1
to be specific)?
thanks!
yash
--
+---------------------------------------------------------------------+
| Yash L. Khemani | E-Mail: khemani@plexstar.com |
| Plexstar, Inc., Faiarfax, VA | WWW: http://www.plexstar.com |
+---------------------------------------------------------------------+
------------------------------
Date: Wed, 10 Dec 1997 08:23:42 -0500
From: Rodney Stevens <107740.2076@CompuServe.COM>
Subject: PERL RESOURCE KIT--Great Price!!
Message-Id: <#rCuW7WB9GA.277@ntawwabp.compuserve.com>
THE PERL RESOURCE KIT: UNIX EDITION--$60!!
And that include Priority postage!
This is the most comprehensive collection of
Perl documentation and software for webmasters,
programmers, and system administrators.
The kit includes four tutorial and reference
books, and supported tools on a bonus CD.
This December '97 kit (which retails for $149)
is completely new and still in its shrink-
wrap packaging!
Many thanks.
Rodney
107740.2076@compuserve.com
------------------------------
Date: 10 Dec 1997 09:58:50 GMT
From: "robban" <robnet@hem1.passagen.se>
Subject: Re: PERL<-->databases ???(newbie)
Message-Id: <01bd0552$2c941000$c82da8c0@akilles.ittek.org>
[snip]
: Grab yourself a copy of Shishir Gundavarum's CGI Programming on the
: World Wide Web and check out his Sprite.pm module. Gives you SQL-ish
: control over flat file "databases". Several months ago, I offered up
: my little in house bug tracker called BugBase as an example of a
: Sprite.pm based application. Offer still stands. It ain't rocket
: science and some of it ain't even pretty, but it is a functional
: example... at least useful as a learning tool.
If BugBase can handle millions of entries I'm sure MS would be interested
in it. 8?>
------------------------------
Date: 10 Dec 1997 02:59:41 -0700
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Pie chart with GD.pm
Message-Id: <66lp6d$71j@flatland.dimensional.com>
Chandra Shirashyad <c4sshir@srv.pacbell.com> writes:
> I am trying to create a pie-chart with GD.pm, but not very successful
> doing so. The arc function is not very helpful in creating a pie chart.
> Have anyone of you created a pie-chart using GD? Please let me know what
> was your approach.
Check out the Chart module, which uses GD:
http://www.perl.com/CPAN/modules/by-module/Chart/
Here's a simple example:
#!/usr/local/bin/perl -w
use Chart::Pie;
$pie = new Chart::Pie;
$pie->add_pt("apple", 1);
$pie->add_pt("pumpkin", 2);
$pie->add_pt("pecan", 3);
$pie->set("title" => "Pies");
$pie->gif("pies.gif");
Hope this helps.
--
Michael Fuhr
http://www.dimensional.com/~mfuhr/
------------------------------
Date: Wed, 10 Dec 1997 13:40:53 GMT
From: josef.ender@softronic.ch
Subject: problems with MIME::Lite and MIME-tools
Message-Id: <348f9bc1.2371199@news.unisource.ch>
I tryed to use the MIME::Lite and MIME-tools modules on a NT 4.0 Perl
for Win32 5.001 Build 110
my script:
--------------------------------------------------------------------------------
use MIME::Lite;
$message = "message";
$mailprog = 'postmail.exe';
$sourcedir = "u:/web/cgi_data";
$msg = new MIME::Lite
From =>'me@myhost.com',
To =>'josef.ender@softronic.ch',
Cc =>'josef.ender@softronic.ch',
Subject =>'A message with 2 parts...',
Type =>'multipart/mixed';
attach $msg
Type =>'TEXT',
Data =>"Here's the GIF file you wanted";
attach $msg
Type =>'image/gif',
Path =>'$sourcedir/gugi.gif',
Filename =>'gugi.gif';
$msg->print(\*$mailprog);
---------------------------------------------------------------------------
I have allways the same errors:
Global symbol "VERSION" requires explicit package name at
D:\perl5\lib/MIME/Lite
.pm line 155.
Global symbol "QUIET" requires explicit package name at
D:\perl5\lib/MIME/Lite.p
m line 158.
Global symbol "VERSION" requires explicit package name at
D:\perl5\lib/MIME/Lite
.pm line 756.
Global symbol "QUIET" requires explicit package name at
D:\perl5\lib/MIME/Lite.p
m line 797.
Global symbol "QUIET" requires explicit package name at
D:\perl5\lib/MIME/Lite.p
m line 1560.
Global symbol "QUIET" requires explicit package name at
D:\perl5\lib/MIME/Lite.pm line 1561.
at mailtest2.pl line 2.
BEGIN failed--compilation aborted at mailtest2.pl line 2.
Any response would be greatly appreciated!
Thanks!
Josi
------------------------------
Date: Wed, 10 Dec 1997 03:12:41 -0600
From: md4calle@mdstud.chalmers.se
Subject: question about libwww (response-object)
Message-Id: <881694811.441@dejanews.com>
I'm trying to find out which links on a page that are redirected, and if
a link is redirected, I want to replace it with the proper link.
I use this code:
use HTTP::Response;
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$request = new HTTP::Request GET => 'http://www.somewhere.se';
$response = $ua->request($request);
$apa = $response->request;
print $apa;
and if the URL (http://www.somewhere.se) is redirected, the proper
URL should be in the $response->request? right?
well, the result I recieve is:
fraggel40> ./link.pl | more
HTTP::Request=HASH(0x24ddac)
fraggel40>
I can't get it to say something useful :/
anyone see some obvious mistake?
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 10 Dec 1997 10:52:03 +0100
From: Gisle Aas <aas@sn.no>
Subject: Re: question about libwww (response-object)
Message-Id: <m3g1o1r0e4.fsf@furu.g.aas.no>
md4calle@mdstud.chalmers.se writes:
> I'm trying to find out which links on a page that are redirected, and if
> a link is redirected, I want to replace it with the proper link.
> I use this code:
> use HTTP::Response;
>
> use LWP::UserAgent;
>
>
> $ua = new LWP::UserAgent;
>
> $request = new HTTP::Request GET => 'http://www.somewhere.se';
>
> $response = $ua->request($request);
> $apa = $response->request;
> print $apa;
>
> and if the URL (http://www.somewhere.se) is redirected, the proper
> URL should be in the $response->request? right?
Almost. Try $response->request->url
--
Gisle Aas
------------------------------
Date: 10 Dec 1997 13:46:02 +0100
From: md4calle@mdstud.chalmers.se (Calle ]sman)
Subject: Re: question about libwww (response-object)
Message-Id: <w7phg8he585.fsf@fraggel36.mdstud.chalmers.se>
Gisle Aas <aas@sn.no> writes:
> Almost. Try $response->request->url
worked perfectly!
many thanks!
/Calle
**************************************************************************
* * My homepage about the author Tom Holt: *
* /_\ http://www.mdstud.chalmers.se/~md4calle/holt/ *
* { ~._.~ } *
* ( Y ) other things like OnLine Guitar Archive linkpage *
* ( )~*~( ) and heaps of musiclinks can be found at *
* (__)-(__) http://www.mdstud.chalmers.se/~md4calle/ *
**************************************************************************
------------------------------
Date: 10 Dec 1997 14:47:25 GMT
From: subbarao@aurora.lf.hp.com (Kartik Subbarao)
Subject: Re: Referring to Perl modules on the net?
Message-Id: <66ma1t$hdi$1@hpavua.lf.hp.com>
In article <comdog-ya02408000R0912971555120001@news.panix.com>,
brian d foy <comdog@computerdog.com> wrote:
>In article <66k8vp$msk$1@hpavua.lf.hp.com>, subbarao@aurora.lf.hp.com
>(Kartik Subbarao) wrote:
>
>>I was thinking about what it might take to use Perl modules without
>>having to download and install them ahead of time. For instance, if you
>>said "use foo;", there would be some scheme whereby it would look for foo
>>somewhere on the network, download it dynamically, and perhaps cache it on
>>the local system.
>
>>Of course, I know I'm glossing over tons of practical issues here, but what
>>do people think? Does this basically sound like a good idea?
>
>well, in you scheme, you still have to download it and install it, so why
>not just download and install it?
Couple reasons:
1) I'd like to easily move a script from machine to machine (or mail
someone a script), and not have to worry if they have the modules installed.
2) As I'm thinking about it, it would also be nice to be able to say "use
foo-1.2", if I wanted to make sure that I got version 1.2 of foo. Even if
someone else has a given module, they might have an earlier, perhaps buggy
version. Or they may have a later version where the interface is no longer
compatible.
>perhaps the CPAN module does what you want?
Thanks for the pointer. I'll look into it some more.
-Kartik
--
Kartik Subbarao, Internet Solution Center, Hewlett-Packard
Email: Kartik_Subbarao@hp.com, Phone: (302) 633-8830, Fax: (302) 633-7490
Inside HP: http://aurora.lf.hp.com/home/
Internet Mirror: http://www.geocities.com/SiliconValley/Way/1234
------------------------------
Date: Wed, 10 Dec 1997 15:02:30 +0100
From: Carsten Posingies <pos@pc-design.de>
To: Hugh <hnews@harvest-lodge.demon.co.uk>
Subject: Re: Removing Files older than 14 days
Message-Id: <348EA0F6.5E28B484@pc-design.de>
Hugh wrote:
> I am having difficulty writing an efficient script to delete all files in a
> preset directory over a certain age. If a file is older than 14 days I want
> to delete it. There are likely to be upwards of a couple of thousand or so
> files in the directory. How is the best way to check the create dates and
> delete if appropriate. As I said there is no need to recurse subdirs as they
> won't exist. All files to be deleted will have a .ABC suffix, the routine
> should ignore files without this.
If you are running a UNIX system, why not using a simple cron job that
uses find ./ ... | xargs rm ?
Try "man find" for an exact synopsis and syntax
------------------------------
Date: Wed, 10 Dec 1997 15:21:53 +0100
From: Carsten Posingies <pos@pc-design.de>
To: Burt Lewis <burt@ici.net>
Subject: Re: Returning information from an nslookup ??
Message-Id: <348EA581.A85BC45@pc-design.de>
Burt Lewis wrote:
> Thanks, I tried that and I get this:
>
> Server: [207.180.0.20] Address: 207.180.0.20 Name: [207.180.0.20] Address:
> 207.180.0.20
>
> >print "Content-type: text/html\n\n";
>
> >$return = `nslookup 207.180.0.20`;
> >print "$return";
>
> I'm getting closer but it's not returning the Domain Name.
>
> Burt
Hi, Burt,
are you on a Unix machine? If, you should start your favorite editor,
hack in some C-lines that do the gethostbyaddr() system call to STDOUT
and use this in your perl script. To format an nslookup return is just
a waste of time since it's driving you nuts. If you need the C-source, mail
me.
Regards,
Case
------------------------------
Date: Wed, 10 Dec 1997 11:09:23 +0100
From: Ruben Schattevoy <schattev@imb-jena.de>
Subject: Sporadic NFS and TCP Connect Problems in Solaris 2.5.1/2.6 Cluster
Message-Id: <348E6A53.9F5ED507@imb-jena.de>
Hi,
sporadically I encounter two kind of network related problems running
Perl 5.004 under Solaris 2.5.1 and 2.6.
1) Stale NFS file handle:
A simple opening, writing and closing of an file via NFS sometimes
produces an error while attempting to close() the file with $! being
set to 'Stale NFS file handle'.
Questions:
- What does this mean? The exporting machine for sure did not reboot
in the mean time and the time between opening and closing should
be just a few seconds.
- How to avoid this kind of failure?
- Is it a Perl or a Solaris problem or the combination of both?
2) Connection refused:
Using a piece of code as given in the Perl online help to establish
a server-client TCP connection sporadically gives an error:
$iaddr = inet_aton($remote) || die "no host: $remote";
$paddr = sockaddr_in($port, $iaddr);
$proto = getprotobyname('tcp');
socket(SOCK, PF_INET, SOCK_STREAM, $proto) || die "socket: $!";
connect(SOCK, $paddr) || die "connect: $!";
The connect() fails and $! will contain 'Connection refused'!
Questions:
- What does this mean? The server for sure did open the port and still
is running (eventually it might be suspended while the client attempts
to connection).
- How to avoid this kind of failure?
- Is it a Perl or a Solaris problem or the combination of both?
Thank you in advance,
Ruben
--
Ruben Schattevoy (schattev@imb-jena.de)
Institut fuer Molekulare Biotechnologie,
Beutenbergstrasse 11,
07745 Jena,
Germany
------------------------------
Date: 10 Dec 1997 13:13:50 GMT
From: Casper.Dik@Holland.Sun.Com (Casper H.S. Dik - Network Security Engineer)
Subject: Re: Sporadic NFS and TCP Connect Problems in Solaris 2.5.1/2.6 Cluster
Message-Id: <casper.881759479@uk-usenet.uk.sun.com>
[[ PLEASE DON'T SEND ME EMAIL COPIES OF POSTINGS ]]
Ruben Schattevoy <schattev@imb-jena.de> writes:
>1) Stale NFS file handle:
> A simple opening, writing and closing of an file via NFS sometimes
> produces an error while attempting to close() the file with $! being
> set to 'Stale NFS file handle'.
> Questions:
> - What does this mean? The exporting machine for sure did not reboot
> in the mean time and the time between opening and closing should
> be just a few seconds.
It means that the file was removed on the server but the client still
had a reference to the file.
This shouldn't happen normally, as the client will not actually remove
files that are still open; rather, it will be renamed to .nfsXXXX and
that file will be removed on close.
Hwoever, if multiple clients write and remove the same file, then the
problem may occur. Or if the NFS server si too aggressive in removing
.nfs* files.
You may want to make sure you run the latest Solaris patches, but these
seem to affect only filesystems mounted with the undocumented "nocto"
option.
> - How to avoid this kind of failure?
Make sure the file is only unlinked on the client that uses it.
> - Is it a Perl or a Solaris problem or the combination of both?
It' snot a perl problem, and not necessarily a Solaris problem.
Dependign on teh exact circumstancesm, you may actually be running into
an NFS limitation.
>2) Connection refused:
> Using a piece of code as given in the Perl online help to establish
> a server-client TCP connection sporadically gives an error:
> $iaddr = inet_aton($remote) || die "no host: $remote";
> $paddr = sockaddr_in($port, $iaddr);
> $proto = getprotobyname('tcp');
> socket(SOCK, PF_INET, SOCK_STREAM, $proto) || die "socket: $!";
> connect(SOCK, $paddr) || die "connect: $!";
> The connect() fails and $! will contain 'Connection refused'!
> Questions:
> - What does this mean? The server for sure did open the port and still
> is running (eventually it might be suspended while the client attempts
> to connection).
Well, you're connecting to the wrong port. (Connection refused means
you're connecting to a port w/o listener).
Under 2.6, you can run (this does *NOT* work on earlier releases)
truss -t connect -v connect perl your-script.pl ....
and get the exact parameters passed to connect.
> - Is it a Perl or a Solaris problem or the combination of both?
Most likely, a programming or usage error of some kind.
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
------------------------------
Date: Wed, 10 Dec 1997 03:24:03 GMT
From: Miten S Mehta <mehta@mama.indstate.edu>
To: webmaster@rede.com
Subject: use lib "$local_lodules_path"
Message-Id: <Pine.LNX.3.96.971209221835.6719A-100000@mama.indstate.edu>
12/9/97
Hello,
I have a local perl installed in my home dir. Its in
/u2/h2/mehta/perl
I have installed DBI for msql access in site_perl along above path.
As I use
use DBI;
The perl program runs fine. As I use either of
use lib "/u2/h2/mehta/perl/lib";
use lib "/u2/h2/mehta/perl/lib/site_perl";
use lib "/u2/h2/mehta/perl/lib/site_perl/DBI";
The program is unable to fing a loadable object module for DBI.
could you guide?
------------------------------
Date: Wed, 10 Dec 1997 13:32:52 +0000
From: Greg Allen <Greg.Allen@csfp.co.uk>
To: Larry Yurdin <lyurdin@nwlink.com>
Subject: Re: What is wrong with this script?
Message-Id: <348E9A04.2577@csfp.co.uk>
its line 4 that really at fault. change it to:
unshift(@INC, '/cgi-bin');
If you are being taught perl5, then your instructor really ought to be
encouraging you to use "-w" and "use strict;", i.e. always start with:
#!/usr/local/bin/perl5.003 -w
use strict;
This will make your life much much easier.
_____________________________________________________
Greg Allen
OTC Settlement Systems
Credit Suisse Financial Products
------------------------------
Date: Wed, 10 Dec 1997 09:34:56 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: What is wrong with this script?
Message-Id: <-1012970934570001@aggie.coaps.fsu.edu>
In article <66lel9$3fg$1@texas.nwlink.com>, "Larry Yurdin"
<lyurdin@nwlink.com> wrote:
+ The following script in Perl 5.003 with 755 permissions and the correct path
+ on my server has been checked by my instructor who said the syntax is fine.
+ require('cgi-lib.pl');
Let's see if I've got this straight: you're paying someone to teach you
to learn Perl 5, and they're making you use cgi-lib.pl??
Go ask for a refund. Or demand the CGI.pm module. In fact, you can use it
in cgi-lib.pl emulation. Simply replace the above 'require' with:
use CGI qw(:cgi-lib);
James
--
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: Wed, 10 Dec 1997 08:28:09 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Writing fixed-length records to file
Message-Id: <348EA6F8.DD0D52E5@houston.Geco-Prakla.slb.com>
speed@racer.cartoon.spam.address wrote:
> Ciao!
>
> I have a fixed length record of delimited fields that I want to write to
> a UN*X file. Quite often the last field of the record is blank so needs
> to be filled with spaces.
>
> When using perl formats, if the last field is blank, it is truncated to
> the preceeding delimeter when written to file. Naturally this hoses my
> fixed length record.
>
> I could append a delimiter to the record before printing which preserves
> the final field's length when filled with spaces, but this requires a
> subsequent filter to strip the trailing delimeters which I would prefer
> not to do.
>
> There must be a cleaner solution to outputting fixed length records
> which preserves the trailing field length even if it is blank or spaces.
>
> The FAQ mentions using pack/unpack for manipulating fixed length
> records. I have not applied this approach to printing of the record. I
> will try it.
The following script:
#!/usr/local/bin/perl -w
#
$a = "junk";
$b = "12345";
$c = "123456";
$d = "1234567";
$e = pack("A5A6A7A10",$a,$b,$c,$d);
print "<$e>\n";
__END__
Creates these results:
<junk 12345 123456 1234567 >
1234512345612345671234567890
As you can see, I got a field of 5, 6, 7 & 10 characters in length, space
padded. I think that is what you wanted, no?
HTH.
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 1446
**************************************