[7699] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1325 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 16 19:07:27 1997

Date: Sun, 16 Nov 97 16: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           Sun, 16 Nov 1997     Volume: 8 Number: 1325

Today's topics:
     5.004_04 pod2html Bug+Fix <mschilli@blaxxun.com>
     Re: 500 Internal Server Error (brian d foy)
     Re: [Q]: Arbitrary sort on field names (Martien Verbruggen)
     Re: [Q]: Arbitrary sort on field names (Martien Verbruggen)
     A wierd error: Premature end of script headers <jaydee@worsdall.demon.co.uk>
     Re: A wierd error: Premature end of script headers (brian d foy)
     Re: cgi help (brian d foy)
     Re: combining 2 images(gif or jpg)? (Martien Verbruggen)
     continued match? (Gustav Kristoffer Ek)
     Re: continued match? <joegottman@worldnet.att.net>
     Re: Debugging CGI programs (brian d foy)
     Re: Embedded Perl: SvNOK fails for SVt_PVNV (Jan Dubois)
     Re: FILE (Martien Verbruggen)
     Re: GD.pm installation problem on WinNT 4.0 (Martien Verbruggen)
     Re: Get the E-mail ?? (Jeremy D. Zawodny)
     Re: I am  having trouble reading in a variable from a f (Martien Verbruggen)
     Interest in Phila area Perl classes? <joseph@5sigma.com>
     Re: Newbie Q. How to flush print output mid-script? <webmaster@visionary-western.co.uk>
     Re: Newbie Q. How to flush print output mid-script? <webmaster@visionary-western.co.uk>
     Newbie Question <nyc-guy@ix.netcom.com>
     Re: Origin of "Nutshell"-Scripts on CPAN? <jhi@alpha.hut.fi>
     passing variables (John Saya)
     perl compile on Win95 and BCC <egley@albany.net>
     Re: recursion, help, I'm scared. (Bill Mitchell)
     Re: Sort example for Dummy ?? (Henry Gabryjelski)
     Re: Sort example for Dummy ?? <joseph@5sigma.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sun, 16 Nov 1997 12:40:03 -0800
From: Michael Schilli <mschilli@blaxxun.com>
Subject: 5.004_04 pod2html Bug+Fix
Message-Id: <346F5A23.5241C9B4@blaxxun.com>

Hi folks,

just found a bug in pod2html. process_text in Pod::Html.pm first
replaces
characters like " by &quot; and then does the Hyperlink-Substitution,
like

POD:
    This is a list of urls: ("http://abc.com", "http://dev.com");

becomes

