[9146] in Perl-Users-Digest
Perl-Users Digest, Issue: 2764 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 29 21:08:28 1998
Date: Fri, 29 May 98 18:00:26 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 29 May 1998 Volume: 8 Number: 2764
Today's topics:
Re: "ref($proto) || $proto" considered harmful (was Re: <keithmur@mindspring.com>
Re: Advanced Perl Programming Book <keithmur@mindspring.com>
Re: Advanced Perl Programming Book <tchrist@mox.perl.com>
Anyone using JPL for development ? (Kevin Dee Sheely)
Apache 90 second time out <agent@eg-web.com>
Re: Clearly define "free software" (David Adler)
Re: cron job via perl ?? <kyaman@earthlink.net>
DBD:Oracle installation woes todd_herr@sra.com
Re: Don't Know how to decrypt using PERL (Mark-Jason Dominus)
duping from a reference <lanier@shell6.ba.best.com>
Re: Email address checker - comments welcome <dfetter@shell4.ba.best.com>
Re: Email address checking <pearcec@fast.net>
Re: Email address checking (Craig Berry)
Re: Have we got a good free Perl manual? (Gary M. Greenberg)
Re: Have we got a good free Perl manual? (Gary M. Greenberg)
Help needed determining IP address on Windows NT benny_profane@hotmail.com
Re: How to read AND write to a programm? (Tad McClellan)
Install: Sorry, but how to install a module? <ulf.wendel@kiel.netsurf.de>
Re: perlish idiom for substitute in many files, only w (Tad McClellan)
Re: Problem with multiple file access's <upsetter@ziplink.net>
Re: Q: How to read AND write to a programm? (Tad McClellan)
Re: Q: How to read AND write to a programm? <mhoereth@rz-online.de>
Re: Rand on NT perl (Ron Heiby)
Re: renaming files under NT (Robert Webb)
seek advice on simple first program (Shaun Sides)
Sockets and E-mail (Robert Webb)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 29 May 1998 18:26:06 -0500
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: "ref($proto) || $proto" considered harmful (was Re: OO - explicit package name required)
Message-Id: <356F440D.E471CF03@mindspring.com>
Zenin wrote:
>
> Randal Schwartz <merlyn@stonehenge.com> wrote:
> : >>>>> "Frank" == Frank L Quednau <quednauf@nortel.co.uk> writes:
> : Frank> my $proto= shift;
> : Frank> my $class = ref($proto) || $proto;
> : Please don't type those lines until you know exactly what it does,
> : exactly why you would want to use it, and exactly when you would not
> : want to use it (which is most of the time).
>
> Err, huh? Why would this ever be a problem? Under what
> conditions? At least to me, it makes perfect sense
> that:
> $anotherLego = $lego->new();
>
> New() is expected to exist by convention, however clone() and
> copy() as you suggest, are not. It translates well to me as, "I
> have this $toy, please make me a new() one that looks just like
> it".
>
Mmmm, that's not really what it does. Consider the case where you have
put some data into $lego.
[blah blah blah :-)]
> : For instance
> : cloning, create a different method called "clone" or "copy",
Mmmm, that's not really what it does. Consider the case where you have
put some data into $lego. But I guess it could depend on how you define
"cloning". I would *not* say it copies.
Actually, calling it 'new' seems apt: it creates a new instance of
whatever the thing is. Which could be *extremely* useful; otherwise,
you really need new(), instance_new(), *and*
copy()/assign()/clone()/whatever(). The *worst* thing about it, it
seems to me, is that if you *depend* on it being defined that way, and
call it, and it's not, you get something weird. So maybe instance_new()
*is* the way...
------------------------------
Date: Fri, 29 May 1998 18:32:27 -0500
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: Advanced Perl Programming Book
Message-Id: <356F458B.9822D016@mindspring.com>
Denis DORR wrote:
>
> Andrew Johnson wrote:
> >
> > Christopher R. Redinger wrote:
> > !
> > ! Okay, I've searched the FAQ, I've read the groups, and I can't
> > ! seem to find the answer to this FAQ (at least around here). We've
> > ! got the "Camel Book," we've got the "Llama Book," heck we've even
> > ! got the "Hip Owls" book. The question of the month around here as
> > ! been, what the heck is on the cover of Advanced Perl Programming
> > ! by O'Reilly?? We've been calling it the "Puma Book." But, I'm not
> > ! too sure about the accuracy of that one. Any ideas?
>
> [ ... I had to cut some interesting stuff about panthers here because my
> newswriter complains about the bad original/quoted text ratio ...
>
> I have another related question. (hope it's not a FAQ ...)
> I didn't want to post it in this group because it has *nothing* to do
> with Perl, but :
>
> - it seems there is no comp.books.ora group,
> - some people here seem to be involved in some of those books,
> - now that the thread is open (and the ween-end comes), let's go :
>
> does anyone here know if there is a relationship between the animal on
> the cover and the contents of ORA books ? Why a Llama, a Camel, a
> panther (& soon a "mouflon" -sorry, I don't know the English word) for
> Perl ?
>
> I can't stand being ignorant of this ...
>
I feel there definitely is, to some degree and in some cases. Notice
how they reserve the *ugly* animals for Windows? A gecko for "Learning
Perl on Win32 Systems". Something really nasty (I forget what) for
"Windows NT Problems" or whatever.
------------------------------
Date: 29 May 1998 23:50:25 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Advanced Perl Programming Book
Message-Id: <6knhk1$c1g$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Denis DORR <dorr@cetrel.lu> writes:
:the cover and the contents of ORA books ? Why a Llama, a Camel, a
:panther (& soon a "mouflon" -sorry, I don't know the English word) for
:Perl ?
The Perl Cookbook shall indeed un mouflon carry--to be more precise,
a Rocky Moutain Bighorn Sheep (Gnat and I have these critters as
neighbors.) In short, it's a Ram Book. Connections between Perl and
camels, llamas, and bighorn sheep I leave to your imagination. I have
certainly entertained many such notions on my own.
--tom
--
All language designers are arrogant. Goes with the territory... :-)
--Larry Wall in <1991Jul13.010945.19157@netlabs.com
------------------------------
Date: Fri, 29 May 1998 22:23:33 GMT
From: sheely@misty.ca.boeing.com (Kevin Dee Sheely)
Subject: Anyone using JPL for development ?
Message-Id: <Etqov9.n3x@news.boeing.com>
Is anyone currently using JPL (java/perl) toolkit to do
any serious development ? We have acquired the Perl
Resource Kit from O'Reilly and got JPL installed on
Solaris 5.5.1 , but we are having problems getting some
of the examples to work. Please reply via e-mail. Thanks.
--
-----------------------------------------------------------------------
Kevin Sheely Boeing Shared Services
P.O. Box 3707 m/s 7M-HC
Seattle, WA. 98124-2207
sheely@misty.ca.boeing.com
-----------------------------------------------------------------------
------------------------------
Date: Fri, 29 May 1998 18:25:47 -0400
From: Agent Information Inquiry <agent@eg-web.com>
Subject: Apache 90 second time out
Message-Id: <356F35EB.7987@eg-web.com>
Please help. I have written a script that does some fairly heavy
database processing. To complete the processing (due to the size of
the task) will require over 3 minutes by the script. But there is one
problem which is summed up by the following note from my tech support:
"This script will not be able to run through a web browser because
Apache itself will time out if a request is not made within 90 seconds.
Apache's perl interpreter is designed to handle simple requests and
processes, and your script is actually doing a fairly complex
maintenance routine."
How can I have the script make some insignificant request to the server
every minute so that I can trick the server into letting the script
finish its processing?
Help is appreciated, and thank you in advance.
Ed
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
E & G Web Designer Directory - - - - - - A Designer For Every Need
http://eg-web.com ******* ******* *******
WDD Global Hosting Service - - - - - - - The Web Home Specialists
http://eg-web.com/wddglobal/global.html ******* ******* *******
WDD Banner Exchange - - - - - - - - - - One to One Display Ratio
http://eg-web.com/wddglobal/global.html ******* ******* *******
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: 30 May 1998 00:51:34 GMT
From: dha@panix.com (David Adler)
Subject: Re: Clearly define "free software"
Message-Id: <6knl6m$q8s@news1.panix.com>
On Wed, 27 May 1998 20:39:54 GMT, Chris Nandor <pudge@pobox.com> wrote:
>Yes, most of it is crap. So? Most music is crap, most movies are crap,
>most books are crap, most free software is crap (whatever your definition
>of free), and most pay software is crap. Get used to it.
Sturgeon's law: 90 percent of *everything* is crap.
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
All hail El Cabeza Del Oro!
------------------------------
Date: Fri, 29 May 1998 19:49:05 -0700
From: Kerem Yaman <kyaman@earthlink.net>
Subject: Re: cron job via perl ??
Message-Id: <356F73A1.FFB2D325@earthlink.net>
Thanks to everyone I got libwww installed all the "required" packages
and libwww, installed everything, and it works !!!!
I can grab webpages with one line of code.
What does not however work as advertised is the HTML::Parse package. It
seems like the docs are inconsistent with the package I got.
For exapmle:
SYNOPSIS
use HTML::Parse;
$h = parse_htmlfile("test.html");
print $h->dump;
$h = parse_html("<p>Some more <i>italic</i> text", $h);
$h->delete;
print parse_htmlfile("index.html")->as_HTML; # tidy up markup in a
file
So I tried it:
#!/usr/bin/perl
use LWP::Simple;
use HTML::Parse;
$h = parse_htmlfile("test.html");
print $h->dump;
$h = parse_html("<p>Some more <i>italic</i> text", $h);
$h->delete;
print parse_htmlfile("index.html")->as_HTML; # tidy up markup in a file
It results in:
[yaman@localhost myperl]$ ./foo3
Can't locate HTML/Parse.pm in @INC (@INC contains:
/usr/lib/perl5/i386-linux/5.00401 /usr/lib/perl5
/usr/lib/perl5/site_perl/i386-linux /usr/lib/perl5/site_perl .) at
./foo3 line 3.
BEGIN failed--compilation aborted at ./foo3 line 3.
It seems like the package is named HTML::Parser not Parse. So when I try
that (change HTML::Parse to HTML::Parser) I get:
[yaman@localhost myperl]$ ./foo3
Undefined subroutine &main::parse_htmlfile called at ./foo3 line 4.
I have been going around in circles for a while now.
I am running on RedHat 5.0 with perl5.00401. When I installed the
HTML-Parse package there were no dependency complaints from the
makefile, in fact there were no complaints at all during any of the
install processes. So not sure what the problem is. Been going around
in circles for a while now -- would appreciate a pointer if anyone has
one please :)) Thanks.
Kerem.
------------------------------
Date: Fri, 29 May 1998 21:58:07 GMT
From: todd_herr@sra.com
Subject: DBD:Oracle installation woes
Message-Id: <6knb1f$b6d$1@nnrp1.dejanews.com>
[A thousand pardons in advance if this is a FAQ or a stupid question; I've
got no news access at work (vice Deja News) so I can't look back through
the archives like I'd like to.]
I've got the following:
Solaris 2.5.1
Oracle 7.3.3 - NFS mounted directory
perl 5.004_04
DBI 0.90
DBD::Oracle 0.47
Building of all goes well, no problems with make test or make install of
perl and DBI. However, with DBD, make test fails on
t/plsql.............ld.so.1: oracle: fatal: libsunmath.so.1: can't open
file: errno=2
Now, I know errno 2 is "No such file", and I also know that libsunmath.so.1
is present, and readable, in $ORACLE_HOME/lib
Am I looking at a problem with DBD::Oracle, or might this be an Oracle
installation issue? Any clues?
Please go lightly on the flames; I'm kind of a perl newbie, but I want to
be able to use these modules instead of Pro*C for some CGI stuff, if
possible.
Thanks.
--
Todd Herr todd_herr@sra.com
Unix Systems Administrator, SRA International. http://www.sra.com
Will SysAdmin for Food
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 29 May 1998 18:31:31 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Don't Know how to decrypt using PERL
Message-Id: <6knd03$qj3$1@monet.op.net>
Keywords: cupidity hangout soot transvestite
In article <fl_aggie-2905981721540001@aggie.coaps.fsu.edu>,
I R A Aggie <fl_aggie@thepentagon.com> wrote:
>In which case, they have the on-line documentation for the library
>question...again, the problem isn't the documentation so much as
>people being unaware or too lazy of how to find the information...
Hello? Hello? Is this thing on?
Ah, thanks. No wonder. Now where's the volume knob?
AHEM.
THE ON-LINE DOCUMENTATION DOES NOT EXPLAIN THE PURPOSE OF THE SALT.
>Unless he doesn't have documentation available, in which case the
>complaints should be directed at the person responsible for not
>installing them.
THE ON-LINE DOCUMENTATION DOES NOT EXPLAIN THE PURPOSE OF THE SALT.
Larry already pointed this out.
------------------------------
Date: Fri, 29 May 1998 15:23:16 -0700
From: "matthew d. p. k. lanier" <lanier@shell6.ba.best.com>
Subject: duping from a reference
Message-Id: <Pine.BSF.3.96.980529152034.11124R-100000@shell6.ba.best.com>
hello all-
i'm having a difficulty duping STDERR to a ref to another filehandle.
according to my reading, this should work:
open (STDERR, ">&{ $self->{'ehandle'} })
it dies with "invalid argument. i know that $self->{'ehandle'} is a ref
to a file and it is open previous to the open call.
suggestions? where am i going wrong?
matt =)
........................................................
: matthew d. p. k. lanier : sf perl user's group :
: matt@lanier.org : sfpug-request@pootpoot.com :
: matt@saturn5.com : http://www.pm.org :
........................................................
------------------------------
Date: 29 May 1998 22:19:17 GMT
From: David Fetter <dfetter@shell4.ba.best.com>
Subject: Re: Email address checker - comments welcome
Message-Id: <6knc95$d5a$1@nntp1.ba.best.com>
In comp.lang.perl.misc Eli the Bearded <*@qz.to> wrote:
> brian d foy <comdog@computerdog.com> wrote:
>> mark666769@aol.com (Mark666769) posted:
>> >Submitted for your approval: yet another Email address
>> >checker from the twilight zone.
> I am thrilled already. Just what the world needs: more shady code.
>> >Any and all comments and improvements would be most welcome.
> "Abandon all hope ye who enter here." I'd quote Dante directly if I knew
> enough Italian.
The original from La Divina Comedia was "Lasciate ogne speranza, voi
ch'intrate." Seems fitting enough ];^)
>> ># Based on an Email checker from Matt's Script Archive,
>> that's the first clue that it won't work.
> It is getting close to "end of May 1998", when is the script section of
> CPAN likely to reopen?
Dunno.
For a real email validator, try the one in the Owl Book
(_Mastering_Regular_Expressions_) from O'Reilly. The O'Reilly site
(www.ora.com) probably has a pointer to it.
--
David Fetter 888 O'Farrell Street Apt E1205
shackle@ren.glaci.com San Francisco, CA 94109-7089 USA
http://www.best.com/~dfetter +1 415 567 2690 (voice)
print unpack ("u*",q+92G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R"@``+)
USA Today has come out with a new survey: Apparently three out of
four people make up 75 percent of the population.
David Letterman
------------------------------
Date: Fri, 29 May 1998 18:30:22 -0400
From: Christian Pearce <pearcec@fast.net>
Subject: Re: Email address checking
Message-Id: <356F36FE.45D6058B@fast.net>
Andy Lester wrote:
> The issue of semantics and "what is checking for validity" and so on is a
> time-honored\b\b\b\b\b\b\bloathed topic here in clpm, so I figure I should
> bring it up again.
What is checking for validity? Are you speaking philosophically or about
mechanics?
Philosophically what is validity? Checking to see if the email address
is on that exists somewhere or does it meet the constructs of what an email
address is. Jeffrey Friedl has a very good program for checking through a
valid email address. It will go as far as checking "Christian
Pearce" <pearcec@iuinc.com>. In most cases though we just want something
that can do pearcec-pearcec.pearcec@iu-iui.com. So we can use it when
sending out emails.
I undoubtedly believe this is no regex out there to check for the
validity of a ignorant user. Such as AOL people not understanding the
different between there environment and the internet. But I have seen and
used regex that check for validity of an email address. This is where it
comes done to giving people a proper response to there error. Understanding
who the audience is can benefit. If you know you have a lot of AOLer's make
sure you give a section saying click here if you are AOL and having trouble
entering in your email address. But the fact remains there is no perl module
that will make people read what they are looking at.
I don't know where this came from or what the original post was in reference
to. But it is friday and I am still at work.
> I guess it all boils down to the classic maxim of YMMV. So many newbies
> come in theinking that there's a pat solution to everything, and too many
> Grizzled Old Farts waiting to jump on them and say "No, you can't do it!"
> Not nearly enough analysis on ANYONE'S part.
>
Christian Pearce
------------------------------
Date: 30 May 1998 00:14:53 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Email address checking
Message-Id: <6knj1u$5pq$1@marina.cinenet.net>
Andy Lester (petdance@maxx.mc.net) wrote:
: The issue of semantics and "what is checking for validity" and so on is a
: time-honored\b\b\b\b\b\b\bloathed topic here in clpm, so I figure I should
: bring it up again.
:
: People come up with regexes, and TomC comes along and says "no, that won't
: work". I suggest that there are any number of valid solutions for
: sufficiently small values of "works".
[snip]
As I see it, the continuing debate comes down to the following:
What is a valid email address?
a) One that actually 'exists' (can be delivered to)
b) One that satisfies the relevant RFC
c) One that satisfies some simpler heuristic
The problem is that while these are in decreasing order of utility, they
are also in decreasing order of implementation complexity. Only (a) is a
really useful criterion for determining if an address is 'real' (you sent
mail there, they wrote back). (b) has a certain formal appeal, but is
fiendishly complex -- even Freidl's infamous 6k regex cheats by only
allowing one level of comment nesting. That's why most people end up
settling on (c).
Having decided to use a simpler heuristic, two other issues must be
addressed:
1. What are the acceptable rates of false positives and negatives?
The regex /\S/ will match all valid internet addresses -- and almost all
invalid ones, as well. It has an absurdly high false-positive rate.
Conversely, the regex /\w+\@\w+\.\w+/ will not match any invalid internet
addresses -- but it will also not match vast numbers of valid ones. It
has a high false-negative rate. Other regexes will produce both false
positives and false negatives. The designer or user of an email
validation heuristic needs to make a decision about which types and rates
of errors are acceptable, since zero of each cannot be achieved. Of
course, this decision depends strongly on...
2. How will the validation be used?
There are two possible approaches. One is to reject outright any address
that fails validation. This is suitable for validators with very low or
zero false-negative rates, or for (e.g.) robotically scanning the web or
usenet, gleaning email addresses.* The other is to present addresses
which fail validation to the user who entered them, or to an administrator
in some sort of to-be-resolved database, so that this human can determine
whether or not to change the address text. This is a highly suitable
approach for (e.g.) CGI-driven Web data gathering...asking "Are you sure
your address is 'foo bar@aol.com'? That space looks suspicious" is
friendlier than either accepting or rejecting the address silently.
I believe that if everyone keeps these parameters straight, the long
debate over whether email addresses can or should be validated may begin
to shed more light than heat. Of course, I may be a raving optimist. :)
===
* Note, this is just an example! I don't do this, or condone doing it.
It's just the first illustrative application that leapt to mind.
Honest!
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Fri, 29 May 1998 22:46:16 GMT
From: garyg@gator.net (Gary M. Greenberg)
Subject: Re: Have we got a good free Perl manual?
Message-Id: <YUGb1.45$XU2.102182@news.randori.com>
In article <6kjujv$b8t$3@news1.sol.no>, tina@tech.scandinaviaonline.se
wrote:
> In article <rfi1ztg3bhz.fsf@cathcart.sysc.pdx.edu>,
>
> > TMH> But perhaps I've gotten this wrong - the man-pages ain't as
> > TMH> free as Perl?
> >
> > perlfaq and perltoot are under a non-commercial and no-modify
> > licenses, respectively. Perl is under the Artistic/GPL license.
>
> My question does remain: how much do you pay for the man-pages that,
> the first time I looked (1993) and the last time I looked (1998) came
> with Perl ?
>
> Anyone ?
I can be an anyone (even though only a perl neophyte); they be FREE!
And, if anyone doesn't like reading manpages on line, here is a
cheesy but FREE little Csh (forgive me) man2text converter:
foreach i (`man perl | grep '^[ ][ ]*perl' | awk '{print $1}' | uniq`)
(man $i | col -b > $i.txt && crush.pl $i )
end
where (of course), crush.pl is:
#!/usr/bin/perl -w -i
$cnt = 0;
while (<>) {
if ($cnt == 0 && /^$/) {
print;
$cnt = 1;
} else {
if (! /^$/) {
print;
$cnt = 0;
}
}
}
Hey, I said I was a neophyte, okay. Anyway, the manpages can then be
printed as plain files quite easily from the above. And FREE (ignoring
costs of paper, toner, and environmental impacts).
Regards y'all,
g-
gary -=- The C Programmers' Reference -=-
http://www.gator.net/~garyg/C/c.html
-=- Avenue Programmers' Classes' Requests -=-
http://www.gator.net/~garyg/class.htm
------------------------------
Date: Fri, 29 May 1998 23:08:11 GMT
From: garyg@gator.net (Gary M. Greenberg)
Subject: Re: Have we got a good free Perl manual?
Message-Id: <vdHb1.55$XU2.167955@news.randori.com>
In article <sd7k975zvek.fsf@mescaline.gnu.org>, rms@gnu.org wrote:
> [I first tried to post this on Saturday May 23 but it did not get through.
> Paul Fisher posted it for me on Monday, but there is doubt that it was
> noticed, since it did not come from me or gnu.org.]
>
> Once upon a time, I thought I would learn Perl. I got a copy of a
> free manual, but I found it simply unreadable, and gave up. Perl
> users told me that there were better manuals, but they were not free.
>
> Why was this? Their authors had sold the manuals to O'Reilly, instead
> of contributing them to the free software community. It wasn't the
The C Programming Language (K & R II) is not free. I used it to learn C.
In it's time that was the norm but the authors are our contemporaries
yet one would not expect them to convert K&R II to a free manual.
The manuals for perl are the many manpages; they are rather good. The
two books -- the Camel and Llama are, imho, add-ons written by
experienced perl programmers (hopefully, I ain't the only one who sees
an analogy between K&R II's authors && the authors for the C&L books).
> first time and (to our community's great loss) it was far from the
> last. O'Reilly and other publishers have enticed a great many authors
> to withhold their manuals since then.
^^^^^^^^^^^^^^^
Interesting perception; they produced freely available software, source
code, and documentation (manpages). Yet, when they produce and sell a
better documentation (Camel and Llama) that becomes onerous (the tone
you seem to infer upon the authors and publisher). I deeply respect what
you have done for the programming community, but I also see the
reasonableness in the authors and publisher's (O'Reilly) actions.
[remainder trimmed]
> Copyright 1998 Richard Stallman
> Verbatim copying and distribution is permitted in any medium
> provided this notice is preserved.
Respectfully,
Gary M. Greenberg /* the Sorcerer's Apprentice */
gary -=- The C Programmers' Reference -=-
http://www.gator.net/~garyg/C/c.html
-=- Avenue Programmers' Classes' Requests -=-
http://www.gator.net/~garyg/class.htm
------------------------------
Date: 29 May 1998 22:17:02 GMT
From: benny_profane@hotmail.com
Subject: Help needed determining IP address on Windows NT
Message-Id: <6knc4u$6ud$1@news.bc>
Hello.
I need to write a script that gets the IP address of the gateway device on
a Windows NT box. Using the following code from the Monolith::DynDNS
module, everything works fine under Linux and I get the correct IP, but
under Windows NT I get an IP address of 0.0.0.0.
$raddr = sockaddr_in(80, '1.1.1.1');
socket($socket, PF_INET, SOCK_DGRAM, getprotobyname('udp'))
or die "Unable to create socket: $!";
connect($socket, $raddr)
or die "Unable to connect: $!";
$ip = inet_ntoa ((unpack_sockaddr_in(getsockname($socket)))[1]);
close $socket;
Why doesn't this work under NT? What can I do to achieve the same result,
or where can I look for more information?
The version of perl being used under NT is 5.003_07 by ActiveWare.
Thanks.
------------------------------
Date: Fri, 29 May 1998 17:03:52 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: How to read AND write to a programm?
Message-Id: <8cbnk6.lan.ln@localhost>
Mark Seuffert (captain@NOSPAM.pirate.de) wrote:
: Larry Rosler wrote:
: > Look for `` (backquotes) or qx() in the Perl documentation.
: This is what I usually do. But how do I give the programm
: some more lines when it is started... that was my question.
: So I execute the programm, but then it wants some input lines.
: These lines are seperated with newlines... how to write this in
: perl?
: `program\nextraline1\nextraline2` ???
@out = `program <<ENDLINES
extraline1
extraline2
ENDLINES
`;
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 30 May 1998 02:01:22 +0200
From: Ulf Wendel <ulf.wendel@kiel.netsurf.de>
Subject: Install: Sorry, but how to install a module?
Message-Id: <356F4C52.982ECC26@kiel.netsurf.de>
Hi!
I'm using the latest ActiveState Perl Version on WinNT. And I'm not able
to install a module :((. Makefile.pl doesn't work.
In only one FAQ I found a notice on it that said: "Since MakeMaker
hasn't been ported to Perl for Win32, you'll usually have to move the
module files to the Lib directory yourself. Remember to maintain
sub-directory trees. "
So I did but: ha, ha - funny. Can anyone tell me what I have to do with
the "t" subdirectory of any modulename.tar?
Thanks!
Ulf Wendel
<ulf.wendel@kiel.netsurf.de>
------------------------------
Date: Fri, 29 May 1998 16:44:23 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: perlish idiom for substitute in many files, only when pattern found
Message-Id: <n7ank6.d2n.ln@localhost>
Michael Friendly (friendly@hotspur.psych.yorku.ca) wrote:
: I often use
: perl -pi~ -e s/old/new/ *
: To make global changes in all files in a directory, but this changes
: all the time stamps, even if the /old/ re is not found.
: Is there an easy way to make perl revert the ~ file to the original
: if no changes are made? Or, how to pipe the list of files (say, from
: grep) to perl?
perl -pi~ -e s/old/new/ `grep -l old *` # backticks
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 29 May 1998 21:49:56 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Problem with multiple file access's
Message-Id: <6knai4$a6d@fridge.shore.net>
Justin Hardman <Justin.Hardman@bbs.hkis.edu.hk> wrote:
: I have a problem with a database program that will be storing simple text
: data. The file will both be read from and written to. How can I overcome
: problems with more than one person writing to the file at the same time?
: Will there be any problems
You need to lock the file to prevent two people from writing to it at the
same time. Randal Schwarz has an excellent WebTechniques column dealing
with this issue. His columns are at
http://www.stonehenge.com/merlyn/WebTechniques/
Look for the one that discusses hit counts and the flock function.
--Art
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.ziplink.net/~upsetter/ska/calendar.html
--------------------------------------------------------------------------
------------------------------
Date: Fri, 29 May 1998 16:41:54 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Q: How to read AND write to a programm?
Message-Id: <23ank6.d2n.ln@localhost>
Mark Seuffert (captain@NOSPAM.pirate.de) wrote:
: sure I can write to programm, for example to 'sendmail' to send mails.
: But now I have the problem, that I want also read what the programm
: writes back to STDOUT... what I wanna do:
: I want to execute this programm:
: /usr/local/bin/nc 194.1.2.3 9000
: then I write the following lines
: EXEC SELECT Name,Email FROM ADRESSEN
: END
: and now I wanna read what the programm writes to STDOUT
Is the answer given for this Frequently Asked Question not
working for you?
perlfaq8:
"How can I open a pipe both to and from a command?"
: Thanks for some code or help! :)
Uh huh.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 30 May 1998 01:52:56 +0200
From: Michael <mhoereth@rz-online.de>
Subject: Re: Q: How to read AND write to a programm?
Message-Id: <356F4A58.8E097242@rz-online.de>
Nearly the same question:
How can I execute a program within a Pearl Script.
For example "prog.exe -a -b"
What need I to write in the Pearl Script ?
Thanks for any suggestions (e-mail Reply welcome)
------------------------------
Date: Fri, 29 May 1998 23:26:36 GMT
From: heiby_u@falkor.chi.il.us (Ron Heiby)
Subject: Re: Rand on NT perl
Message-Id: <356feb4e.9878070@149.174.211.108>
Ala Qumsieh <aqumsieh@matrox.com> wrote:
>I also heard, from reliable sources, that with the
>upcoming new version of perl, an srand is not needed anymore
This concerns me. Sometimes, it is useful to be able to have a repeatable
series of "random" numbers. I hope that such capability would be maintained.
--
Ron.
------------------------------
Date: Fri, 29 May 1998 11:42:33 GMT
From: Robert.Webb@yeg.dot.co.dot.uk (Robert Webb)
Subject: Re: renaming files under NT
Message-Id: <356e9e7e.870649287@gate.itt.yeg.co.uk>
I disagree, Brent. Perl under NT does look in the current directory
for a file. Here's a couple of lines from a script (that works !) on
an NT4 server -
unlink "0siteadmin.txt";
rename "1siteadmin.txt","0siteadmin.txt";
However, NT/Perl assumes the default directory is the directory the
scripts are running in! (in this case /CGI-BIN )
HTH
Rob W
(wot ? No sig?)
========
On Fri, 22 May 1998 15:58:50 GMT, Brent Michalski <perlguy@inlink.com>
wrote:
>You need to put the FULL PATH information, including the drive letter,
>in the rename function. NT doesn't seem smart enought to look in the
>current directory for a file.
>
>HTH,
>
>Brent
------------------------------
Date: 29 May 1998 20:56:13 GMT
From: arch@abts.net (Shaun Sides)
Subject: seek advice on simple first program
Message-Id: <slrn6mu2la.2vd.arch@abts.net>
Yay. I've managed to actually write a useful little program in Perl.
;-) All it does is doublespace a file. I have a couple of ideas for
some other simple things I can try my hand at, too. So, what I'd like
to know is just how inefficient my algorithm is, brief advice on same,
and that sort of thing. Hell, if someone wants to show me a totally
obfuscated version of it, go ahead! ;-) I'm sure I'd learn something
from it.
#!/usr/bin/perl -w
# ds.pl --> Double-space
# Program to take single spaced text files and add an
# extra \n to the end of each line.
# usage: ds <filename1> <filename1> <...> <filenamen>
foreach $file (@ARGV) {
open FILE, $file || die "Can't open $file $!";
while (<FILE>) {
s/(.\n)$/$1\n/;
s/^\n$/\n\n/;
push @file, $_;
}
close FILE || die "Can't close $file $!";
open FILE, ">$file" || die "Can't open $file for write $!";
print FILE @file;
undef @file;
}
# EOF ds.pl
I see that loading the whole file into an array could cause some barfing
if the size were significant. I thought about trying to use $^I, but
figured that I can modify it that way later on. Or even come up with a
better way.
--
==============================================================================
Shaun L. Sides | Hey! CyberGold | arch@abts.net
Free Randal Schwartz and Ric Flair! | wastes yer time | arch@sara.mmlc.nwu.edu
==============================================================================
The time for desperation is upon us. Let's play.
First Wizard Zeddicus Zu'l Zorander
==============================================================================
------------------------------
Date: Fri, 29 May 1998 11:46:55 GMT
From: Robert.Webb@yeg.dot.co.dot.uk (Robert Webb)
Subject: Sockets and E-mail
Message-Id: <356e9f9b.870934537@gate.itt.yeg.co.uk>
I wonder if anyone can point me in the directin of info/docs/examples
of Perl scripts that send e-mails, preferably by opening a socket to
an SMTP mail server. This is on an NT box, by the way.
All (reasonably polite) suggestions gratefully accepted :-)
Rob W.
------------------------------
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 2764
**************************************