[7188] in Perl-Users-Digest
Perl-Users Digest, Issue: 813 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 4 19:10:03 1997
Date: Mon, 4 Aug 97 16:00:22 -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 Mon, 4 Aug 1997 Volume: 8 Number: 813
Today's topics:
Re: ! Passing variables between perl scripts <rovf@earthling.net>
Re: bug in MailTools package? <graaff@xs4all.nl>
Re: Calculating distances in Perl? (Jon Orwant)
Classifieds and languages in perl: A couple more things (Roger Easlick)
Re: Conversion of Word Processing files <rootbeer@teleport.com>
Re: cpu strain xewj@odin.sunquest.com
Re: Getting variables from checkboxes??? <petri.backstrom@icl.fi>
Re: Help with a Password Script <rootbeer@teleport.com>
Re: help: "easy" select distinct routine... (Mike Stok)
I GOT IT! I GOT IT! [WAS: Re: Trouble With : Delimited <aortiz@vcnet.com>
Re: Looking for good perl... <rootbeer@teleport.com>
Mail program in Netscape anu.hariharan@compaq.com
Re: Perl Code for Paragraph Justification? (Jon Orwant)
Perl for Windows 95 (James Atkin)
Re: Perl for Windows 95 <k.james@bangor.ac.uk>
Re: Please help me!!!!! (Mark Guz)
Re: Problems with tie/DB_File/references (robert)
Re: Process number of executable run with system(); <Brett.W.Denner@lmtas.lmco.com>
Read ahead in file (Mark Guz)
Sorting a password file paries@advicom.net
Re: Sorting a password file <thowland@vsicom.com>
time function kowalski@cebaf.gov
Re: Unable to create sub carelf@demon.nl
Re: Unable to create sub <rootbeer@teleport.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 04 Aug 1997 15:41:03 +0200
From: Ronald Fischer <rovf@earthling.net>
Subject: Re: ! Passing variables between perl scripts
Message-Id: <xz2vi1mjcb4.fsf@uebemc.siemens.de>
>>>>> On 4 Aug 1997 01:51:55 GMT
>>>>> "M" == Mwebernet <mwebernet@aol.com> wrote:
M> I want to call a seperate perl script (script2.pl) from the script I am
M> currently in (script1.pl). Here is the tricky part. Script2.pl needs the
M> variables that script1.pl receives from the form....
>From what you said, I assume that you want to call the separate script
via system or qx.
If the parameters are all simple variables (not arrays or hashes)
containing reasonably short values, you could pass them as command
line parameters to @ARGV. Otherwise you might want to rewrite your
script2.pl such that it may be used via 'require'.
--
Ronald Fischer (rovf@Earthling.net) (PGP public key available)
http://ourworld.compuserve.com/homepages/ronald_fischer/
[When posting a followup, mailing a courtesy copy is fine, provided it is
clearly marked as such.]
------------------------------
Date: 03 Aug 1997 08:41:11 +0000
From: Hans de Graaff <graaff@xs4all.nl>
Subject: Re: bug in MailTools package?
Message-Id: <87sowrirq0.fsf@twi72.twi.tudelft.nl>
erik@paxp01.mipool.uni-jena.de (Erik Braun) writes:
> You use a strange mail program. Try sendmail:
>
> ....
> my($fh) = $msg->open('sendmail');
> print $fh "$text";
> $fh->close;
> ....
>
> and everything will be fine.
Does anyone besides me consider this a bug in the MailTools package?
Having to specify which underlying MTA to use defeats the whole
purpose of Mailtools being there. I could just as well open a pipe to
sendmail directly.
I would just expect Mailtools to pick a suitable underlying MTA to
properly send my mail. If I have to make such local changes,
portability goes out the window. The above script will run on my
current web server, but it won't on Windows or at home on Linux
running Qmail. And /usr/bin/mail inserts these funny ~s strings, and
usually doesn't let you set the From: header.
I haven't mailed the author about this, but will be happy to do so
depending on reactions here.
Hans
------------------------------
Date: 04 Aug 1997 15:11:21 GMT
From: orwant@fahrenheit-451.media.mit.edu (Jon Orwant)
To: genepool@netcom.com (Jim Michael), javier@sloan.salk.edu
Subject: Re: Calculating distances in Perl?
Message-Id: <ORWANT.97Aug4111121@fahrenheit-451.media.mit.edu>
genepool@netcom.com (Jim Michael) writes:
Newsgroups: comp.lang.perl.misc
Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!nntprelay.mathworks.com!news.mathworks.com!howland.erols.net!ix.netcom.com!genepool
From: genepool@netcom.com (Jim Michael)
Organization: Netcom On-Line Services
X-Newsreader: TIN [version 1.2 PL2]
References: <33E2FCD8.F7F30E0@sloan.salk.edu>
Date: Sat, 2 Aug 1997 02:23:58 GMT
Lines: 16
Sender: genepool@netcom.netcom.com
Javier Vegas (javier@sloan.salk.edu) wrote:
: Hello
Howdy
: In order not to reinvent the wheel, I am
: looking for a function/package/library/thingy
: that calculates the distance between two points
: on earth when I know their latitude and longitude.
I am not aware of anything perl-specific, but there is a GPS newsgroup
where pointers to the general algorithms may be found. I would try a
search on DejaNews with search terms 'gps great circle calculation',
using the old database. Email if you need additional help.
Cheers,
Jim
Here's a program that was posted to clpm a few years back. It's
hardcoded for the cities listed at the end, but is easily hackable if
you know your latitude and longitude.
-Jon
----------------
Jon Orwant
The Perl Journal
http://tpj.com/
#!/usr/bin/perl
#
# Computes great circle distance between two cities.
# Albert Danial al.danial@macsch.com
#
# __END__ and <DATA> added by Jon Orwant
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# define some constants
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
$Pi = &acos(-1);
$HalfPi = $Pi/2;
$EarthRadiusMi = 3963; # equitorial radius miles (polar radius = 3950 miles)
$EarthRadiusKm = 6378; # equitorial radius km (polar radius = 6357 km)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# read in the database of cities, states and coordinates
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
while(<DATA>) {
if (/^0 /) { # then this starts data for a new city
@line = split;
for ($i = 1; $i <= $#line; $i++) {
# some city names have blanks between them so append
# all space delimited strings after the leading 0
@Name[$nCities] .= @line[$i]." "; }
chop(@Name[$nCities]); # remove the trailing space
++$nCities; }
elsif (/^L /) { # get lat/lon info, convert to radians
@line = split;
$degLat = @line[1];
$minLat = @line[2];
$secLat = @line[3];
$decimal = $degLat + $minLat/60 + $secLat/3600;
if (@line[4] =~ /S/) { $decimal = -$decimal; } # South is (-)
$Latitude{@Name[$nCities-1]} = $decimal;
$degLon = @line[5];
$minLon = @line[6];
$secLon = @line[7];
$decimal = $degLon + $minLon/60 + $secLon/3600;
if (@line[8] =~ /W/) { $decimal = -$decimal; } # West is (-)
$Longitude{@Name[$nCities-1]} = $decimal; }
elsif (/^2 /) { # get state name
@line = split;
$State{@Name[$nCities-1]} = @line[1];
}
}
print "Got information for $nCities cities.\n";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Query user for city pairs, help, or list the database.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
while (1) { # loop over pairs of cities
$nCurrent = 1;
while (1) { # loop until user enters two valid cities, or a CR
# entering "all" will print all cities in the database
print "city $nCurrent = ";
chop($in = <STDIN>);
last unless $in;
if ($in eq "help") {
&PrintHelp; }
elsif ($in eq "ls") {
&PrintShortDatabase; }
elsif ($in eq "ll") {
&PrintLongDatabase; }
elsif (!grep(/^$in$/, @Name)) { # is the input a defined city?
print "$in is not in the database.\n"; }
else { # user entered a valid city
@city[$nCurrent-1] = $in;
++$nCurrent;
last unless ($nCurrent < 3);
}
}
last unless $in; # quit if the user just gave a CR
if (@city[0] eq @city[1]) {
print "You entered the same city twice; try again.\n"; }
else {
$alpha = &Theta($Latitude{@city[0]}, $Longitude{@city[0]},
$Latitude{@city[1]}, $Longitude{@city[1]});
$miles = $alpha*$EarthRadiusMi;
$alpha *= 180/$Pi; # back to degrees for possible printing?
printf "%s and %s are separated by %6.2f miles.\n",
@city[0], @city[1], $miles;
}
}
exit 0;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Define the subroutines.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
sub Theta {
# Usage: &Theta(Alat, Alon, Blat, Blon) with all arguments in degrees.
# Computes cartesian coordinates of geocentric vectors that point to
# A and B, then returns the vectors' separation angle in radians.
local(@x) = @_;
for ($i = 0; $i < 4; $i++) { $x[$i] /= (180/$Pi); } # make radians
$Xa = cos($x[1])*cos($x[0]);
$Ya = sin($x[1])*cos($x[0]);
$Za = sin($x[0]);
$Xb = cos($x[3])*cos($x[2]);
$Yb = sin($x[3])*cos($x[2]);
$Zb = sin($x[2]);
return &acos( $Xa*$Xb + $Ya*$Yb + $Za*$Zb);
}
sub asin {
local($x) = @_;
return $x == 0 ? 0 : atan2($x, sqrt(1 - $x*$x));
}
sub acos {
local($x) = @_;
return $x == 0 ? $HalfPi : atan2(sqrt(1 - $x*$x), $x);
}
sub PrintShortDatabase {
$nAcross = 3;
$nLines = int(($#Name + 1) / $nAcross);
$nExtra = ($#Name + 1) % $nAcross;
$nOver = $nExtra;
@add[1] = 0;
for ($i = 2; $i <= $nAcross; $i++) {
if ($nOver) {
@add[$i] = @add[$i-1] + $nLines + 1;
--$nOver; }
else {
@add[$i] = @add[$i-1] + $nLines; }
}
@SortedCities = sort(@Name);
for ($i = 1; $i <= $nLines; $i++) {
for ($j = 1; $j <= $nAcross; $j++) {
$city = @SortedCities[$i + @add[$j] - 1];
$pair = $city . " " . $State{$city};
printf " %-24s ", $pair;
}
print "\n";
}
if ($nExtra) {
$i = $nLines + 1;
for ($j = 1; $j <= $nExtra; $j++) {
$city = @SortedCities[$i + @add[$j] - 1];
$pair = $city . " " . $State{$city};
printf " %-24s ", $pair;
}
print "\n";
}
}
sub PrintLongDatabase {
foreach $city (sort @Name) {
printf " %-20s %2s % 9.4f % 9.4f\n",
$city, $State{$city}, $Latitude{$city}, $Longitude{$city};
}
}
sub PrintHelp {
print " <return> Quit\n";
print " <city> City names are case sensitive and must be\n";
print " fully expanded, ie St Louis should be entered\n";
print " as Saint Louis; Ft Worth as Fort Worth. Do not\n";
print " add the state.\n";
print " ls Short listing of all cities in the database.\n";
print " ll Long listing of all cities in the database.\n";
print " help Print this message.\n";
print "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n";
print "Lat/Lon data available via telnet martini.eecs.umich.edu 3000\n";
}
__END__
0 Los Angeles
2 CA California
L 34 03 08 N 118 14 34 W
0 Dallas
2 TX Texas
L 32 47 00 N 96 48 00 W
0 Miami
2 FL Florida
L 25 46 26 N 80 11 38 W
0 San Francisco
2 CA California
L 37 46 30 N 122 25 06 W
0 Berkeley
2 CA California
L 37 52 18 N 122 16 18 W
0 Boston
2 MA Massachusetts
L 42 21 30 N 71 03 37 W
0 Chicago
2 IL Illinois
L 41 51 00 N 87 39 00 W
0 West Lafayette
2 IN Indiana
L 40 25 33 N 86 54 29 W
0 Lafayette
2 IN Indiana
L 40 25 00 N 86 52 30 W
0 Indianapolis
2 IN Indiana
L 39 46 06 N 86 09 29 W
0 Lexington
2 KY Kentucky
L 38 02 57 N 84 30 01 W
0 Louisville
2 KY Kentucky
L 38 15 15 N 85 45 34 W
0 Houston
2 TX Texas
L 29 45 47 N 95 21 47 W
0 Pasadena
2 CA California
L 34 08 52 N 118 08 37 W
0 Glendale
2 CA California
L 34 08 33 N 118 15 15 W
0 Oakland
2 CA California
L 37 48 16 N 122 16 11 W
0 Sacramento
2 CA California
L 38 34 54 N 121 29 36 W
0 Orlando
2 FL Florida
L 28 32 17 N 81 22 46 W
0 Washington
2 DC District of Columbia
L 38 53 42 N 77 02 12 W
0 New York
2 NY New York
L 40 42 51 N 74 00 23 W
0 Jacksonville
2 FL Florida
L 30 19 55 N 81 39 21 W
0 Tallahassee
2 FL Florida
L 30 26 17 N 84 16 51 W
0 Atlanta
2 GA Georgia
L 33 44 56 N 84 23 17 W
0 Burbank
2 CA California
L 34 10 51 N 118 18 29 W
0 Norfolk
2 VA Virginia
L 36 50 48 N 76 17 08 W
0 Cincinnati
2 OH Ohio
L 39 06 15 N 84 31 10 W
0 Minneapolis
2 MN Minnesota
L 44 58 48 N 93 15 49 W
0 Denver
2 CO Colorado
L 39 44 21 N 104 59 03 W
0 Tampa
2 FL Florida
L 27 56 50 N 82 27 31 W
0 Saint Petersburg
2 FL Florida
L 27 46 14 N 82 40 46 W
0 Cleveland
2 OH Ohio
L 41 29 58 N 81 41 44 W
0 Honolulu
2 HI Hawaii
L 21 18 25 N 157 51 30 W
0 Nome
2 AK Alaska
L 64 30 00 N 165 25 00 W
0 Fairbanks
2 AK Alaska
L 64 50 16 N 147 42 59 W
0 Seattle
2 WA Washington
L 47 36 23 N 122 19 51 W
0 Portland
2 OR Oregon
L 45 31 25 N 122 40 30 W
0 Livermore
2 CA California
L 37 40 55 N 121 46 01 W
0 Albuquerque
2 NM New Mexico
L 35 05 00 N 106 39 00 W
0 Salt Lake City
2 UT Utah
L 40 45 39 N 111 53 25 W
0 Saint Louis
2 MO Missouri
L 38 37 38 N 90 11 52 W
0 Champaign
2 IL Illinois
L 40 06 59 N 88 14 36 W
0 Cambridge
2 MA Massachusetts
L 42 22 00 N 71 06 00 W
0 San Jose
2 CA California
L 37 20 07 N 121 53 38 W
0 San Diego
2 CA California
L 32 42 55 N 117 09 23 W
0 Long Beach
2 CA California
L 33 46 01 N 118 11 18 W
0 Austin
2 TX Texas
L 30 16 01 N 97 44 34 W
0 New Orleans
2 LA Louisiana
L 29 57 16 N 90 04 30 W
0 Huntsville
2 AL Alabama
L 34 43 49 N 86 35 10 W
0 Birmingham
2 AL Alabama
L 33 31 14 N 86 48 09 W
0 Nashville
2 TN Tennessee
L 36 09 57 N 86 47 04 W
0 Charleston
2 SC South Carolina
L 32 46 35 N 79 55 52 W
0 Las Vegas
2 NV Nevada
L 36 10 30 N 115 08 11 W
0 Milwaukee
2 WI Wisconsin
L 43 02 20 N 87 54 23 W
0 Columbus
2 OH Ohio
L 39 57 40 N 82 59 56 W
0 Savannah
2 GA Georgia
L 32 05 00 N 81 06 00 W
0 Mobile
2 AL Alabama
L 30 41 39 N 88 02 35 W
0 Pittsburgh
2 PA Pennsylvania
L 40 26 26 N 79 59 46 W
0 Philadelphia
2 PA Pennsylvania
L 39 57 08 N 75 09 51 W
0 Newark
2 NJ New Jersey
L 40 44 08 N 74 10 22 W
0 Baltimore
2 MD Maryland
L 39 17 25 N 76 36 45 W
0 Boulder
2 CO Colorado
L 40 00 54 N 105 16 12 W
0 Cupertino
2 CA California
L 37 19 23 N 122 01 52 W
0 Sunnyvale
2 CA California
L 37 22 08 N 122 02 07 W
0 Key West
2 FL Florida
L 24 33 19 N 81 46 58 W
0 Detroit
2 MI Michigan
L 42 19 53 N 83 02 45 W
0 Ann Arbor
2 MI Michigan
L 42 17 00 N 83 44 45 W
0 Fort Lauderdale
2 FL Florida
L 26 07 19 N 80 08 37 W
0 Memphis
2 TN Tennessee
L 35 08 58 N 90 02 56 W
0 Knoxville
2 TN Tennessee
L 35 57 38 N 83 55 15 W
0 Troy
2 NY New York
L 42 43 42 N 73 41 32 W
0 Albany
2 NY New York
L 42 39 09 N 73 45 24 W
0 Saratoga Springs
2 NY New York
L 43 04 59 N 73 47 06 W
0 Fort Worth
2 TX Texas
L 32 43 31 N 97 19 14 W
0 North Pole
2 ??
L 90 00 00 N 00 00 00 W
0 South Pole
2 ??
L 90 00 00 S 00 00 00 W
------------------------------
Date: Mon, 04 Aug 1997 00:24:53 GMT
From: roger@ole-net.com (Roger Easlick)
Subject: Classifieds and languages in perl: A couple more things...
Message-Id: <33e51f9b.8057122@news.voyager.net>
Thanks for all the responses. Here is how I solved the language
problem based on the suggestion of a very helpful Korean guy (GIL)
that posted a response to my query:
sub GET_FORM_DATA {
#** When the user clicks on the Submit button labled
#** "ADD" this CGI program is called, and the form
#** data is passed in STDIN.
read(STDIN, $save_string, $ENV{CONTENT_LENGTH});
@prompts = split(/&/,$save_string);
foreach (@prompts)
{
($tmp1, $tmp2) = split(/=/,$_);
$tmp2 =~ s/\x2b/\x20/g;
$tmp2 =~ s/%2C/\x2c/g;
$tmp2 =~ s/%28/\x28/g;
$tmp2 =~ s/%29/\x29/g;
$tmp2 =~ s/%(..)/pack("C", hex($1))/ge; # The Korean guy
sent me this line. It does the
# trick.
$fields{$tmp1}=$tmp2;
}
}
I do still have some questions if anyone can help me out. I still
haven't figured out how to out best output the DB information. I want
to keep the formatting of my existing classifieds pages
http://www.ole-net.com/english/aupair.htm
which uses frames. I will probably add a frame which will take the
place of the categories on the left hand side and will be search
boxes. What I need to know is
1) (Perhaps an incredibly simple question) How do I output the CGI
data so that it looks like my existing HTML page? I think if I see
some of it done, I will be able to do the detail work myself. So far I
can only get it to output in table form, but I want it to look like
the ad part of my existing page (see aupair.htm above.)
2) How can I get the DATE variable and incorporate it into the
database. I've read about Server Side Includes and have seen the
$ENV() function, but have not been able to get it to work. I would
like to just say
$date = $ENV(DATE_LOCAL) in my current script (at bottom of this
message) but the server doesn't seem to like it.
3) I need to be able to FILTER and SORT by COUNTRY and/or CATEGORY
and/or KEYWORD(S). The idea is that there would be drop down boxes for
language, country and category just like there is in the ad submission
form.
http://www.ole-net.com/test/classf_es.htm
If any one of the sort keys are not selected, the program would allow
all of the unselected keys, (e.g, no country selected, then ads from
all countries would be listed.)
4) A DELETION ROUTINE that would be connected to submit buttons that
would automatically delete the entire line (string) in the DB at the
touch of a button. It should also be PASSWORD ACTIVATED.
Any help would be greatly appreciated.
Roger
CLASS.CGI # This deals with input from the classified submission
form, stores in it the DB and should show a confirmation page after
submission that gives the person submitting the ad a last chance to
delete or confirm the information in the form.
#!/usr/sbin/perl5
#******************************************************************
#******************** Subroutines ********************************
#******************************************************************
#*******************************************************
#****** Get "state" info passed up from Browser ********
#*******************************************************
sub GET_FORM_DATA {
#** When the user clicks on the Submit button labled
#** "ADD" this CGI program is called, and the form
#** data is passed in STDIN.
read(STDIN, $save_string, $ENV{CONTENT_LENGTH});
@prompts = split(/&/,$save_string);
foreach (@prompts)
{
($tmp1, $tmp2) = split(/=/,$_);
$tmp2 =~ s/\x2b/\x20/g;
$tmp2 =~ s/%2C/\x2c/g;
$tmp2 =~ s/%28/\x28/g;
$tmp2 =~ s/%29/\x29/g;
$tmp2 =~ s/%(..)/pack("C", hex($1))/ge;
$fields{$tmp1}=$tmp2;
}
}
#**********************************************************
#****** Append the new line to the phone book data file ***
#**********************************************************
sub ADD_RECORD {
open(MYFILE,">>/home/ns-home/docs/olenet/phone_book.dat") || print
"<H3>Error: Can't open phone book file<\H3>";
# $date = $ENV(DATE_LOCAL)
print MYFILE $fields{'cat'}, ":";
print MYFILE $fields{'title'}, ":";
print MYFILE $fields{'adtext'}, ":";
print MYFILE $fields{'email'}, ":";
print MYFILE $fields{'country'}, ":";
print MYFILE $fields{'facts'}, ":";
print MYFILE "\n";
}
#******************************************************************
#**************** Show Entry ***********************
#******************************************************************
sub SHOW_DATA {
print("Content-Type: text/html; charset=iso-8859-1\n\n");
print("<HEAD><TITLE>Classified Ad Entry
Confirmation</TITLE></HEAD>\n");
print("<BODY>\n");
($cat, $title, $adtext, $email) = split(/:/,$save_string);
print "<TABLE BORDER>\n";
print "<TD ALIGN=\x22center\x22>", $fields{'cat'}, "</TD>\n";
print "<TD ALIGN=\x22center\x22>", $fields{'title'}, "</TD>\n";
print "<TD ALIGN=\x22center\x22>", $fields{'adtext'}, "</TD>\n";
print "<TD ALIGN=\x22center\x22>", $fields{'email'}, "</TD>\n";
print "<TD ALIGN=\x22center\x22>", $fields{'country'}, "</TD>\n";
print "<TD ALIGN=\x22center\x22>", $fields{'facts'}, "</TD>\n";
print "<TR>\n";
print "</TABLE>\n";
print "Search for <A HREF=/perl_scr/phone.cgi>your entry</A>.\n";
print("</BODY>\n");
print("</HTML>\n");
}
#******************************************************************
#**************** Main Rtn ***********************
#******************************************************************
&GET_FORM_DATA;
&ADD_RECORD;
&SHOW_DATA;
exit(0)
Roger Easlick
roger@ole-net.com
http://www.ole-net.com
------------------------------
Date: Sun, 3 Aug 1997 09:01:59 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Kaare Rasmussen <kar@webline.dk>
Subject: Re: Conversion of Word Processing files
Message-Id: <Pine.GSO.3.96.970803090014.7094O-100000@kelly.teleport.com>
On Fri, 1 Aug 1997, Kaare Rasmussen wrote:
> Is it possible to convert mainstream WP files (Word, WordPerfect, from
> different versions) between each other and to ASCII, tex, whatever?
Yes. If you write a module to make this possible, please upload it to
CPAN. Thanks!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 4 Aug 1997 21:43:49 GMT
From: xewj@odin.sunquest.com
Subject: Re: cpu strain
Message-Id: <5s5iel$g4f$1@iggy.sunquest.com>
In article <33E690DA.514A@ibm.net>, Ekim E. YARDIMLI <tetnys@ibm.net> wrote:
>hello all,
>i'm planing to build a 20000 entries two dimensional array file, and
>would like to do a search though this file, though i don't have a clue
>about how much cpu power it will take to do this search.
>I'm planing to use a remote host, and wonder if this might cause any
>harm to the rest of the os?
ouch. well, it shouldn't /harm/ anything, but you will make some new enemies...
statistically, you will have to look through half the database before you find
the entry you're looking for.
Unless you plan to load the entire db into memory (much faster than disk I/O),
I would suggest changing to a disk-based search tree of some sort. (sort!- haha)
Binary tree, B tree, B+ tree, whatever- anything is better than a linear array
when it comes to finding things.
------------------------------
Date: Fri, 01 Aug 1997 18:36:41 +0300
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: Getting variables from checkboxes???
Message-Id: <33E20289.6B94@icl.fi>
Burt Lewis wrote:
>
> I have a script that reads from a variable length text file and outputs an
> HTML table based on the records in the file. That works fine!
>
> I also include a checkbox for each line which I name in increments.
> (del1,del2,del3,etc.)
>
> Problem is that I'm not sure how I can capture these variables not knowing
> how many lines I will have to be read. I can't get the foreach looping.
>
> This is a sample of the finished HTML file:
> ===========================================
> <input type=checkbox name=del13></td><td width=1% font
> size=3><b>6/30/97</td><td width=1%>
> <input type=checkbox name=del14></td><td width=1% font
> size=3><b>6/30/97</td><td width=1%>
[rest of message omitted]
Use CGI.pm, and then try using checkboxes with the same
name, but different values.
If CGI.pm isn't in your Perl distribution, look in
http://www-genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.htm
regards,
...petri.backstrom@icl.fi
ICL Data Oy
Finland
------------------------------
Date: Mon, 4 Aug 1997 10:56:32 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Wayne Stone <bwstone@email.uncc.edu>
Subject: Re: Help with a Password Script
Message-Id: <Pine.GSO.3.96.970804105441.27878P-100000@kelly.teleport.com>
On 4 Aug 1997, Wayne Stone wrote:
> I have just started learning Perl and need to create a simple
> password checker.
If you're doing something with a web server, then your server can probably
do this itself, saving you a lot of time and trouble. You can check the
server's docs for more info.
> All I want it to do is see is the password associated with the id
> submitted is the same as the password associated with the matching id in
> the data file and return a message if not.
If you must do this in Perl, you could use the crypt() function,
documented in perlfunc(1). Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 4 Aug 1997 14:52:35 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: help: "easy" select distinct routine...
Message-Id: <5s4qbj$qs5@news-central.tiac.net>
In article <33e590e4.7311873@news>,
Jvrgen Gustafsson <jorgen.gustafsson@emw.ericsson.se> wrote:
>Hello, can someone help me out with a "select distinct" routine:
>Guess that this is pretty simple (but not simple enough for me...)
>My "infile.txt" containing the following:
>121.1.224.14,row1
>121.1.224.14,row2
>22.14.156.67,row3
>54.89.23.63,row4
>54.89.23.63,row5
>54.89.23.63,row6
>wan't to do a select distinct on the IP-Adress column and save the
>result to a new file like below (all other lines discarded):
>121.1.224.14,row1
>22.14.156.67,row3
>54,89,23,63,row4
>(Please reply by email if possible...)
OK, if the same address is always represented the same way then (i.e. no
random zero padding or spaces) then something like this might work (unless
you have so many duplicates that an element of $seen{$ip} wraps around...
#!/usr/local/bin/perl
while (<DATA>) {
($ip) = (split /,/);
print unless $seen{$ip}++;
}
__END__
121.1.224.14,row1
121.1.224.14,row2
22.14.156.67,row3
54.89.23.63,row4
54.89.23.63,row5
54.89.23.63,row6
which produces
121.1.224.14,row1
22.14.156.67,row3
54.89.23.63,row4
If you're a little more paranoid then you can say something like:
#!/usr/local/bin/perl -w
while (<DATA>) {
$ip = pack 'C4', (split /[,\.]/)[0 .. 3];
print unless $seen{$ip};
$seen{$ip} = 1;
}
__END__
121.1.224.14,row1
121.001.224.14,row2
22.14.156.67,row3
54.89.23.63,row4
054.089.23.63,row5
54.89.023.063,row6
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Mon, 04 Aug 1997 10:02:59 -0700
From: Armando Ortiz <aortiz@vcnet.com>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: I GOT IT! I GOT IT! [WAS: Re: Trouble With : Delimited Database]
Message-Id: <33E60B41.B3D65BDD@vcnet.com>
#############################################################################
#Zip Code Search Routine - "Postal Nightmare" v1.0 (08/04/97)
#Status - OFFICIAL RELEASE
#Written By Armando Ortiz - NewCom, Inc. Engineering Dept.
#Permission to use this script anywhere else is granted provided this
notice
#stays. Besides...who cares what this says anyway?
#I can be reached at aortiz@newcominc.com if you have questions.
#Thanks to Tom Phoenix, Eric Bohlman, Briand D Foy, and Tad McClellan
#for their assistance in the comp.lang.perl.misc group. You guys
inspired
#me to push it until I got this script done... <G>
#
#############################################################################
# Begin reading the input of the form passed from the browser
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
#############################################################################
#############################################################################
# The content length by default if sent blank is 18. If the content
length
# is 18, then the user MUST enter SOMETHING in...it would be kinda
foolish
# NOT to...also re-send the form to the user so he doesn't have to
backtrack
# in his browser...
if ($ENV{'CONTENT_LENGTH'} == 18) {
print "Content-type: text/html\n\n";
print "<!DOCTYPE HTML PUBLIC \"-//SoftQuad//DTD HTML 3.2 +
extensions for HoTMetaL PRO 3.0 19961211//EN\" \"hmpro3.dtd\">";
print "<HTML VERSION=\"1.00\">";
print "<HEAD><TITLE>Zip Code Search Engine Error!</TITLE></HEAD>";
print "<BODY BGCOLOR=\"#000000\" TEXT=\"#FFFFFF\" LINK=\"#00FFFF\"
VLINK=\"#FF0080\" ALINK=\"#FFFF00\">";
print "<IMG SRC=\"/newcominc/images/common/sidebar.jpg\"
ALT=\"Sidebar\" ALIGN=\"LEFT\" WIDTH=\"20\" HEIGHT=\"400\">";
print "<P ALIGN=\"CENTER\"><IMG
SRC=\"/newcominc/images/common/newcomlogo.jpg\" ALT=\"Logo\"
BORDER=\"0\" WIDTH=\"299\" HEIGHT=\"84\">";
print "</P><HR><BLOCKQUOTE>";
print "<P ALIGN=\"CENTER\">You have to put at least one number to match
in the zip code field!</P>";
print "<TABLE BORDER=\"0\" ALIGN=\"CENTER\"><TR><TD
VALIGN=\"MIDDLE\" ALIGN=\"CENTER\">";
print "<FORM ACTION=\"/cgi-bin/zipsearch.pl\" METHOD=\"POST\">";
print "<INPUT TYPE=\"TEXT\" NAME=\"zip\" SIZE=\"5\" MAXLENGTH=\"5\">";
print " ";
print "<INPUT TYPE=\"SUBMIT\" NAME=\"\">";
print "<INPUT TYPE=\"RESET\" NAME=\"\">";
print "</FORM></TD></TR></TABLE></BLOCKQUOTE><HR><P
ALIGN=\"CENTER\">";
print "<A HREF=\"/newcominc/index.html\">Home</A>";
print " || ";
print "<A HREF=\"/newcominc/sales.html\">Sales &
Marketing</A>";
print " || ";
print "<A HREF=\"/newcominc/jobops.html\">Employment</A>";
print " || ";
print "<A HREF=\"/newcominc/products.html\">Products</A>";
print " || ";
print "<A HREF=\"/newcominc/support.html\">Support</A>";
print " || ";
print "<A HREF=\"/newcominc/register.html\">Registration</A>";
print " || ";
print "<A HREF=\"/newcominc/about.html\">About</A>";
print "</P><P ALIGN=\"CENTER\"><BR>This site was last updated on
July 22, 1997</P></BODY></HTML>";
exit;
}
#############################################################################
#############################################################################
# Counter variable start at 0
$i = 0;
#############################################################################
#############################################################################
# Some HTML code to begin the start of the results page
print "Content-type: text/html\n\n";
print "<!DOCTYPE HTML PUBLIC \"-//SoftQuad//DTD HTML 3.2 + extensions
for HoTMetaL PRO 3.0 19961211//EN\" \"hmpro3.dtd\">";
print "<HTML>";
print "<HEAD><TITLE>Search Results</TITLE></HEAD>";
print "<BODY BGCOLOR=\"#000000\" TEXT=\"#FFFFFF\" LINK=\"#00FFFF\"
VLINK=\"#FF0080\" ALINK=\"#FFFF00\">";
print "<IMG SRC=\"/newcominc/images/common/sidebar.jpg\"
ALT=\"Sidebar\" ALIGN=\"LEFT\" WIDTH=\"20\" HEIGHT=\"400\">";
print "<P ALIGN=\"CENTER\">";
print "<IMG SRC=\"/newcominc/images/common/newcomlogo.jpg\"
ALT=\"Logo\" ALIGN=\"ABSMIDDLE\" WIDTH=\"299\" HEIGHT=\"84\">";
print "<IMG SRC=\"/newcominc/images/common/head_products.jpg\"
ALT=\"Products\" ALIGN=\"ABSMIDDLE\">";
print "</P>";
print "<HR>";
print "<BLOCKQUOTE>";
print "<TABLE BORDER=\"0\" ALIGN=\"CENTER\"><TR><TD VALIGN=\"MIDDLE\"
ALIGN=\"CENTER\">";
print "<FORM ACTION=\"/cgi-bin/zipsearch.pl\" METHOD=\"POST\">";
print "<INPUT TYPE=\"TEXT\" NAME=\"zip\" SIZE=\"5\" MAXLENGTH=\"5\">";
print " ";
print "<INPUT TYPE=\"SUBMIT\" NAME=\"\">";
print "<INPUT TYPE=\"RESET\" NAME=\"\">";
print "</FORM></TD></TR></TABLE>";
print "<BLOCKQUOTE><BLOCKQUOTE>";
#############################################################################
#############################################################################
# Open the database and begin parsing the data sent by the browser in
the
# form of zip=xxxxx&Submit+Query
open (NAMES,"data.dat");
@pairs = split(/&/, $buffer);
foreach $pair (@pairs){
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%(a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
#############################################################################
#############################################################################
# Check for matches and print the results, also define the fields in the
# database as four with a colon delimiter (you can have as many fields
as you
# want if you wish to modify this section
while (<NAMES>) {
($fname,$lname,$address,$zip) = split(':',$_);
if ($zip =~ $FORM{$name}) {
$i++;
print "\n\n<B><UL><LI>$fname $lname<BR>\n";
print "$address $zip</LI></UL></B>\n";
}
}
}
#############################################################################
#############################################################################
# Closing HTML with number of matches from $i found
print "</BLOCKQUOTE></BLOCKQUOTE>";
print "<CENTER><P>Found <BLINK><B>$i</B></BLINK> matches for your
search</P></CENTER>";
print "<HR WIDTH=\"100%\"><P ALIGN=\"CENTER\">";
print "<A HREF=\"/newcominc/index.html\">Home</A>";
print " || ";
print "<A HREF=\"/newcominc/sales.html\">Sales &
Marketing</A>";
print " || ";
print "<A HREF=\"/newcominc/jobops.html\">Employment</A>";
print " || ";
print "<A HREF=\"/newcominc/products.html\">Products</A>";
print " || ";
print "<A HREF=\"/newcominc/support.html\">Support</A>";
print " || ";
print "<A HREF=\"/newcominc/register.html\">Registration</A>";
print " || ";
print "<A HREF=\"/newcominc/about.html\">About</A>";
print "</P>";
print "</BODY></HTML>";
#############################################################################
#############################################################################
# Be kind to your database as you would an animal and CLOSE IT!
close NAMES;
#############################################################################
LOLOLOLOL! YIPPEEEEEEEEEEEEE! ...I need a beer...HEH...
Hey...Thanks for ALL the help! I know it's kind of a pain in the neck
to help someone who's starting out with Perl scripting, but it looks
like ALL of it might have been worth it... =]
Regards,
Armando Ortiz
NewCom, Inc.
Engineering Department
------------------------------
Date: Sun, 3 Aug 1997 09:06:47 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Stephen T. Cerniglia" <deputy-_-dawg@msn.com>
Subject: Re: Looking for good perl...
Message-Id: <Pine.GSO.3.96.970803090531.7094Q-100000@kelly.teleport.com>
On Sun, 3 Aug 1997, Stephen T. Cerniglia wrote:
> I am looking for a perl script or pieces of a script that will allow me
> to access a ftp server off my server and get the information of the
> Direcotry tree and file listings...
I think you'll find what you need in the docs which come with the LWP
module from CPAN. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 04 Aug 1997 15:02:31 -0600
From: anu.hariharan@compaq.com
Subject: Mail program in Netscape
Message-Id: <870724554.22173@dejanews.com>
I have written a test perl script which sends a mail to me. It executes
correctly on the DOS prompt ie. prints out whatever I have asked it to
print out, and sends me mail. However when I run this file through
netscape, it only prints out whatever is contained within print
statements but does not send me email.It doesn't give me any errors
though. Is it some configuration problem ?Can someone please help me out
with this ?
Thanks.
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 04 Aug 1997 15:05:10 GMT
From: orwant@fahrenheit-451.media.mit.edu (Jon Orwant)
To: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Perl Code for Paragraph Justification?
Message-Id: <ORWANT.97Aug4110510@fahrenheit-451.media.mit.edu>
ebohlman@netcom.com (Eric Bohlman) writes:
dilcher@cueva.com wrote:
: I am looking for a piece of perl code or a program to automatically
: justify the paragraphs in a document based on a particular line
: length.
: If anyone is familiar with the control-J justification in "Pico", this
: is what I am trying to do via Perl code.
Yep, there's such a piece of code, and you got it with your Perl
distribution. It's called Text::Wrap, and it works like a charm.
Note that what you're looking for (and what Text::Wrap does) is properly
called "filling." "Justification" usually means arranging text so that
all lines are identical in length; this is very difficult to do well
unless you have a good hyphenation algorithm.
Which we have -- check out TeX::Hyphen on the CPAN.
These can be combined to create a paragraph-justification subroutine
and will be explained in
Manipulating Text with Perl (title tentative)
O'Reilly & Associates
Jon Orwant
early 1998 I hope
-Jon
----------------
Jon Orwant
The Perl Journal
http://tpj.com/
------------------------------
Date: Mon, 04 Aug 1997 11:03:25 GMT
From: James.Atkin@Phase.Com (James Atkin)
Subject: Perl for Windows 95
Message-Id: <870692605.28938.0.nnrp-2.c2d93022@news.demon.co.uk>
Hi there,
I am trying to identify a Perl Development Tool for Windows95.
The sort of thing I am after is the following :
* Windows (95) application
* On-line Help
* Run/Test Script
* Plus all the normal tools of a Windows Development Suite.
Does anyone know if a product such as this is currently available
on the market ?
Thanks for any help,
James Atkin
(James.Atkin@Phase.Com)
------------------------------
Date: 04 Aug 1997 18:33:48 +0100
From: Keith James <k.james@bangor.ac.uk>
Subject: Re: Perl for Windows 95
Message-Id: <m3wwm1svib.fsf@pwilliams.bangor.ac.uk>
James.Atkin@Phase.Com (James Atkin) writes:
>
> Hi there,
>
> I am trying to identify a Perl Development Tool for Windows95.
> The sort of thing I am after is the following :
>
> * Windows (95) application
> * On-line Help
> * Run/Test Script
> * Plus all the normal tools of a Windows Development Suite.
How about NTEmacs with c-perl mode? I'm not sure what is implied by
'Windows Development Suite', but you get online help via the Perl info
pages, contextual help, run scripts, access to the debugger in another
window, syntax highlighting, code formatting and so on.
You'll need the NTEmacs binaries (I don't have the URL; web search will
find it easily), plus C-Perl mode and Perl-info from your nearest CPAN
mirror.
--
Keith James Ph.D. - k.james@bangor.ac.uk PGP 2.6.2i Key ID 469A9FA1
Biodegradation Group *Encrypt and Survive*
School of Biological Sciences Guvf znl znxr ab frafr vs bar bs gur
University of Wales, Bangor, UK vasvavgr ahzore bs zbaxrlf vf bssyvar
------------------------------
Date: Mon, 04 Aug 1997 15:22:18 GMT
From: mguz@sol.co.uk (Mark Guz)
Subject: Re: Please help me!!!!!
Message-Id: <33e5f378.257711920@news.sol.co.uk>
On Mon, 04 Aug 1997 12:15:01 +0800, ")P%J" <cycchow@hkis.com> wrote:
>Can you teach me to write a homepage that can setup a user access
>(specific homepage) control program?
>
>
>Ricky
>
>
>
>
As far as I am aware you usually do this with the web server.
MArk Guz
------------------------------
Date: 4 Aug 1997 11:31:54 +0200
From: robert@ICK.il.fontys.nl (robert)
Subject: Re: Problems with tie/DB_File/references
Message-Id: <5s47ia$er@bsd1.hqehv-internal.ilse.net>
stampes@xilinx.com (Jeff Stampes):
>robert (robert@ICK.il.fontys.nl) wrote:
>: So my question is...what am I doing wrong?? :) Thanks alot in advance.
>Using a broken newsreader? That return address bounces to me, so
>much for trying to be courteous and responding via e-mail.
Thanks for trying, but the mangled e-mail address is to prevent my
mailbox being flooded with spam (I'll install a spamblock soon).
Needless to say, I do appreciate your efforts.
>Your code works fine on my system.
It seemed to be a problem with my libdb. Anyway, I stopped using DB_File
altogether for this project since, for some reason I have yet to discover,
it made my script extremely unstable (coredumping perl 5.003 and perl
5.00401, occasional sillyness about a hash-reference not being a hash-
reference, ...). Now that I'm using NDBM_File, everything works much
better.
robert
------------------------------
Date: Mon, 04 Aug 1997 08:56:53 -0500
From: Brett Denner <Brett.W.Denner@lmtas.lmco.com>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Process number of executable run with system();
Message-Id: <33E5DFA5.41C6@lmtas.lmco.com>
Tom Phoenix wrote:
>
> > I need to run an executable with the system() command and save its
> > process number to a file.
>
> By the time that Perl is executing your code, the process started by
> system is dead and gone. Maybe you want to fork a child process and > > keep its process id?
When I run my perl script that starts a (long-running) program with
system(), I can type "ps -u denner" (denner is my userid) and get a
listing of all processes I own that are currently running. Each process
has an associated PID, which I can use to delete the process with a
"kill PID" command (I know you know this). I was hoping there was a way
to obtain the PID that is displayed by the ps command so I can delete
that process later.
Thanks,
Brett
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Brett W. Denner Lockheed Martin TAS
Brett.W.Denner@lmtas.lmco.com P.O. Box
748
(817) 935-1144 (voice) Fort Worth, TX 76101
(817) 935-1212 (fax) MZ 9333
------------------------------
Date: Mon, 04 Aug 1997 14:11:18 GMT
From: mguz@sol.co.uk (Mark Guz)
Subject: Read ahead in file
Message-Id: <33e5e247.253310881@news.sol.co.uk>
I have a file that I have opend as a filehandle into an array and am
stepping through it ia while loop.
What I would like to do is at one point in the loop is look at the
next line in the file and compare it with the current line: see pseudo
code
while(<FILE>){
if ( current $array[0] ne next $array[0]){
do something
}
}
Anyone help?
Mark Guz
Scotland On Line
http://www.scotland.net
------------------------------
Date: Mon, 04 Aug 1997 12:02:17 -0600
From: paries@advicom.net
Subject: Sorting a password file
Message-Id: <870713967.9556@dejanews.com>
Hello,
I have a file that is : delimited
uname:passwd:group:auth
what I am trying to do is order by group and load it into a array of
arrays fot one particular group or auth.
Thanks for any help or pointers to doc.
Randy Paries
paries@advicom.net
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Mon, 4 Aug 1997 15:00:07 GMT
From: Tim Howland <thowland@vsicom.com>
To: paries@advicom.net
Subject: Re: Sorting a password file
Message-Id: <EEEKoC.1wu@nonexistent.com>
paries@advicom.net wrote:
>
> Hello,
>
> I have a file that is : delimited
> uname:passwd:group:auth
>
> what I am trying to do is order by group and load it into a array of
> arrays fot one particular group or auth.
>
> Thanks for any help or pointers to doc.
>
> Randy Paries
> paries@advicom.net
>
> -------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
try looking up the following commands in the perlfunc manpage-
open
split
sort
try something like :
#!/usr/bin/perl -w
open(FILE, $filename) || die "Couldn't read $filename- $!";
while (<FILE>) {
($uname, $passwd, $group $auth) = split (/:/);
if ($group eq $gTargetGroup) {
print "\tMatch: $uname : $passwd $group $auth\n";
}
}
Obviously, this doesn't do all you asked... you should look at perldsc,
the perl data structures cookbook, for a good handle on how to store and
retrieve records. For bonus points, you can try the perlobj manpage- if
you do this object oriented, it'll definitely be much more ... uhh..
objecty. objectable?
Hope this helps.
Tim
------------------------------
Date: Mon, 04 Aug 1997 10:01:58 -0600
From: kowalski@cebaf.gov
Subject: time function
Message-Id: <870705607.30385@dejanews.com>
I am using the time function with perl 5.002 to get the time in seconds,
then execute some code, and then get the time again. If the difference
between the to times is greater than 3 seconds, I print out the current
status of the script (variables,etc). All this is done in a while loop
and takes about 2 minutes to complete.
The script works fine on HP-UX and Solaris, but not on AIX. I am using
AIX 4.1.4. What happends is the time function does not return the
correct number of seconds that have past. So if the script completes
in 2 minutes, the output states that only 18 seconds have passed.
Does anyone have a better way to accomplish the same thing or
a way to correct the problem? Just in case it makes a difference, the
calls between the time functions are mostly syswrite and sysread.
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Mon, 4 Aug 97 11:02:29 +0100
From: carelf@demon.nl
Subject: Re: Unable to create sub
Message-Id: <9708041102.aa28146@kantoor.demon.nl>
In article <9708041015.aa07473@kantoor.demon.nl>, <carelf@demon.nl> wrote:
> }
> close(IDXF);
> return(0);
> }
>}
>
Oops, the close(IDXF); return(0); are of course outside the while loop.
"Cut&Paste error 1021 :("
------------------------------
Date: Mon, 4 Aug 1997 11:04:19 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Alex `Taker` Pircher <pircher@informatik.tu-muenchen.de>
Subject: Re: Unable to create sub
Message-Id: <Pine.GSO.3.96.970804110058.27878R-100000@kelly.teleport.com>
On Fri, 25 Jul 1997, Alex `Taker` Pircher wrote:
> sub blabla {
> open(test,'/sbin/ls |');
You should probably use all caps for a filehandle, calling it TEST instead
of test. You should certainly check the return value for open.
open TEST, '/sbin/ls |'
or die "Can't open pipe from ls: $!";
> while($line=<test>) { print(NS $line); }
> close(test);
> }
> Unable to create sub named "" at ./test.pl line 414, <test> chunk 21.
>
> What does that mean?
If, as I suspect, line 414 is one of the ones you quoted, then you seem to
have found a bug in Perl, in which it's returning a bogus error message.
If you can reproduce it with a ten-line script under 5.004, please run
perlbug to report it. Thanks!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
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 813
*************************************