[8049] in Perl-Users-Digest
Perl-Users Digest, Issue: 1674 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 19 16:17:28 1998
Date: Mon, 19 Jan 98 13:00:24 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 19 Jan 1998 Volume: 8 Number: 1674
Today's topics:
"LWP::Simple;" Problem (Phil Buckley)
add a subroutine - need help please <perlhell@hotmail.com>
Re: Another Stupid Question (sort) (Mike Stok)
Re: date & Expiration? (Charles DeRykus)
Re: Deleting specific lines from text files. <rootbeer@teleport.com>
Re: Does anyone know where to get a WIN NT 4.0 version (Jim Weisgram)
Re: finding member of a list <sgordon@athena.lbl.gov>
Re: How on earth....?!?! <James@cydaps.nospam.co.uk>
Re: How to write fixed format data? (Tad McClellan)
Re: I need a man to lick me in to a frenzy!!! <rootbeer@teleport.com>
Re: IIS4 Please Help! tmoore@starsysfw.com
Re: localtime: <richard.remington@gateway2000.com>
Re: localtime: <jahnel@xarch.tu-graz.ac.at>
Re: MS-DOS Window Suppression for Perl System Calls <nmendes@logiser.pt>
Re: Perl 5 and ORACLE 7 on Windows 95 <nmendes@logiser.pt>
Re: PERL forking <rootbeer@teleport.com>
Re: Problems running Perl 5 on NT 4.0/Netscape Enterpri <pete@superpan.demon.co.uk>
Re: Reload by perl - is it possible? <palincss@nicom.com>
Re: Reload by perl - is it possible? <rootbeer@teleport.com>
Re: Sockets and Deadlock :-( <rootbeer@teleport.com>
Sorting an Associative Array <xwang@d.umn.edu>
Re: source into binary code (Greg Bacon)
Re: Switch statement in Perl-5??? <ajohnson@gpu.srv.ualberta.ca>
Trial and Error Previals! (lessons learned sockets) <johnrs@dc.net>
UPDATE - "LWP::Simple;" Problem (Phil Buckley)
Re: Use of uninitialized value at fastbib.pl line 103. (Tad McClellan)
Re: Use of uninitialized value at fastbib.pl line 103. <rootbeer@teleport.com>
Re: Using Menus in Perl-5 <rootbeer@teleport.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 19 Jan 1998 18:46:53 GMT
From: !pbuckley@tiac.net (Phil Buckley)
Subject: "LWP::Simple;" Problem
Message-Id: <34c398f7.11224046@News.Varian.COM>
Hi everyone,
I am still very bad at perl, but I did find a really great perl
program at this guys site, he was kind enough to share it with me, but
I can't get it to work correctly on my server.
I am receiving the following error message:
Can't locate LWP/Simple.pm in @INC (@INC contains:
/usr/lib/perl5/i386-openbsd/5.00404 /usr/lib/perl5
/usr/lib/perl5/site_perl/i386-openbsd /usr/lib/perl5/site_perl .) at
/home/us001287/cgi-bin/stockquote.pl line 21.
BEGIN failed--compilation aborted at
/home/us001287/cgi-bin/stockquote.pl line 21.
[Wed Jan 14 08:06:14 1998] [error] Premature end of script headers:
/home/us001287/cgi-bin/stockquote.pl
So, what's at line 21 your wondering???:
(I've numbered the lines because of wrapping)
1.#!/usr/bin/perl
2.
3.
4.#======================================================================
5.# Jonathan Busch (busch@7comm.com) last update 1/13/98
6.# Developed by 7 Communications www.7comm.com
7.#======================================================================
8.# 7 COMMUNICATIONS GIVES NO WARRANTY, EXPRESSED OR IMPLIED,
9.# FOR THE SOFTWARE PROVIDED, INCLUDING, WITHOUT LIMITATION,
10.# WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A
11.# PARTICULAR PURPOSE.
12.#======================================================================
13.
14.
15. #
16. # Portfolio array (name, shares, symbol)
17. #
18. @portfolio = ("Dow Jones","0","^DJI","Thermo
Electron","150","TMO","Pepsico", "250","PEP","Walgreens","620","WAG",
"Merck","200","MRK","Synovus","337","SNV","Dana
Corp","100","DCN","Nabors Ind.","100","NBR","EMC Corp","70","EMC",
"Analog Devices","100","ADI","Rubbermaid","100",
"RBD","Outback","90","OSSI","Pairgain","100","PAIR");
19.
20. # Create a user agent object
21. use LWP::Simple;
22.
23. #
24. # Get stock quotes - UPDATE FOR EACH NEW STOCK PURCHASE
25. #
26. $doc = get
"http://quote.yahoo.com/download/quotes.csv?symbols=^DJI+TMO+PEP+WAG+MRK+SNV+DCN+NBR+emc+adi+rbd+OSSI+PAIR&format=sl1d1t1c1ohgv&ext=.csv";
27. $doc =~ tr/\n/,/;
28. $doc =~ tr/"/ /;
29. @stocks = split (/,/,$doc);
30.
31. #
32. # HTML Output
33. #
<much snipped blow>
(To see it working correctly, you can see it at:
http://www.7comm.com/cgi-bin/cgiwrap/busch/stockquotes2.pl)
Any ideas? Any guidance?
Phil Buckley
pbuckley@tiac.net
http://www.greatwebdesign.com/
remove the "!" before replying via e-mail
------------------------------
Date: Mon, 19 Jan 1998 10:51:42 -0800
From: kristi <perlhell@hotmail.com>
Subject: add a subroutine - need help please
Message-Id: <34C3A0BE.AFA3BADC@hotmail.com>
I would like to a subroutine to my existing formmail program, but need
some help. I have printed the FAQ's and will be reading through those
as well...
Currently, my perl program grabs the input from an html form and
generates an email message to the recipient in a nice laid out manner.
Now, I would like to add a sub that grabs the same information, and
writes (or append) it to a tab (or comma) delimited text(ASCII) file.
I'm not too sure how to make that happen. Any help or starting points
would be greatly appreciated...
Thanks everyone...
K
------------------------------
Date: 19 Jan 1998 13:50:11 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Another Stupid Question (sort)
Message-Id: <6a0793$1fu$1@stok.co.uk>
In article <6a05lt$2kr$1@samba.rahul.net>,
Todd McLaughlin <toddm@rahul.net> wrote:
>
>How do I sort a 2D array by the second field (numeric)? Here's what I
>have so far. Am I getting close?
>
>@sorted = sort {$a[][1] <=> $b[][1]} @unsorted;
You could look in section 4 of the FAQ, which comes as a document viewable
with
perldoc perlfaq4
in recent perl distributions or can be found by browsing
http://www.perl.com/
How do I sort an array by (anything)?
Supply a comparison function to sort() (described in the
sort entry in the perlfunc manpage):
@list = sort { $a <=> $b } @list;
The default sort function is cmp, string comparison, which
would sort (1, 2, 10) into (1, 10, 2). <=>, used above,
is the numerical comparison operator.
If you have a complicated function needed to pull out the
part you want to sort on, then don't do it inside the sort
function. Pull it out first, because the sort BLOCK can
be called many times for the same element. Here's an
example of how to pull out the first word after the first
number on each item, and then sort those words case-
insensitively.
@idx = ();
for (@data) {
($item) = /\d+\s*(\S+)/;
push @idx, uc($item);
}
@sorted = @data[ sort { $idx[$a] cmp $idx[$b] } 0 .. $#idx ];
Which could also be written this way, using a trick that's
come to be known as the Schwartzian Transform:
@sorted = map { $_->[0] }
sort { $a->[1] cmp $b->[1] }
map { [ $_, uc((/\d+\s*(\S+)/ )[0] ] } @data;
If you need to sort on several fields, the following
paradigm is useful.
@sorted = sort { field1($a) <=> field1($b) ||
field2($a) cmp field2($b) ||
field3($a) cmp field3($b)
} @data;
This can be conveniently combined with precalculation of
keys as given above.
See http://www.perl.com/CPAN/doc/FMTEYEWTK/sort.html for
more about this approach.
See also the question below on sorting hashes.
but you might get away with this untested fragment:
@sorted = sort {$a->[1] <=> $b->[1]} @unsorted;
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@colltech.com | Collective Technologies (work)
------------------------------
Date: Mon, 19 Jan 1998 18:30:06 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: date & Expiration?
Message-Id: <En1nE6.G7I@bcstec.ca.boeing.com>
In article <6a02fk$b0o$1@usenet76.supernews.com>, Kupid <kupid@ecom.net> wrote:
>What I'm trying to do is make a certain line in a file delete 15 days from
>the creation date. For example:
>
>On my website.. when a person posts a message, it goes into my
>text-based...database. 15 days after the initial post.. I want the line
>deleted from the database.
>
>Does anyone know of any date code, and the method in how to do this?
>
>I've tried stamping the day, month, and year.. then saying this:
>
>if ($day >= $databaseday + 15) { &startdelete}
>
>Obviously, this code is very limited.. and very inaccurate. So.. if anyone
>can help me, I'd really appreciate it.
>
>Thanks!
>
>David
>
You might want to check out Date::Manip or Date::Calc in CPAN.
or, even something like:
$databaseday = time(); # store initial date
if (time() - $databaseday >= 3600 * 24 * 15) { # periodic check
&startdelete
}
HTH,
--
Charles DeRykus
------------------------------
Date: Mon, 19 Jan 1998 11:56:15 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: James <James@cydaps.nospam.co.uk>
Subject: Re: Deleting specific lines from text files.
Message-Id: <Pine.GSO.3.96.980119115411.9757X-100000@user2.teleport.com>
On Mon, 19 Jan 1998, James wrote:
> Subject: Deleting specific lines from text files.
Have you seen what the FAQ has to say about this, in section 5?
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/
Ask me about Perl trainings!
------------------------------
Date: Mon, 19 Jan 1998 19:17:36 GMT
From: jweisgram@hotmail.com (Jim Weisgram)
Subject: Re: Does anyone know where to get a WIN NT 4.0 version of PERL 5?
Message-Id: <34c7a5cd.65475387@news.teleport.com>
"David W. Faix" <faixinc@crosslink.net> wrote:
>Looking for a quick way to get perl running under windows NT?
>Many thanks
>David W. Faix
>faixinc@crosslink.net
There are several ports. I assume you mean Perl 5. If so, there are 2
"competing" ports. The Perl home page www.perl.com has links to these. Scroll to
the bottom of the screen to find them.
--
All opinions expressed are mine and not my employers (but they ought to be)
Jim Weisgram
Oregon Department of Transportation
------------------------------
Date: Mon, 19 Jan 1998 11:06:04 -0800
From: Shawn Gordon <sgordon@athena.lbl.gov>
To: Ritchard Shadian <rshadian@hawaii.edu>
Subject: Re: finding member of a list
Message-Id: <34C3A41C.20DE1493@athena.lbl.gov>
Ritchard Shadian wrote:
>
> Is there a Perl function for checking whether a particular scalar value is
> contained within a list/array
Take a look at the grep function. eg:
@weather = qw(rain showers floods mudslides); # its is a little wet
here...
if(grep $_ eq 'floods', @weather) {print "Better get started on that
arc!\n"};
if(grep $_ eq 'sun', @weather) {print "Hah, don't you wish\n"};
shawn
------------------------------
Date: Mon, 19 Jan 1998 18:56:27 +0000
From: James <James@cydaps.nospam.co.uk>
Subject: Re: How on earth....?!?!
Message-Id: <c+VxENAbH6w0Ewo3@cydaps.co.uk>
On Mon, 19 Jan 1998, Kupid wrote:
>This is the project we have planned on our site. Actually, this is very
>simple:
>
I wish! I thought I had found the solution earlier but it kept returning
server error although when I tried debugging the script it came up
clean!
>Say that this is the database that you have.. which uses a comma delimiter.
>
>(job title, job function, hours per day, hours per week)
>
Okay, can cope with that bit! :-)
>When a person subscribes to "Cool Notify", print his info in the same format
>as your main database.
>
Yup, okay, in a separate database file, so all subscribers are listed in
the one file? That is how we would like to do it anyway and this is how
I see the search working as then I can use the:
open (CVDATABASE, etc #opens the list of people wanting jobs
foreach $pair (<CVDATABASE>) etc #foreach line start search operation
open (DATABASE, etc
Try to match jobs, if match email it to user.
close (DATABASE);
etc
>Schedule your "Cool Notify" database to be checked against your main
>database once or twice per day.
>
How do you do this? What commands can be used to auto start a perl
script?
>You would split the delimters on both databases. Loop through the databases.
>
I can cope with splitting the delimiters, but how would I loop through
the databases?
>For each delimiter value/s in the "Cool Notify" database that matches the
>delimter value/s in the main database.... send the person an e-mail message,
>letting them know whatever you want to let them know.
>
Can just manage this bit I think, but would this cause a separate email
to be sent for each job match or can they all be incorporated into the
one email?
>Hope this helps.
>
Helps me know I was looking at it along the right lines, just wish I was
better at perl, must learn it properly instead of just using the same
old scripts over and over!
>David
>
Thanks for the help
James
>
>
Please remove nospam. if emailing.
------------------------------
Date: Mon, 19 Jan 1998 13:12:58 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: How to write fixed format data?
Message-Id: <qj80a6.hsm.ln@localhost>
Pascal Houde (houde@fox.cisti.nrc.ca) wrote:
: I'm currently using the format function to set a fixed record.
: So it looks like:
: format my_record =
: @<<<<<<@<<@<<<< etc...
: $field1,$field2,$field3, etc...
: The problem is that my fixed record is over 1000 chars long!
: Some fields are 200 long. So you imagine the number of <<< I have!
: Is there any other way to set a fixed record in a simpler way?
printf() instead of format maybe?
: Please send the reply directly to me.
Nope. If I do that then nobody else gets access to the answer.
I find your request somewhat selfish.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 19 Jan 1998 11:23:53 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Andrew Spiers <andrew.spiers@virgin.net>
Subject: Re: I need a man to lick me in to a frenzy!!!
Message-Id: <Pine.GSO.3.96.980119112255.9757T-100000@user2.teleport.com>
On Mon, 19 Jan 1998, Andrew Spiers wrote:
> Which module does this ? cgi - or is it lwp
For this purpose, those modules really suck.
Uhm... I mean... Never mind.
--
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/
Ask me about Perl trainings!
------------------------------
Date: Mon, 19 Jan 1998 19:13:20 GMT
From: tmoore@starsysfw.com
Subject: Re: IIS4 Please Help!
Message-Id: <34c3a528.493935131@snews.zippo.com>
On Sat, 3 Jan 1998 00:46:55 -0600, "Bob Martin" <BobMartin@inu.net>
wrote:
>I just got IIS4.0 to run my scripts. First, I recommend that you map .pl to
>PerlIs.dll. That way you don't run multiple instances of Perl.exe, and you
>don't leave yourself open to hackers.
>
I tried this Bob... I got a message that it couldn't find the
specified module. Mapping to perl.exe works well however. I am
using Active State's Perl. If you have any insights on what the
problems might be, I would prefer to be running the .dll.
Thanks
Tom Moore
tmoore@starsysfw.com
------------------------------
Date: Mon, 19 Jan 1998 13:06:42 -0600
From: Richard Remington <richard.remington@gateway2000.com>
Subject: Re: localtime:
Message-Id: <34C3A442.5BD330E6@gateway2000.com>
Jahnel Klaus wrote:
>
> i get the time with localtime:
> i ve now a problem:
> how can i handle it to delete files which are older than 2 days of
> actual date?
> Klaus
easy. don't use it. use -M on a file.
opendir DIR, "$wherever";
@files = readdir DIR;
closedir DIR;
foreach $file (@files) {
if (-M "$wherever/$file" > $some_date_measured_in_days) {
unlink ("$cart_directory\\$file");
}
}
adam
------------------------------
Date: Mon, 19 Jan 1998 21:15:29 +0100
From: Jahnel Klaus <jahnel@xarch.tu-graz.ac.at>
To: Richard Remington <richard.remington@gateway2000.com>
Subject: Re: localtime:
Message-Id: <34C3B461.E8BAFCEB@xarch.tu-graz.ac.at>
BUt i don t have a file i have entries in a file to delete.
klaus
Richard Remington wrote:
> Jahnel Klaus wrote:
> >
> > i get the time with localtime:
> > i ve now a problem:
> > how can i handle it to delete files which are older than 2 days of
> > actual date?
> > Klaus
>
> easy. don't use it. use -M on a file.
>
> opendir DIR, "$wherever";
> @files = readdir DIR;
> closedir DIR;
>
> foreach $file (@files) {
> if (-M "$wherever/$file" > $some_date_measured_in_days) {
> unlink ("$cart_directory\\$file");
> }
> }
>
> adam
------------------------------
Date: Mon, 19 Jan 1998 19:08:34 +0000
From: Nuno Mendes <nmendes@logiser.pt>
Subject: Re: MS-DOS Window Suppression for Perl System Calls
Message-Id: <34C3A4B2.8C2C640D@logiser.pt>
I'm having the same problem on a Windows NT machine. It doesn't happen
on my Win95 workstation.
Lance Arnder wrote:
> Is there a way to suppress the generation of an MS-DOS window
> each time I do a system call from Perl for Win32? The window
> stays open for the duration of time that the system call needs
> to run and then closes. Seeing this window open and close
> is distracting.
>
> Thanks,
>
> Lance Arnder
> Department of Radiology
> University of North Carolina at Chapel Hill
> lla@med.unc.edu
------------------------------
Date: Mon, 19 Jan 1998 19:08:50 +0000
From: Nuno Mendes <nmendes@logiser.pt>
Subject: Re: Perl 5 and ORACLE 7 on Windows 95
Message-Id: <34C3A4C2.31CDFF6B@logiser.pt>
Can you use an ODBC driver? If yes try Win32::ODBC .
It's working fine with me-
Mikhail Zelmanov wrote:
> Hi.
>
> I am running Perl 5 and ORACLE 7 on Windows 95 .
> Does someone can tell me how can I access ORACLE 7 database from Perl 5 in
> Windows 95 .
>
> Thanks.
> Mike. mzelmanov@qquest.com
------------------------------
Date: Mon, 19 Jan 1998 11:59:04 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Anders Nilsson <an@oso.chalmers.se>
Subject: Re: PERL forking
Message-Id: <Pine.GSO.3.96.980119115740.9757Y-100000@user2.teleport.com>
On Mon, 19 Jan 1998, Anders Nilsson wrote:
> When a subprocess terminates from a fork it becomes a zombie.
Have you seen what section 8 of the FAQ has to say about this? 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/
Ask me about Perl trainings!
------------------------------
Date: Mon, 19 Jan 1998 19:15:41 +0000
From: Pete Miller <pete@superpan.demon.co.uk>
Subject: Re: Problems running Perl 5 on NT 4.0/Netscape Enterprise 3.0
Message-Id: <AipxAEAdZ6w0Ewr6@superpan.demon.co.uk>
In article <34BFC08B.795FCD37@dentistry.unc.edu>, Brad Argue
<brad_argue@dentistry.unc.edu> writes
>I have a good deal of experience running Perl scrips on UNIX web
>servers, but have recently become responsible for a NT 4.0 server
>running Netscape Enterprise 3.0. I installed Perl 5 for Win32 and am
>able to get simple scripts to run via the command line. I am also able
>to get batch files in my cgi-bin to run via a Netscape browser.
>However, whenever I try to run a simple .pl script from the browser, it
>returns the error:
>----------
>Server Error
>
>This server has encountered an internal error which prevents it from
>fulfilling your request. The most likely cause is a misconfiguration.
>Please ask the administrator to look for messages in the server's error
>log.
>----------
>The error log reports:
>
>[16/Jan/1998:15:00:57] failure: for host 152.2.159.238 trying to GET
>/cgi-bin/test.pl, send-cgi reports: could not send new process (Error
>Number is unknown)
>[16/Jan/1998:15:00:57] failure: cgi_send:cgi_start_exec
>d:\enterprise\cgi-bin\test.pl failed
>----------
>
>Permissions on the cgi-bin directory are set so that anyone can execute
>and the Enterprise server is set to recognize all files in the cgi-bin
>as cgi scripts. The suffix 'pl' is mapped to the content-type
>'application/x-perl' in the Global Mime Types file on the web server.
>What am I missing here?
>
>Many thanks.
>
>Brad Argue
>brad_argue@dentistry.unc.edu
>
Brad...
Put the perl code in the cgishell directory. Should work fine then.
I tried some code in the cgibin directory and received the same format
error message.
--
Pete Miller
------------------------------
Date: Mon, 19 Jan 1998 14:40:49 -0800
From: Steve Palincsar <palincss@nicom.com>
Subject: Re: Reload by perl - is it possible?
Message-Id: <34C3D671.13D9@nicom.com>
Sounds a lot like something they'd discuss in rec.guns...
brian d foy wrote:
>
> In article <34C38B32.F7ED42FA@ccg.uc.pt>, Nuno Borges <nborges@ccg.uc.pt> posted:
>
> >I don't know if my question is stupid or not, but i'd like to get an
> >answer...
> >Is it possible to make a reload by a command of perl? Is there any
> >language that permit to do so?
>
> probably. what's "to make a reload"?
>
> --
> brian d foy <comdog@computerdog.com>
> CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
> Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: Mon, 19 Jan 1998 12:48:50 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Nuno Borges <nborges@ccg.uc.pt>
Subject: Re: Reload by perl - is it possible?
Message-Id: <Pine.GSO.3.96.980119124428.9757f-100000@user2.teleport.com>
On Mon, 19 Jan 1998, Nuno Borges wrote:
> Is it possible to make a reload by a command of perl?
It sounds to me as if you want to make a remote web browser reload a page.
If that's possible, the way to do it would be to output a certain command
from your program. Whatever output that is, it isn't Perl-specific; the
text is the same no matter what language you're programming in. If you
can't find the answer in the docs, you may need to ask in a newsgroup
about your browser or the protocol you're using. Good luck!
--
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/
Ask me about Perl trainings!
------------------------------
Date: Mon, 19 Jan 1998 12:19:46 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: john -r s <johnrs@dc.net>
Subject: Re: Sockets and Deadlock :-(
Message-Id: <Pine.GSO.3.96.980119121746.9757b-100000@user2.teleport.com>
On Mon, 19 Jan 1998, john -r s wrote:
> while(<NS>){
> $list .= $_;
> }
When will that loop finish? I don't think it can be done unless the client
disconnects. You probably want to read one line and process it, then
either disconnect or return for the next line. 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/
Ask me about Perl trainings!
------------------------------
Date: Mon, 19 Jan 1998 13:51:35 -0600
From: Xiong Wang <xwang@d.umn.edu>
Subject: Sorting an Associative Array
Message-Id: <34C3AEC7.4556C90D@d.umn.edu>
Does anybody know how to sort an associate array?
For example, I have %assoc_array = (3 =>"dddd", 4=>"aaaa",
2=>"cccc"....). And I want to change it into: (4=>"aaaa", 2=>"cccc",
3=>"dddd".....).
Thanks.
Xiong
xwang@d.umn.edu
------------------------------
Date: 19 Jan 1998 20:36:21 GMT
From: gbacon@adtran.com (Greg Bacon)
Subject: Re: source into binary code
Message-Id: <6a0dg5$20k$1@info.uah.edu>
In article <69rrut$lun$1@news.orst.edu>,
stanley@skyking.OCE.ORST.EDU (John Stanley) writes:
: Why do people keep trying to prove to me that giving code away for free
: is such a great way to make a living by using examples where the author
: is making a living by selling something? Before you can say that someone
: makes a living doing something, you have to show that he actually makes
: a living doing that and not by doing something else.
If that is how you've read what people have been trying to tell you,
then you misunderstand. Let's take a stroll down Sesame Street:
Tom Christiansen wrote in <69oh1s$jvf$1@csnews.cs.colorado.edu>:
"They are simpy [sic] hired to write something, under condition that
it be giveawayable, or reusable by the writer. You get paid for a
service: writing the code."
I don't see where Tom tried to prove "that giving code away for free is
such a great way to make a living". It is clear to me that he meant it
is possible for one to make a living while still making software freely
available.
Tom Phoenix wrote in
<Pine.GSO.3.96.980117174340.1296G-100000@user2.teleport.com>:
"You can make a good living by giving away the source while
retaining or selling the rights to use it."
Again, the claim isn't that you're making a living by giving away
software. The claim is that one can *simultaneously* sell the
service of creating or modifying software and contribute the result
of that service to the sum of freely available software.
In the strictest sense, one can "make a living" by selling the benefit
of one's experience and knowledge. That vice of benevolence and giving
stuff away may be considered a private perversion. :-) The two aren't
necessarily connected.
...or perhaps it's just me, and I'm reading between some obscure, hidden
lines in both of these guys' posts. Nevertheless, I believe firmly in
the free software movement and have myself made decent money by charging
for the time it took me to write software which I retained the right to
make freely available.
Source hoarders be damned.
Greg
--
open G,"|gzip -dc";$_=<<EOF;s/([0-9a-f]+)/print G pack"h*",$1/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Mon, 19 Jan 1998 12:50:03 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Switch statement in Perl-5???
Message-Id: <34C3A05B.24BFC368@gpu.srv.ualberta.ca>
David Mohorn wrote:
>
> What? Perl-5 doesn't have a switch statement like C? How can I do a menu?
search for 'switch' in the perlsyn manpage...there are many
examples of perlish equivelants to switch type contructs.
regards
andrew
------------------------------
Date: Mon, 19 Jan 1998 15:00:22 -0500
From: john -r s <johnrs@dc.net>
Subject: Trial and Error Previals! (lessons learned sockets)
Message-Id: <34C3B0D4.3CE949E6@dc.net>
I am posting my findings to help others who may have similar problems
with deadlock.
I used the examples at CPAN to test and could not get 2 way commo
between server and client. All of the examples explained how to do 2
way communications but never really showed an good example.
1. I modified both the server and client to use module "FileHandle" and
the autoflush(). This change may or may not have helped to an extent.
Just seems like the thing to do.
2. The real change was the way the server gets its initial input from
the client. All of the examples I found were as follows:
while(<SOCKET_HANDLE>){
$data = $_; #I also used $data .= $_;
}
The change was as follows:
$data = (<SOCKET_HANDLE>);
This seemed to undo the symptom of deadlock.
After I clean up my work I will post the client and server examples for
others to use.
Thanks to all for the help.
--
john -r s (unix spelling)
johnr~s (Windows 3.1 spelling)
JOHNRS (DOS spelling)
John R S (Win95 spelling)
------------------------------
Date: Mon, 19 Jan 1998 19:06:28 GMT
From: pbuckley@tiac.net (Phil Buckley)
Subject: UPDATE - "LWP::Simple;" Problem
Message-Id: <34c3a2c7.13736543@News.Varian.COM>
Now, I'm getting a new message:
[Mon Jan 19 13:54:56 1998] [error] [7162] (35)Resource temporarily
unavailable: couldn't spawn child process:
/home/us001287/cgi-bin/stockquote.pl
Thanks in advance...
Phil Buckley
pbuckley@tiac.net
http://www.greatwebdesign.com/
remove the "!" before replying via e-mail
------------------------------
Date: Mon, 19 Jan 1998 13:10:37 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Use of uninitialized value at fastbib.pl line 103.
Message-Id: <df80a6.hsm.ln@localhost>
Dean Hoover (dhoover@textwise.com) wrote:
: Why is this message emitted? The statement that it is warning on
: looks like this:
: if (defined $oldhandler)
: Obviously, I am attempting to do the right thing... So why
: is it warning me?
perl -e 'if (defined $oldhandler) {print "yep\n"}'
remains silent for me...
Can't duplicate the problem. Can't fix the problem. Sorry.
(maybe you need to give more of the surrounding code? Maybe you have
an 'off by one' (or more) error on the line number?
)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 19 Jan 1998 12:37:02 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Dean Hoover <dhoover@textwise.com>
Subject: Re: Use of uninitialized value at fastbib.pl line 103.
Message-Id: <Pine.GSO.3.96.980119123311.9757d-100000@user2.teleport.com>
On Mon, 19 Jan 1998, Dean Hoover wrote:
> Why is this message emitted? The statement that it is warning on
> looks like this:
>
> if (defined $oldhandler)
Sometimes the parser (or whatever) doesn't number lines the same way that
you and I would. That line shouldn't be able to trigger a warning about an
undefined value, but something in the body of the if may be at fault.
(This could be construed as a bug. :-)
Another possible culprit would be if $oldhandler were a tied variable, but
that's unlikely.
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/
Ask me about Perl trainings!
------------------------------
Date: Mon, 19 Jan 1998 11:21:30 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: David Mohorn <david.mohorn@sourcebbs.com>
Subject: Re: Using Menus in Perl-5
Message-Id: <Pine.GSO.3.96.980119111506.9757S-100000@user2.teleport.com>
On Mon, 19 Jan 1998, David Mohorn wrote:
> The only thing I find lacking in Perl is a switch/case statement.
Have you seen what section 7 of the FAQ and the perlsyn manpage have to
say about this? Besides those methods, you could consider having a hash of
coderefs. Randal's eighth Unix Review column has a good example of doing
this.
http://www.stonehenge.com/merlyn/UnixReview/
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/
Ask me about Perl trainings!
------------------------------
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 1674
**************************************