HTML:
    <PRE>    This is a list of urls: (&quot;<A
HREF="http://abc.com&quot">
                                                                    ^^^^
             http://abc.com&quot</A>;, &quot;<A
HREF="http://dev.com&quot">
                                   ^^^                              
^^^^
             http://dev.com&quot</A>;);
                                   ^^^
    </PRE>

The key to this is that Html.pm assumes that &quot; is a valid URL part.
The
following fix in Html.pm (the one that came with 5.004_04) works for me:


1058a1060,1067
>   my $nourlpart = '(' . join ('|', qw{
>                 &amp;
>                 &lt;
>                 &gt;
>                 &quot;
>             } ) 
>         . ')';
> 
1100a1110,1111
>             |                       # or else
>                 $nourlpart          # 


What do you think?

-- Michael

-- Michael

----------------------------------------------------------
  Michael Schilli         http://mission.base.com/mschilli
----------------------------------------------------------


------------------------------

Date: Sun, 16 Nov 1997 18:44:09 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: 500 Internal Server Error
Message-Id: <comdog-ya02408000R1611971844090001@news.panix.com>

In article <64if0e$i76@bgtnsc03.worldnet.att.net>, accu-scan@worldnet.att.net wrote:

>> perldoc perlfaq9
>> 
>> read the FAQ.
>
>I'm new, and getting this same error. You make reference to a FAQ to
>read but you don't mention where it can be located. An oversight maybe?
>I'd like to correct this problem if I can track down this FAQ.

www.perl.com has references to just about everything perl.

you could also try the stuff in the CGI Meta FAQ.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


------------------------------

Date: 16 Nov 1997 21:25:11 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: [Q]: Arbitrary sort on field names
Message-Id: <64nobn$4du$2@comdyn.comdyn.com.au>

In article <toutatis-ya023180001411971019360001@news.euro.net>,
	toutatis@_SPAMTRAP_toutatis.net (Toutatis) writes:
> mgjv@comdyn.com.au (Martien Verbruggen) wrote:

[embarrassment snip]

> Your code will not compile (missing comma after pop) and leaves you with an
> empty @selected. Use push. Apart from that, I think in a situation where

That will teach me to test every snippet of code I post, even a small trivial
thing like that. cancelled original.

> you want every bit of speed (and that's what you want when building a
> web-application) I can imagine many situations where looping through the
> entire parent list is less efficient than a sort based on an index table.

Yes, you are right. Included this comment in repost.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd.       | again. Then quit; there's no use being
NSW, Australia                      | a damn fool about it.


------------------------------

Date: 16 Nov 1997 21:31:08 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: [Q]: Arbitrary sort on field names
Message-Id: <64noms$4du$3@comdyn.comdyn.com.au>

In article <346B12F5.A2470F6B@itis.com>,
	Prince Mystery <mystery@itis.com> writes:
> @fieldnames = ("name", "address1", "address2", "city", "state");

(repost of earlier wrong post)

You don't need to sort afterwarsd, but can do that on the fly. The
follwoing method is not very efficient, and could be made more
efficient using a lookup table (see other posts in this thread)

my @fieldnames = qw( name address1 address2 city state );
my @selected = ();

foreach my $fn (@fieldnames)
{
	push (@selected, $fn) if (_is_selected($fn));
}

# define _is_selected() here

This should give you an array @selected with the elements in the same
order as they appear in @fieldnames, eliminating the need to sort.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | In a world without fences, who needs
Commercial Dynamics Pty. Ltd.       | Gates?
NSW, Australia                      | 


------------------------------

Date: Sun, 16 Nov 1997 21:39:01 +0000
From: Mark Worsdall <jaydee@worsdall.demon.co.uk>
Subject: A wierd error: Premature end of script headers
Message-Id: <WbO5hbA1f2b0EwzD@worsdall.demon.co.uk>

What can cause this error? The script still seems to run, the error is
reported in the webservers error_log file.

Anyone help?
-- 
Mark Worsdall - Oh no, I've run out of underpants :(
Home:- jaydeeATworsdall.demon.co.uk  WEB site:- http://www.worsdall.demon.co.uk
Shadow:- webmasterATshadow.org.uk    WEB site:- http://www.shadow.org.uk


------------------------------

Date: Sun, 16 Nov 1997 19:00:08 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: A wierd error: Premature end of script headers
Message-Id: <comdog-ya02408000R1611971900080001@news.panix.com>

In article <WbO5hbA1f2b0EwzD@worsdall.demon.co.uk>, Mark Worsdall <jaydee@worsdall.demon.co.uk> wrote:

>What can cause this error? The script still seems to run, the error is
>reported in the webservers error_log file.

see the various FAQs referenced in the CGI Meta FAQ - especially the
Perl section.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


------------------------------

Date: Sun, 16 Nov 1997 18:46:43 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: cgi help
Message-Id: <comdog-ya02408000R1611971846430001@news.panix.com>

In article <64iee2$asq@mozo.cc.purdue.edu>, jacoby@harbor.ecn.purdue.edu (David Jacoby) wrote:

>In article <346BA15D.38E4CCBA@mindspring.com>,
>Phil Heaton  <ke4krt@mindspring.com> wrote:
>>On my html form:

>>read(STDIN, $SearchFor, $ENV{CONTENT_LENGTH}) ;
>
>>Let's say I enter CN021400 at the form. This sets
>>$SearchFor to "property_number=CN021400". How do I
>>get rid of "Property_number=" and just use "CN021400"??
>
>Later in your perl script:
>
>$SearchFor =~ /=/;
>$SearchFor = $';

be aware that using $' and friends is a big efficiency hit.  it
would be much easier to

   split /=/, $SearchFor, 2;

if that is what you wanted to accomplish.

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


------------------------------

Date: 16 Nov 1997 21:34:27 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: combining 2 images(gif or jpg)?
Message-Id: <64not3$4du$4@comdyn.comdyn.com.au>

In article <346A4F4C.921D8FDA@granax.dot.com>,
	shaolin <skang@granax.dot.com> writes:
> does anyone know where can i get a perl program that can combine 2 images into
> 1?
> any simple example?

To manipulate gifs, get GD.pm. Look around on CPAN to see if there are
other modules for image manipulation.  

> any pointer to any url is appreciated.

http://www.perl.com/
http://www.perl.com/CPAN/

Martien

-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | In a world without fences, who needs
Commercial Dynamics Pty. Ltd.       | Gates?
NSW, Australia                      | 


------------------------------

Date: Sun, 16 Nov 1997 22:44:05 +0100
From: stoffer@netcetera.dk (Gustav Kristoffer Ek)
Subject: continued match?
Message-Id: <stoffer-1611972244050001@loke.netcetera.dk>

hi, anyone who can tell me how to make a continued match, like $4 =~ m//;
without using $4 ?

- gustav

---------------------------------------------------------------------
Gustav Kristoffer Ek - Netcetera - Finsensvej 80 - 2000 Frederiksberg
tlf 38 88 32 22 / 20 40 00 05 / 38 88 20 38 ext 341 - Fax 38 88 30 38
Webdesign, Webhotel, Mailhotel, UUCP og mere http://www.netcetera.dk/


------------------------------

Date: Sun, 16 Nov 1997 18:21:46 -0500
From: Joe Gottman <joegottman@worldnet.att.net>
Subject: Re: continued match?
Message-Id: <64nvbb$tb@bgtnsc02.worldnet.att.net>

Gustav Kristoffer Ek wrote:
> 
> hi, anyone who can tell me how to make a continued match, like $4 =~ m//;
> without using $4 ?
> 

    Do your original match as
     $foo =~ /bar/g;

In a scalar context, this makes the program keep track of where in $foo
the last 
match was, then start immediately after that. Be sure not to modify $foo
between 
calls to this regular expression. You probably shouldn't do other
regular 
expression matches in between them either, although one done inside a
subroutine
call is probably OK.

-- 
Joe Gottman
joegottman@nospam.worldnet.att.net

[Remove nospam to reply]


------------------------------

Date: Sun, 16 Nov 1997 18:54:57 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Debugging CGI programs
Message-Id: <comdog-ya02408000R1611971854570001@news.panix.com>

[follow-ups set]

In article <Pine.SUN.3.91.971114154736.6217D-100000@cobweb.UCSC.EDU>, Navid S Kamali <navidk@cats.ucsc.edu> wrote:

>I was wondering how i can print the value of variable into standard 
>output instead of into a web page. My perl programs uses cgi.

CGI uses STDOUT.  just print to it.  perhaps you wanted to direct
data somewhere else?

>I want to be able to do something like:
>print $variable;  (for debugging purposes)

i usually do something like

   BEGIN
      {
      $debug = are_we_debugging();
      print "Content-type: text/plain\n\n" if $debug;
      }

   print "$0: value at this point is [$value]\n" if $debug

where i can set the value of debug either by changing the source or
calling the CGI script with a certain special variable in the
QUERY_STRING.  


>How do i get around this? How do i print the value into the xterm after 
>the %

if you want to test offline, see the CGI family of modules.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


------------------------------

Date: Sun, 16 Nov 1997 23:14:39 GMT
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: Embedded Perl: SvNOK fails for SVt_PVNV
Message-Id: <347250d4.43754615@news3.ibm.net>

[posted and mailed]

"carl Nygard" <nygard@knmi.nl> wrote:

[First, please don't crosspost to all Perl groups. It makes people more unlikely
to help you. Esp. comp.lang.perl is a dead group for a couple of years now.]

>I'm trying to translate an SV* to a double.  I check the SV* with SvNOK(sv)
>but it fails.  Ok, but I happen
>to know that it is a floating point number, Data::Dumper confirms.  When I
>check it with SvTYPE(sv), I get
>in return the SVt_PVNV.  What is it??  It's not in the docs, not in the
>FAQ, not in the perlguts, not in
>the Camel book, or the Adv. Perl Prgmg Panther book.  I can only conclude
>from looking at the sv.h
>file that I don't know enough about Perl internals to string together the
>proper macros.
>
>Does anyone know what SVt_PVNV (and SVt_PVIV, SVt_PVPV) means?  How do I
>translate this thing
>to a double (or int, or whatever)?

An SVt_PVNV is a SV that has been upgraded to hold either a string or a number.
This is an optimisation of the Perl interpreter to avoid continously allocating
and freeing SVs. You have to check them with SvNOK before you can call SvNV (or
with SvPOK before calling SvPV). If it is not SvNOK then it it doesn't hold a
double currently. (Well, it holds a double, but considers it's value invalid at
this very moment). It may or may not hold a string.

-Jan


------------------------------

Date: 16 Nov 1997 21:41:37 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: FILE
Message-Id: <64npah$4du$5@comdyn.comdyn.com.au>

In article <346C2E17.554F@best.ms.philips.com>,
	Joep <jleurs@best.ms.philips.com> writes:
> I need a script which places the result of multiple forms in one file on
> the server.

Multiple forms? What forms? What do you get in from these forms? Is
this CGI? Server? Are you writing IPC or sockets stuff?

> I need a script to read the results placed in this file.

You might wait until you have a script to write the file. 

If this is a CGI question, you should probably read up on CGI, and ask
the question on one of the comp.infosystems.www.* groups. if you have
an actual question about perl, you might want to show us the code you
have tried. Or at least explain a bit better what it is you want.

Martien

-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | I'm just very selective about what I
Commercial Dynamics Pty. Ltd.       | accept as reality - Calvin
NSW, Australia                      | 


------------------------------

Date: 16 Nov 1997 21:44:57 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: GD.pm installation problem on WinNT 4.0
Message-Id: <64npgp$4du$6@comdyn.comdyn.com.au>

In article <346B20C3.2C771013@dixxonn.on.ca>,
	"S. Sebastein Dixxonn" <dixxonn@dixxonn.on.ca> writes:
> Hi,
> 
> I'm getting most of the installation, but the file GD.so isn't being
> created and thus isn't being
> installed into the perl-lib directory. Can someone suggest where I can
> get a hold of the file?

On NT, I don't think you should have a GD.so. but more likely
something like a GD.dll. .so is an extension commonly used for shared
libraries on Unix boxes. If you need a GD for NT, you probably will
need to download an NT specific version. Have a look at the win32 FAQ:
http://www.perl.com/CPAN/doc/FAQs/nt/Perl_for_Win32_FAQ.html,
question 9.14.

Martien

-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | 
Commercial Dynamics Pty. Ltd.       | What's another word for Thesaurus?
NSW, Australia                      | 


------------------------------

Date: Sun, 16 Nov 1997 20:27:55 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: Get the E-mail ??
Message-Id: <346f565a.58833087@woody.wcnet.org>

[original author automagically cc'd via e-mail]

On Sun, 16 Nov 1997 19:39:50 GMT, Patrick.Comptech@ping.be (Patrick
Rosenhoj) wrote:

>How do I get the E-mail from somebody ?

Ask them.

>I mean like the way with USER_AGENT and such commands 

USER_AGENT is a server-side variable set by the web server if the
browser chooses to identify itself.

>	Or is it possible to write something  to grab somebody's
>e-mail ?

Yes, write something which says, "Hey, what's your e-mail address?"

Capture the response and do what you planned to do with it (provided
that it doesn't involve SPAM).

I'm going to guess that you were looking for something more
"automatic"--something which doesn't require the user to have to type
in their e-mail address. Most people who post this very question have
dreams of some "magic program" which can grab the e-mail address of
anyone visiting their web site.

In reality, there is no fool-proof reliable and polite way to
accomplish that. A search of past articles in this group would have
turned up similar results, I believe.

Lose the big .sig file, BTW.

Jeremy
-- 
Jeremy D. Zawodny                 jzawodn@wcnet.org
Web Server Administrator          www@wcnet.org
Wood County Free Net (Ohio)       http://www.wcnet.org/


------------------------------

Date: 16 Nov 1997 21:59:49 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: I am  having trouble reading in a variable from a file
Message-Id: <64nqcl$4du$7@comdyn.comdyn.com.au>

In article <346B3B98.876BF4C3@rdcircuits.com>,
	Gregory Czechowicz <gregc@rdcircuits.com> writes:
> Can somone let me know a good script that will do this  using
> cgi-lib.pl

Has nothing to do with cgi-lib.pl. Besides, you should be using CGI.pm
nowadays, really.

> I just want to add a number that a user submits on a form to a number
> that i have stored on my server via a text file.

#!perl -w
use strict;

my $num = 3;

# The following assumes that you have a file, called num.dat, with
# only a number on the first line.

open(NUM, 'num.dat') or die "Cannot open num.dat: $!";
my $num_dat = <NUM>;
close(NUM);

chomp($num_dat); # Just in case you have a newline in there

print "Sum: " . ($num + $num_dat) . "\n";

> Please email me at gregc@rdcircuits.com

Post here, read here.

Martien

-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | A Freudian slip is when you say one
Commercial Dynamics Pty. Ltd.       | thing but mean your mother.
NSW, Australia                      | 


------------------------------

Date: Sun, 16 Nov 1997 14:00:41 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Interest in Phila area Perl classes?
Message-Id: <346F5E8A.E6A74F8F@5sigma.com>

I'm considering arranging for use of a facility in the
Philadelphia area to teach Perl classes starting in 1998.
If anyone in the NE Corridor area is interested, let me know.
The will be the only time I post this message here, for a 
while at least.  See the web site below for more information.

	-joseph

--
Joseph N. Hall   http://www.5sigma.com/joseph/  mailto:joseph@5sigma.com
Proprietor, 5 Sigma Productions          P.O. Box 6250 Chandler AZ 85246
Perl training & software, C++/C/etc. software, web stuff, original music
*Effective Perl (A-W Fall '97) ............ http://www.effectiveperl.com
*Perl resources & instruction .............. http://www.perltraining.com


------------------------------

Date: Sun, 16 Nov 1997 01:05:33 +0000
From: John <webmaster@visionary-western.co.uk>
To: Eugene <emelamud@usa.net>
Subject: Re: Newbie Q. How to flush print output mid-script?
Message-Id: <346E46DD.7542@visionary-western.co.uk>

> > Question. Why does the script not return its html output to the browser
> > until 300 seconds are up? Presumably there's a command which could flush
> > the output before it starts to sleep? I've drawn a blank with the
> > manual, any help would be appreciated (grin).
> > John L
> 
> Hi John!
> 
> Server executes script and waits for script to finish
> before sending output to your browser..
> This script will not finish until after 300 sec. Right?!
> 
> welcome:)

Hi Eugene!

Thanks for the reply!

That's right. The script is part of a newsboard/chat system. Most of the
system is written in javascript (which I'm much more familar with) and
I'm just using perl for basic file i/o. 

At the beginning of the perl script the message is written to an html
file so the rest of the world can see it, next a copy of the message is
sent to the poster's browser so he or she can see it too, five minutes
later the hard copy html file is wiped. (Yea, I know it's a strange way
to write a chat system but it's what the client wanted...). The script
is working perfectly but buffering up all its output until the end,
which makes for very brief conversations. The script is a little long to
paste in its entirety but, word for word, the last part is:


	print "<\/pre><br><hr><\/body><\/html>\n";
	}

	sleep (300);

	$quit = 'file deleted';
	open (FH, ">$filepath$filenew");
		print FH $quit;
	close (FH);
	exit ;

This help is greatly appreciated, thanks again!

John L.


------------------------------

Date: Sun, 16 Nov 1997 01:15:57 +0000
From: John <webmaster@visionary-western.co.uk>
To: Mike Stok <mike@stok.co.uk>
Subject: Re: Newbie Q. How to flush print output mid-script?
Message-Id: <346E494D.2A11@visionary-western.co.uk>

> John  <webmaster@visionary-western.co.uk> wrote:

> >       print "...some html...\n";
> >       sleep (300);
> >       exit;
> >
> >Question. Why does the script not return its html output to the browser
> >until 300 seconds are up? Presumably there's a command which could flush
> >the output before it starts to sleep? 

> Mike wrote:
> You can say something like
> 
>   $| = 1;
> 
> at the beginning of the script which sets the currently selected file
> handle (usually STDOUT) to flush after each print, but unless you've told
> the web server that it shouldn't buffer up the script's output you might
> find that the server buffers it up so that, for example, it can create an
> accurate Content-length: header.  So you might want to look in your berb
> server manual for instructions on how to have the server not buffer the
> output (a couple of things to look for are nph- and non parsed headers.)
> 
> Hope this helps,
> 
> Mike

Thanks for the reply Mike!

I haven't tried your code fix yet but I'll give it go tomorrow. The
server (and the manual) is actually 300 miles away so I didn't want to
trouble the administrators if it was just a code thing. But from what
you're saying, I now have a reasonable brief to ask them to sort the
buffering out at system level. 

Thanks again!

John L.


------------------------------

Date: Sun, 16 Nov 1997 16:16:02 -0500
From: Brian <nyc-guy@ix.netcom.com>
Subject: Newbie Question
Message-Id: <346F6291.5CDE3D33@ix.netcom.com>

I'm trying to format a number field that looks like 999,999,999.00
and would like the output to strip out the commas and decimal
places so it would look like : 999999999.  BTW I'm using perl 5.
Any suggestions / help would be greatly appreciated.

Thanks,
Brian




------------------------------

Date: 16 Nov 1997 21:21:21 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Origin of "Nutshell"-Scripts on CPAN?
Message-Id: <oeewwi84pce.fsf@alpha.hut.fi>


paragram@earthcorp.com (Florian Cramer) writes:

> 
> The "scripts" directory on the CPAN mirrors contains a subdirectory
> "Nutshell". The Perl scripts inside obviously belong to some O'Reilly
> book - but it's neither the "Learning Perl", nor "Programming Perl". 

Try 1st Edition PP.

> I am looking for explanation of one of the scripts ("travesty.pl"). Does
> anyone know the title of the book?
> 
> Florian 

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


------------------------------

Date: Sun, 16 Nov 1997 23:09:48 GMT
From: jsaya@iname.com (John Saya)
Subject: passing variables
Message-Id: <64nuom$2tv@bgtnsc02.worldnet.att.net>

Can someone please email me on how you would pass a variable in this
program, using the sub url_get.pl to a subroutine.  It seems it's
passing the word $host rather than what $host is equal to.

I keep getting protocol not supported.


#!/usr/local/bin/perl

require 'url_get.pl';

print "Host: ";
$line = <STDIN>;
$host = chop ($line);

&url_get($host);

exit;


But if I use &url_get("http://www.webcrawler.com") it will work fine


Any help would be appreciated.  Please email to jsaya@iname.com

Thanks




------------------------------

Date: Sun, 16 Nov 1997 15:55:19 -0500
From: "Skip Egley" <egley@albany.net>
Subject: perl compile on Win95 and BCC
Message-Id: <64nmnh$573$1@gamera.albany.net>

Has anyone been able to make perl using Borland C++ on Win95?
I am a newbie trying to learn perl. I bought "Teach Yourself Perl in 21
days" by Sams. It had a perl that supposedly would run on Win95. Many things
are broken. I can't even use arrays. No errors when I try to use them, they
simply are scalars instead of arrays, i.e., all elements in the array are
identical. And yes, I'm sure of this, these are examples straight out of the
book (unless of course they don't know perl either).

Anyway, so I downloaded perl5.004_04 and tried to compile with my Borland
C++ compiler (version 5.02). Compiles OK, I think it's more of a problem
with the make files.
So back to my original question: Has anyone been successful? I don't care if
it's the latest version of perl, anything with at least version 5 to match
the book.

Thanks
Skip Egley




------------------------------

Date: 16 Nov 1997 21:05:21 GMT
From: mitchell@leadbelly.math.ufl.edu (Bill Mitchell)
Subject: Re: recursion, help, I'm scared.
Message-Id: <MITCHELL.97Nov16160521@leadbelly.math.ufl.edu>

In article <346EEBFE.13BE75E4@bill.co.uk> "$Bill Dossett" <bill@bill.co.uk> writes:
> About 1/10 of the way in processing I get
> a message about deep recursion.  

I once caused a problem that may be similar to this by putting a
symbolic link in one directory pointing to a directory lower in the
tree, thereby creating a loop.  You might check for symbolic links.

Bill Mitchell
--
    Bill Mitchell
    Dept of Mathematics,        The University of Florida
    PO Box 118105, Gainesville, FL 32611--8105
    mitchell@math.ufl.edu	(352) 392-0281 x284

  


------------------------------

Date: 16 Nov 1997 18:59:31 GMT
From: henryg@ernie.WPI.EDU (Henry Gabryjelski)
Subject: Re: Sort example for Dummy ??
Message-Id: <64nfqj$c5n$1@bigboote.WPI.EDU>

In article <64n5tl$lt$1@bashir.ici.net>, Burt Lewis <burt@ici.net> wrote:
>I've read the books, man pages, faq's, etc. and am still having trouble 
>understanding sorting by multiple or specified fields.

Interesting, since 'man perlfunc' has a section on sort().
In fact, Programming Perl (v2 pp217-219 or v1 pp248-250) both handle
the subject extremely well.

>aaaa Sat Nov 1 = 1537
>bbbb Sat Nov 1 = 1506
>aaaa Sun Nov 2 = 1547
>aaaa Mon Nov 3 = 1679
 ...
>I need to sort this first by field #4 then by field #1

Well, you may as well extend it to sort on month, too.
(left as an excercise for the reader)

--- !PINS ---

sub ByMultipleFields {
    @a = split /\w+/, $a;    # this should be self-explanatory
    @b = split /\w+/, $b;

    return ( ( $a[3] <=> $b[3] ) or   # if diff field 3s, return
             ( $a[0] cmp $b[0] )      # else string cmp field 0
           );
}

@list = <$fh>;          # yes, slurp it all, and _DO_NOT_CHOMP_
print sort ByMultipleFields @list;

__END__

Henry Gabryjelski


------------------------------

Date: Sun, 16 Nov 1997 13:06:09 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Sort example for Dummy ??
Message-Id: <346F51C4.8F258B9@5sigma.com>

Burt Lewis wrote:
> 
> Hi,
> 
> I've read the books, man pages, faq's, etc. and am still having trouble
> understanding sorting by multiple or specified fields.

I'm not sure the following is "simple" but it is short, sweet,
and efficient.  The "Schwartzian Transform" below--a sort
sandwiched between two maps--is generally the best way to sort
lists where expensive key transformations (e.g. splitting,
reading from disk) are required.  Just about any other code
that you write to do the work below will be longer and
clunkier in some way.  Once you know what you are looking at,
it becomes pretty straightforward.

You can read a few pages about sorting in my book (see the address
below) and of course there are the man pages (which you've already
seen I guess) and Tom C's FMTYEWTK about sorting.  The latter
may help you if you are looking for a really really verbose,
crawlingly painstaking description of what's going on.

	-joseph

print
  map { $_->[0] }
  sort { $a->[1] <=> $b->[1] or $a->[2] cmp $b->[2] }
  map { [ $_, (split)[3, 0] ] }
  <DATA>;

__END__
aaaa Sat Nov 1 = 1537
bbbb Sat Nov 1 = 1506
aaaa Sun Nov 2 = 1547
aaaa Mon Nov 3 = 1679
bbbb Mon Nov 3 = 1618
bbbb Tue Nov 4 = 1288
bbbb Sun Nov 2 = 1540
aaaa Tue Nov 4 = 1347
bbbb Wed Nov 5 = 1543
aaaa Wed Nov 5 = 1566


--
Joseph N. Hall   http://www.5sigma.com/joseph/  mailto:joseph@5sigma.com
Proprietor, 5 Sigma Productions          P.O. Box 6250 Chandler AZ 85246
Perl training & software, C++/C/etc. software, web stuff, original music
*Effective Perl (A-W Fall '97) ............ http://www.effectiveperl.com
*Perl resources & instruction .............. http://www.perltraining.com
*Exploding groceries ................ http://www.5sigma.com/joseph/inan/


------------------------------

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 1325
**************************************

home help back first fref pref prev next nref lref last post