[6861] in Perl-Users-Digest
Perl-Users Digest, Issue: 486 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 16 05:04:05 1997
Date: Fri, 16 May 97 02:00:29 -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, 16 May 1997 Volume: 8 Number: 486
Today's topics:
alternatives in reg exp -- is this by design? (Bart Lateur)
Re: Baffled (Tad McClellan)
Cross Platform CGI Programmer Needed (Secure-Bank.Com Real Time Processing Solutions)
Re: Cross Platform CGI Programmer Needed (brian d foy)
Re: don't read this if your time is of any value (Eric Bohlman)
Envirnmt. Var Probs silver@silverbergcom.com
Re: File Locking (Lutz Albers)
FreeNetAccessWorldwide (Inter-BBS)
FreeNetAccessWorldwide (Inter-BBS)
Re: How to put an normal array into an associative one (Tim Gim Yee)
Re: idea for new for loop construct (Zach Baker)
MacPerl & Applescript (John Moreno)
perl, simple syntax problems <malcha_s@informatik.fh-hamburg.de>
Private area using Perl/CGI <ketilf@ifi.uio.no>
Q: local in list contex? (Jonathan C. Willeke)
Re: regrex question - really basic! <usenet-tag@qz.little-neck.ny.us>
Re: regrex question - really basic! <rfi@uebemc.siemens.de>
removing a line <marv@dwave.net>
Re: removing a line <dbenhur@egames.com>
Re: Rounding Off (Chipmunk)
search perl doku <malcha_s@informatik.fh-hamburg.de>
Second attempt at problem (getting dynamic libraries to <jbosch@tid.cdscc.nasa.gov>
Seeding SRAND on WIN32 <banyai@llnl.gov>
Re: Stuck with filehandling :-( (Chipmunk)
Re: winnuke <jeremy@exit109.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 16 May 1997 08:54:31 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: alternatives in reg exp -- is this by design?
Message-Id: <337c1d9c.1407562@news.tornado.be>
In pattern matching with alternatives, Perl shows a behaviour that is
very useful at times, but I haven't seen this documented in the PODs.
So: is this a nice accident, that could possibly change in the future,
or is this by design?
When Perl tries matching alternatives separated with "|", these are
tried out from left to right. So, if more than one of the alternatives
would match, Perl takes out the leftmost matching pattern.
I actually would like this to be part of the specification, so it should
be:
1) documented in the POD's
2) garanteed to work in future versions of Perl
Here's a sample of what I mean. This shows a way to handle line
terminators in text files of *any* platform that uses ASCII: PC, Mac
and Unix (and hopefully a few others as well):
# $buffer = entire file
@lines = split(/\015\012|\012|\015/,$buffer);
Since the alternatives are tested out from left to right, "\015\012" is
tried out first.
Test it out for yourself:
$_ = "This is line one.\015".
"This is line two.\012".
"This is the third.\015\012".
"This is line four.";
$\="\n";
print "Right:";
@ary=split(/\015\012|\015|\012/);
foreach(@ary) {
tr/\015\012/;:/; #easier to spot
print "\"$_\"";
}
print "Wrong:";
@ary=split(/\015|\012|\015\012/);
foreach(@ary) {
tr/\015\012/;:/;
print "\"$_\"";
}
Have I missed it? *Is* it in the docs? Can I trust this to keep working?
Gent (Ghent, Gand),
Belgium,
Europe,
3rd planet from the sun.
------------------------------
Date: Thu, 15 May 1997 23:27:48 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Baffled
Message-Id: <4ongl5.hj2.ln@localhost>
RMO (isainfoserv@mindspring.com) wrote:
: I'm stuck. Below is the core of a script that accepts info ($keys)
: typed into a html form. The below sub routine searches a quote, tab
: delimted text database (pilotrmo.tab) for the persons/items in the
: database that matches all items (items defined as separated by spaces)
: in $keys. I.E. I type 'John Doe' in my form and the script returns
: all listings that contain 'John' and 'Doe'. My quandry is that if
: you enter 'Doe John' (out of order as compared to the database), it
: doesn't find the listing. What am I doing wrong?
^^^^^^^^^^^^^^^^^^^^^
Short version: using m//gi when you want to be using m//g
>From the perlop man page:
-------------------------------
In a scalar context, C<m//g> iterates through the string, returning TRUE
each time it matches, and FALSE when it eventually runs out of
matches. (In other words, it remembers where it left off last time and
...
-------------------------------
So, it returns false when it gets to the end of the string...
: Thanks in advance,
You're welcome.
: Please send any responses to roverton@isa.org
Please read any responses in the newsgroup where you posted the question.
Long version: This code needs a serious amount of fixing...
[
Some of these are nitpiks, ignore them if you like ;-)
Some are just bad style (eg. they make it hard to understand your own
code after you haven't seen it for a while)
Several are hours of debugging waiting to happen. Defensive
programming will pay back the time spent doing it in short order...
]
: sub SEARCH_FOR_MATCH {
: @search_key = split(/\x20/,$keys);
^^^^ ^^^^^
^^^^ ^^^^^
Is there some reason for obfuscating what you're splitting on?
Why not use a space character for a space character? split(/ /, ...)
You're not really writing a subroutine that operates on global
data ($keys) are you? That would be very bad programming practice.
You should also make ALL of your subroutine variables scoped to
only within the subroutine (ie. use my()).
So the line above would be Oh So Much Better (and save hours of
debugging later when you use $keys or @search_key somewhere else
in your code) like this:
my @search_key = split(/ /, $_[0]);
then invoke it with an argument: SEARCH_FOR_MATCH($keys);
: $k =0;
my $k = 0;
: open(MYFILE,"pilotrmo.tab");
Ack! What will your script do if pilotrmo.tab cannot be opened?
Will it continue on and produce confusing output (maybe no output
would be interpreted as "not found" when the database was never
even searched!) , or will it stop with a helpful message about
not being able to open the file?
Always check return values.
Always check return values.
Always check return values.
open(MYFILE,"pilotrmo.tab") || die "could not open 'pilotrmo.tab' $!";
Also, if you are doing a lot of searches and the database is not
very large, you may want to do the disk I/O only once and read it
into an array ahead of time for the subroutine to use whenever
called. (could be lots faster)
: while(<MYFILE>) {
: $l=0;
my $l = 0;
: $_ =~ s/\"//g;
^
Double quote is not special here. You don't need to escape it:
$_ =~ s/"//g;
But, for TRanslating characters, tr/// is much faster than s///
tr/"//;
: $wholeline=$_;
You can combine the above two lines if you like:
(my $wholeline = $_) =~ tr/"//; # $wholeline should NOT be global...
Though I don't see why you need to copy it to another variable anyway.
Why not just operate on $_ ?
: ($last, $first, $work, $home, $fax, $email) = split(/\t/,$_);
: $found = "yes";
^^^^^
The usual approach for setting flags in Perl is to use 0, '' or undef
for false, and anything else for true.
(I usually just go with 0=false and 1=true)
my $found ....
: foreach (@search_key) {
: if ($wholeline =~ m/$search_key[$l]/gi) {
: } else {
: $found = "no";
: }
: $l++;
: }
Why bother with keeping track of the subscript? Are you going to use
it for something elsewhere?
You can rewrite the whole loop above as:
foreach $search_key (@search_key) {
$found = "no" unless $wholeline =~ m/$search_key/gi;
}
( 'course now you know that you don't really want the 'g' in there...)
or at least like this:
foreach (@search_key) {
if ($wholeline !~ m/$search_key[$l]/gi) { # use !~ for "does not match"
$found = "no";
}
}
: if ( $found eq "yes") {
: if ($k > 999) {
: next;
: }
: $k = $k + 1;
: print "<TR>";
: print "<TD ALIGN=\x22center\x22>", $first, "</TD>\n";
: print "<TD ALIGN=\x22center\x22>", $last, "</TD>\n";
: print "<TD ALIGN=\x22center\x22>", $home, "</TD>\n";
: print "<TD ALIGN=\x22center\x22>", $work, "</TD>\n";
: print "<TD ALIGN=\x22center\x22>", $fax, "</TD>\n";
: print "<TD ALIGN=\x22center\x22>", "<A HREF=\x22MAILTO:",$email,
: "\x22>", $email, "</A></TD>\n";
: print "<TR>\n";
: }
: }
: }
So, rolling all of that together, I would have come up with something like:
-------------------------------
#! /usr/bin/perl -w
$keys = "Robert Overton";
search_for_match($keys);
sub search_for_match {
my @search_key = split(/ /, $_[0]);
while(<DATA>) {
tr/"//; # delete double quotes
my $found = 1;
foreach $search_key (@search_key) {
$found = 0 unless /$search_key/i;
}
if ( $found ) {
print "found it ($_[0])\n";
}
}
}
__DATA__
Overton Robert bigBuilding suburbs faxnum isainfoserv@mindspring.com
-------------------------------
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Fri, 16 May 1997 00:50:17 GMT
From: admin@secure-bank.com (Secure-Bank.Com Real Time Processing Solutions)
Subject: Cross Platform CGI Programmer Needed
Message-Id: <337baf3f.395620584@news.atlantic.net>
Dear Programmers;
Please excuse our intrusion into your Newsgroup. This letter is not
SPAM, but rather a genuine post for an employment opportunity.
Secure-Bank.Com Online Real Time Transaction Processing Solutions is
looking for an experienced Cross-Platform CGI Programmer to assist in
the development, integration, and maintenance of some additional
cgi-software we are developing.
Qualified individuals need not have a Computer Science degree although
it is preferred. Qualified individuals should posses strong knowledge
of c/c++, perl, and other cgi-bin scripting languages, basic
understanding of web servers and how they operate with access
authentication and .htaccess files, and have experience with a variety
of unix flavors. Additional knowledge in the following is not
required but is helpful; visual basic, win-cgi scripting, active-x,
java, and windows servers with API extension development.
We will consider any and all individuals. Although we would prefer
someone who resides in the Greater Tampa Bay Area, we have no qualms
about hiring an individual who possesses strong work ethics and may
telecommute.
Anyone who would like to apply should E-mail their resume to:
admin@secure-bank.com
or Fax their resume to: (813) 562-0107
As well, if you would like more information, please call:
(813) 562-0009 and ask for Mr. Cannon
For more information about what secure-bank.com does, and to see the
types of software we develop, please see our website.
http://www.secure-bank.com/
Thank You
Secure-Bank Administration Team
admin@secure-bank.com
------------------------------
Date: Fri, 16 May 1997 02:23:57 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Cross Platform CGI Programmer Needed
Message-Id: <comdog-1605970223570001@nntp.netcruiser>
In article <337baf3f.395620584@news.atlantic.net>, admin@secure-bank.com wrote:
> Dear Programmers;
>
> Please excuse our intrusion into your Newsgroup. This letter is not
> SPAM, but rather a genuine post for an employment opportunity.
CGI programmers are down the hall to the left in
comp.infosystems.www.authoring.cgi
> Secure-Bank.Com Online Real Time Transaction Processing Solutions is
> looking for an experienced Cross-Platform CGI Programmer to assist in
cross platform CGI? hmmm... data are data. (i think i smell IIS.)
--
brian d foy <URL:http://computerdog.com>
unsolicited commercial email is not appreciated
------------------------------
Date: Fri, 16 May 1997 03:54:29 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: don't read this if your time is of any value
Message-Id: <ebohlmanEA99It.E33@netcom.com>
ephidryn hydrochloride (ephidryn@ix.netcom.com) wrote:
: im just learning perl but a task came to me already.
: ris it possible to get HTML documents from every link
: an HTML page. Kinda like a tree effect |
It certainly is, with the help of a couple modules you can find on CPAN.
LWP is the one you'll want to use for actually retrieving the documents;
the one for finding the links in the documents is something like
HTML::Parse, but just search the module list for "html" and you'll find
the right name.
------------------------------
Date: Thu, 15 May 1997 22:25:20 +0100
From: silver@silverbergcom.com
Subject: Envirnmt. Var Probs
Message-Id: <337B7F2C.530E@silverbergcom.com>
Is it possible to get the referrer page ($ENV{'HTTP_REFERER'}) without
using a perl script called by Server Side includes? I am trying to make
the following code work when it is placed inside a page as an image:
###code up here ###
if ($query_string eq "index") {
open (REF, ">>$referrer_log_file");
print REF "$ENV{'HTTP_REFERER'}\n";
close (REF);
}
###code continues###
The image tag looks like:
<IMG SRC="http://www.silverbergcom.com/cgi-bin/logger.pl?index>
The script won't log the real referrer page that went to index.html, but
instead will log the referrer as index.html. But when I use a similar
script with SSI, it works fine. Is there anything special I should know
about this environment variable? Anybodys' help would be much
appreciated.
Thanks,
Eric Silverberg
------------------------------
Date: Wed, 14 May 1997 11:42:58 +0200
From: lutz@muc.de (Lutz Albers)
Subject: Re: File Locking
Message-Id: <lutz-ya023480001405971142580001@news>
In article <33748513.1F2D@cais.com>, Dorothy Firsching <firschng@cais.com>
wrote:
>Flock does not appear to work on my system. What can I do to handle
>file locking? My ISP provides perl 5.001 under SunOS 5.4.
>
>Thanks for your suggestions on where I may look for code to implement
>this!
Get your ISP to upgrade perl5 to the latest version. I think that
flock-support for Solaris was added in version 5.003. BTW, 5.001 is waaay
outdated ...
ciao
lutz
--
Lutz Albers, lutz@muc.de, pgp key available by request
Do not take life too seriously, you will never get out of it alive.
------------------------------
Date: Wed, 14 May 1997 22:12:38 GMT
From: interbbs@hotmail.com (Inter-BBS)
Subject: FreeNetAccessWorldwide
Message-Id: <337a386f.1844436@bang-olufsen.dk>
Free internet connection worldwide via our BBS.
Please visit as much as possible our sponsor pages,
its how we are paid...
Follow the link and enjoy...
http://www.cybercity.hko.net/LA/interbbs/index.htm
aababcabcd1121231234
------------------------------
Date: Thu, 15 May 1997 15:50:41 GMT
From: interbbs@hotmail.com (Inter-BBS)
Subject: FreeNetAccessWorldwide
Message-Id: <337b300e.2466242@bang-olufsen.dk>
Free internet connection worldwide via our BBS.
Please visit as much as possible our sponsor pages,
its how we are paid...
Follow the link and enjoy...
http://www.cybercity.hko.net/LA/interbbs/index.htm
aababcabcd1121231234
------------------------------
Date: Fri, 16 May 1997 05:52:09 GMT
From: tgy@chocobo.org (Tim Gim Yee)
Subject: Re: How to put an normal array into an associative one
Message-Id: <337bf202.30634389@news.oz.net>
On Thu, 15 May 1997 17:10:34 -0400, Pascal Houde
<houde@fox.cisti.nrc.ca> wrote:
>That's what I want to do:
>$a{'array1'} = @somearray;
>
>Actually, it puts the number of element of @somearray into $a{'array1'}.
>
>I want perhaps the array itself to be put instead.
>
>I found a way to do it but I think it's not clean!
>$a{'array'} = \@somearray;
>later...
>@getbackthearray = @{$a{'array'}}
>
>The problem is that @somearray is a LOCAL array returned by a
>subroutine.
>$a{'array'} = &returnAnArray(param); # @somearray is used only whitin
>that subr.
>So what happen after the exit of the subroutine. Does the space memory
>of @somearray deallocated?
>In other words: Do perl will use that memory space to allocate other
>things in it?
>If so my \@ trick won't work or I may get wrong data!
Sure it will. You just need an intermediate step:
@temp = &returnAnArray($param);
$a{'array'} = \@temp;
Or you can use an anonymous array reference:
$a{'array'} = [&returnAnArray($param)];
Or, instead of returning an array from your subroutine, return a
reference to that array:
sub returnAnArrayRef {
my $param = shift;
my @array;
# do stuff
# do stuff
# do more stuff
return \@array;
}
$a{'array'} = &returnAnArrayRef($param);
-- Tim Gim Yee tgy@chocobo.org
http://www.dragonfire.net/~tgy/moogle.html
"Will hack perl for a moogle stuffy, kupo!"
------------------------------
Date: 16 May 1997 03:47:26 GMT
From: zbaker@venom.st.hmc.edu (Zach Baker)
Subject: Re: idea for new for loop construct
Message-Id: <5lglce$98f$1@cinenews.claremont.edu>
In article <Pine.LNX.3.95.970514143652.23054C-100000@ssil.uoregon.edu>,
Trenton Lipscomb <trenton@ssil.uoregon.edu> wrote:
>I've been using Perl for over two years now, and have become a big fan
>of the language. I admire its intuitive constructs, such as for and
>foreach loops, such as:
> for(1 .. 5){
> print $_;
> print "\n";
> }
>or:
> $count = 4;
> for $it (1 .. $count){
> print $it;
> }
>
>However, there is a construct that seems natural to me, but is not
>recognized by the interpreter. It is:
> for(4 x){
> print $_;
> print "\n";
> }
>and, similiarly:
> for $it (4 x){
> print $it;
> }
>where $it would be assigned the value of the current iteration of the
>loop.
First, I apologize for the large quotation. I don't find "4 x" to be
intuitive. Not as much as either "0..3" or "1..4" certainly. If you
wanted "4 x" to replace one of those two, undoubtedly some would want
the other as well. If you want to count iterations, you want to use
real data (like an array or a scalar) with real values. The way that
perl does this, "0..3" (or "1..4" etc.), is all that I've ever wanted
(well, in a list-based loop construct anyway).
---
Zach Baker <zbaker@venom.st.hmc.edu>
"But who cares about 30 different versions of Pong?"
------------------------------
Date: Thu, 15 May 1997 23:26:58 -0400
From: phenix@interpath.com (John Moreno)
Subject: MacPerl & Applescript
Message-Id: <199705152326581462334@roxboro-168.interpath.net>
Does anybody know how to get a perl variable passed along to
AppleScript?
I'm trying to get applescript to pass along a url that I created with
MacPerl to cyberdog
As a test I've been trying this:
$args = "Internet Using Freeppp";
MacPerl::DoAppleScript qq{
tell application "Script Editor"
choose file with prompt $args
end tell
}
Can it be done?
--
John Moreno
------------------------------
Date: Fri, 16 May 1997 07:30:41 +0200
From: ms <malcha_s@informatik.fh-hamburg.de>
Subject: perl, simple syntax problems
Message-Id: <337BF101.2362F94B@informatik.fh-hamburg.de>
Hi,
I have some problems with the syntax about perl:
1. How can I handle arguments in sub's:
sub foo() {
($A , $B) = @_;
}
foo("aaa", "bbb"); #It works
foo(@S, @T); #It doesn't work. I get always one argument.
2. How can I declare local variables:
sub foo() {
local $A; # ????
$B = "test" # Is $B a global variable ?
}
3. How can I replace a "\n" with a " " ?
$A =~ /???/"abc\ndef";
4. How can I find "abc" in a string?
$A =~ /abc/ "123abc456";
$A =~ /abc/ "123 abc 456";
5. How can I avoid an runtime or compile error like that:
$A = eval "0 || 1" # no error
$B = eval "1z && 1" # error, because z is wrong
Who know solutions ?
Thanks
Sven
==============================================
Sven malcha_s@informatik.fh-hamburg.de
==============================================
------------------------------
Date: Tue, 13 May 1997 22:18:14 +0200
From: Ketil Froyn <ketilf@ifi.uio.no>
Subject: Private area using Perl/CGI
Message-Id: <3378CC86.4499@ifi.uio.no>
Does anyone know how to make a section of web-pages that needs a
password to access? If so, would you like to share your knowledge with
me? :)
Ketil
------------------------------
Date: Fri, 16 May 1997 07:06:43 GMT
From: jwilleke@ix.netcom.com (Jonathan C. Willeke)
Subject: Q: local in list contex?
Message-Id: <337c04bb.13809934@nntp.ix.netcom.com>
Consider the following Perl code fragment:
local @list = ( 0, 1, 2, 3 );
local @array[@list] = ( "I'm", "just", "a", "bill" );
print "@array\n";
Here's the output:
I'm
If I change the third line to
local( @array[@list] ) = ( "I'm", "just", "a", "bill" );
then I get what I expect:
I'm just a bill
Why do I need to surround
local @array[@list] = ...
with parens, but not
local @list = ...
? Does the Perl interpreter not understand that the array slice is a
list? Thanks in advance for responses.
--Jon
Jon Willeke <jwilleke@ix.netcom.com>
------------------------------
Date: 15 May 1997 23:40:40 -0400
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: regrex question - really basic!
Message-Id: <5lgkvo$p89@alpha.NetUSA.Net>
phenix@interpath.com (John Moreno) writes:
>I am trying to do a extract a email address out of a string using a
>regular expression.
Dangerous proposition. Have *you* read RFC822?
>I'm using [^ <]+@[^ \r,>]+ which works as a regular expression. The
>problem is getting this into a perl statement.
You can put that in a perl statement like thus:
$line =~ m/([^ <]+@[^ \r,>]+)/ && $address=$1;
It will extract the first match in line and put it in $address.
(If there was no match $address retains its previous value.)
There is more than one way to do this. :^)
You, unlike me, apparently have never received mail with a space
in the localpart. I even sent one such today to the SA here pointing
out that the MTA seems to handle it in a buggy way.
If you can convince your mailer to send it (good luck with that)
<"jjj jjj"@qz.little-neck.ny.us> is a valid address for me. This
is rather esoteric, I will conceed, and your regexp will work better
than many I have seen brandied about because it is overly generous
in accepting matches.
I would probably use
m/(?:^|[<\s])([^@>]+@[a-z0-9.-]+)(?:[\s,>]|$)/i
And hope for no (comments) in the host or and no @ or > in the local
part. These are reasonable assumptions for the *vast* majority of
addresses.
Elijah
------
trying out nn for a change and not happy so far
------------------------------
Date: 16 May 1997 08:27:59 +0200
From: Ronald Fischer <rfi@uebemc.siemens.de>
To: phenix@interpath.com (John Moreno)
Subject: Re: regrex question - really basic!
Message-Id: <xz2g1vovsls.fsf@uebemc.siemens.de>
>>>>> On Thu, 15 May 1997 18:37:57 -0400
>>>>> "John" == John Moreno <phenix@interpath.com> wrote:
John> I am trying to do a extract a email address out of a string using a
John> regular expression.
John>
John> I'm using [^ <]+@[^ \r,>]+ which works as a regular expression. The
John> problem is getting this into a perl statement.
Not sure if I understand your problem, but, provided the regexp is
correct, and the string to be parsed is in $s, and the result should
be put into $r, you could always write something like this:
$s =~ /(YourRegexpGoesHere)/ and $r=$1;
$1 corresponds to the regexp in the first pair of parentheses.
--
Ronald Otto Valentin Fischer (PGP public key available on request)
business: ronald.fischer@uebemc.siemens.de
private: ronald.fischer@acm.org
http://ourworld.compuserve.com/homepages/ronald_fischer/
------------------------------
Date: Thu, 15 May 1997 23:29:28 -0500
From: "Marvin Malkowski Jr." <marv@dwave.net>
Subject: removing a line
Message-Id: <337BE2A8.AEDFE3D9@dwave.net>
Hi,
I am trying to remove lines that are above with "On since" from a
variable. The variable contains an entire file, btw.Any ideas..
Can you please email me back at marv@dwave.net?
Thanks
------------------------------
Date: Fri, 16 May 1997 00:37:50 -0700
From: Devin Ben-Hur <dbenhur@egames.com>
To: marv@dwave.net
Subject: Re: removing a line
Message-Id: <337C0ECE.3541@egames.com>
Marvin Malkowski Jr. wrote:
> I am trying to remove lines that are above with "On since" from a
> variable. The variable contains an entire file, btw.Any ideas..
shift(@lines) while @lines and $lines[0] !~ /On since/;
should do it if I understand your problem correctly.
> Can you please email me back at marv@dwave.net?
Mailed & posted.
HTH
--
Devin Ben-Hur <dbenhur@egames.com>
eGames.com, Inc. http://www.egames.com/
eMarketing, Inc. http://www.emarket.com/
"The Earth is degenerating today. Bribery and corruption
abound. Children no longer obey their parents, every man
wants to write a book, and it is evident that the end of
the world is fast approaching." -- Assyrian tablet, c. 2800 BC
------------------------------
Date: 16 May 1997 01:55:58 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: Rounding Off
Message-Id: <5lgere$2t5$1@dartvax.dartmouth.edu>
In article <01bc60a8$e65c1d60$0d9dcdcd@default>
"Brian Shepard" <brian@shepmark.com> writes:
> How do I round off 34.4567 to 34.45?
That's a tough one. I'll have to get back to you on that...
Chipmunk
------------------------------
Date: Fri, 16 May 1997 07:17:08 +0200
From: ms <malcha_s@informatik.fh-hamburg.de>
Subject: search perl doku
Message-Id: <337BEDD4.2E2D6501@informatik.fh-hamburg.de>
Hi,
I search a book, reference or description about perl.
Has anybody a link or paper ?
(I like the HTML format :-) )
Thanks.
Sven
==============================================
Sven malcha_s@informatik.fh-hamburg.de
==============================================
------------------------------
Date: Fri, 16 May 1997 05:52:21 GMT
From: John Bosch <jbosch@tid.cdscc.nasa.gov>
Subject: Second attempt at problem (getting dynamic libraries to work with perl 5.003)
Message-Id: <337BF615.39174B98@tid.cdscc.nasa.gov>
OK,
my last attempt came out all screwy so I'll try again. I've install
perl 5.003 and enabled dynamic library support but can't get it to work.
Initially I had a problem with the make not being able to find the
library -ldl. When I remove this from the configuration all compiled
fine. However, when I run a script that tries to do a 'use xxx' most of
the libraries give the error below:
#test.pl
Can't load '/usr/local/lib/perl5/i586-linux/5.003/auto/Safe/Safe.so' for
module Safe:
dld_link(/usr/local/lib/perl5/i586-linux/5.003/auto/Safe/Safe.so):
malformed input file at /usr/local/lib/perl5/DynaLoader.pm line 140.
at /usr/local/lib/perl5/Safe.pm line 390
BEGIN failed--compilation aborted at ./test.pl line 3.
bash# vi test.pl
bash# test.pl
Uncaught exception from user code:
Can't load
'/usr/local/lib/perl5/i586-linux/5.003/auto/Safe/Safe.so' for module
Safe: dld_link(/usr/local/lib/perl5/i586-linux/5.003/auto/Safe/Safe.so):
malformed input file at /usr/local/lib/perl5/DynaLoader.pm line 140.
at /usr/local/lib/perl5/Safe.pm line 390
Carp::croak called at /usr/local/lib/perl5/DynaLoader.pm line
140
DynaLoader::bootstrap called at /usr/local/lib/perl5/Safe.pm
line 390
require Safe.pm called at ./test.pl line 5
main::BEGIN called at /usr/local/lib/perl5/DynaLoader.pm line 0
eval {...} called at /usr/local/lib/perl5/DynaLoader.pm line 0
BEGIN failed--compilation aborted at ./test.pl line 5.
I can't work out what's gone wrong. Can anybody provide a shining light
for me to follow. I'm using Linux 2.0.x by the way.
Thanks in advance.
--
regards,
John Bosch
Electrical Engineer
Canberra Deep Space Communications Complex
email : jbosch@tid.cdscc.nasa.gov
John.R.Bosch@jpl.nasa.gov
www : http://tid.cdscc.nasa.gov/~jbosch
=====================================================
~!
------------------------------
Date: Wed, 14 May 1997 12:07:20 -0700
From: Bill Banyai <banyai@llnl.gov>
Subject: Seeding SRAND on WIN32
Message-Id: <337A0D68.710E@llnl.gov>
Is there a good way to seed the random number generator on a WIN32
platform?
An associated question is how to retrieve the time; in particular, how
to deal with the prompt that follows the display of the time.
For example:
c:\time
c:\Current time is 12:06:42.47p
c:\Enter new time:
I can extract the time to, in theory, seed SRAND, but how do I supply a
carriage return to kill the program.
Thanks
------------------------------
Date: 16 May 1997 01:55:09 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: Stuck with filehandling :-(
Message-Id: <5lgept$d3$1@dartvax.dartmouth.edu>
In article <337B0085.339B@easynet.fr>
Michael Hallgren <hallgren@easynet.fr> writes:
Well, the first problem I see is that all your lines are indented to
the same column, as in:
> while (<TMP>) {
> $login = $_;
> chomp $login;
> $remove{$login} = 1;
> }
Other than that...
> The idea is to use the file .tmp (containing single-word lines ---
> logins) to remove the corresponding (that is containing the logins from
> .tmp) .htpasswd lines. I plan doing so passing by a temporary file:
> .out, and then renaming that on .htpasswd. However, running the above
> subroutine doesn't touch .htpassdw :-(.
> Brief, I'm stuck --- so any advice's appreciated.
What do you mean when you say it doesn't touch .htpasswd? The
modification time isn't updated? The file is the same before and after
running the program?
If the former, I don't know what the problem is.
If the latter, your code to skip specific lines may have a bug in it.
I don't see any bugs offhand, though. I'd suggest running the debugger
and making sure your program does what you want it to for various
inputs.
That probably wasn't terribly helpful. Could you provide some sample
input for the .tmp and .htpasswd files?
Chipmunk
------------------------------
Date: 16 May 1997 04:35:19 GMT
From: Jeremy <jeremy@exit109.com>
Subject: Re: winnuke
Message-Id: <5lgo67$f2c$3@news1.exit109.com>
Zachary Fisk <fisk@homarus.ccsu.ctstateu.edu> wrote:
>Has anyone gotten the perl version of winnuke to work? I keep getting the
>following error:
>Undefined subroutine &main::sockaddr_in called at winnuke.pl line 6.
>Line 6 is:
>$in_addr = (gethostbyname($h))[4]; $in_addr = sockaddr_in($p,$in_addr);
Didn't test it, but it looks like you need a
use Socket;
at the top.
--
Jeremy | jeremy@exit109.com
"Do you think a princess, and a guy like me..." --Han Solo
------------------------------
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 486
*************************************