[10477] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4072 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 26 12:18:04 1998

Date: Mon, 26 Oct 98 09:06:37 -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, 26 Oct 1998     Volume: 8 Number: 4072

Today's topics:
    Re: Sockets <erhmiru@erh.ericsson.se>
        Statistics for comp.lang.perl.misc <gbacon@cs.uah.edu>
        System command (why a LIST??) (Jete Software Inc.)
    Re: System command (why a LIST??) <aperrin@mcmahon.qal.berkeley.edu>
        using a variable from another file hex8@my-dejanews.com
    Re: using a variable from another file <minich@globalnet.co.uk>
    Re: using a variable from another file (Martien Verbruggen)
    Re: What isn't Perl good for? (Michael Rubenstein)
    Re: What isn't Perl good for? <cmcurtin@interhack.net>
    Re: What isn't Perl good for? <r28629@email.sps.mot.com>
    Re: What isn't Perl good for? ullrich@math.okstate.edu
    Re: What's the "best" way to call one Perl script from  doug_seay@my-dejanews.com
    Re: Windows Nt server IIS perl and blat help <perlguy@technologist.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 26 Oct 1998 09:53:13 +0100
From: Michal Rutka <erhmiru@erh.ericsson.se>
To: "Martin" <minich@globalnet.co.uk>
Subject: Re: Sockets
Message-Id: <laiuh7901y.fsf@erh.ericsson.se>

"Martin" <minich@globalnet.co.uk> writes:
> I've been reading the posts in this group for quite a while now, and
> haven't seen this problem pop up yet. I'm having problems with
> sockets. The following:

Well, this problem was covered by me about two weeks ago.

<cut>
> and the line just after the ##### always dies with "Unknown Error:
> 0x0000274d
> regardless of what site I use. I'm running Windows 95 and Perl 5.003_07. Has
> anyone else come across this?

Your problem is 5.003_07. You should get newer release of ActiveState perl.
I use 5.005_02 right now and it does not have this problem.

> Martin

Michal


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

Date: 26 Oct 1998 15:37:20 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: Statistics for comp.lang.perl.misc
Message-Id: <7124vg$q8u$6@info.uah.edu>

Following is a summary of articles spanning a 7 day period,
beginning at 19 Oct 1998 14:50:57 GMT and ending at
26 Oct 1998 07:53:14 GMT.

Notes
=====

    - A line in the body of a post is considered to be original if it
      does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
    - All text after the last cut line (/^-- $/) in the body is
      considered to be the author's signature.
    - The scanner prefers the Reply-To: header over the From: header
      in determining the "real" email address and name.
    - Original Content Rating (OCR) is the ratio of the original content
      volume to the total body volume.
    - Find the News-Scan distribution on the CPAN!
      <URL:http://www.perl.com/CPAN/modules/by-module/News/>
    - Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
    - Copyright (c) 1998 Greg Bacon.  All Rights Reserved.
      Verbatim copying and redistribution is permitted without royalty;
      alteration is not permitted.  Redistribution and/or use for any
      commercial purpose is prohibited.

Excluded Posters
================

perlfaq-suggestions\@mox\.perl\.com

Totals
======

Posters:  548
Articles: 1570 (671 with cutlined signatures)
Threads:  471
Volume generated: 2693.0 kb
    - headers:    1110.3 kb (22,145 lines)
    - bodies:     1476.7 kb (46,489 lines)
    - original:   1014.7 kb (34,324 lines)
    - signatures: 104.5 kb (2,312 lines)

Original Content Rating: 0.687

Averages
========

Posts per poster: 2.9
    median: 1.0 post
    mode:   1 post - 337 posters
    s:      5.6 posts
Posts per thread: 3.3
    median: 2 posts
    mode:   1 post - 145 threads
    s:      5.4 posts
Message size: 1756.5 bytes
    - header:     724.2 bytes (14.1 lines)
    - body:       963.2 bytes (29.6 lines)
    - original:   661.8 bytes (21.9 lines)
    - signature:  68.1 bytes (1.5 lines)

Top 10 Posters by Number of Posts
=================================

         (kb)   (kb)  (kb)  (kb)
Posts  Volume (  hdr/ body/ orig)  Address
-----  --------------------------  -------

   77   112.3 ( 60.0/ 43.1/ 28.1)  Tom Phoenix <rootbeer@teleport.com>
   44    73.9 ( 29.2/ 39.7/ 24.1)  lr@hpl.hp.com (Larry Rosler)
   42    84.5 ( 35.4/ 40.2/ 27.4)  mgjv@comdyn.com.au (Martien Verbruggen)
   31    44.6 ( 17.9/ 26.7/ 15.3)  dblack@pilot.njin.net (David Alan Black)
   31    43.9 ( 18.0/ 25.8/ 16.6)  tadmc@flash.net (Tad McClellan)
   29    56.9 ( 28.1/ 25.8/ 16.8)  John Porter <jdporter@min.net>
   26    42.0 ( 26.1/ 15.8/ 11.0)  Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
   22    31.6 ( 12.7/ 19.0/ 14.2)  mjd@op.net (Mark-Jason Dominus)
   20    30.4 ( 13.0/ 17.4/  7.7)  danbeck@eudoramail.com (Daniel Beckham)
   19    35.0 ( 11.6/ 20.4/  7.4)  Uri Guttman <uri@camel.fastserv.com>

These posters accounted for 21.7% of all articles.

Top 10 Posters by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Address
--------------------------  -----  -------

 112.3 ( 60.0/ 43.1/ 28.1)     77  Tom Phoenix <rootbeer@teleport.com>
  84.5 ( 35.4/ 40.2/ 27.4)     42  mgjv@comdyn.com.au (Martien Verbruggen)
  73.9 ( 29.2/ 39.7/ 24.1)     44  lr@hpl.hp.com (Larry Rosler)
  56.9 ( 28.1/ 25.8/ 16.8)     29  John Porter <jdporter@min.net>
  44.6 ( 17.9/ 26.7/ 15.3)     31  dblack@pilot.njin.net (David Alan Black)
  43.9 ( 18.0/ 25.8/ 16.6)     31  tadmc@flash.net (Tad McClellan)
  42.0 ( 26.1/ 15.8/ 11.0)     26  Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
  35.0 ( 11.6/ 20.4/  7.4)     19  Uri Guttman <uri@camel.fastserv.com>
  34.1 ( 11.8/ 19.9/ 12.6)     14  abigail@fnx.com
  32.9 ( 12.0/ 18.1/  7.9)     18  Uri Guttman <uri@fastengines.com>

These posters accounted for 20.8% of the total volume.

Top 10 Posters by OCR (minimum of five posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

1.000  (  7.4 /  7.4)      8  marx@idiom.com
0.990  (  3.2 /  3.3)      5  fl_aggie@thepentagon.com (I R A Aggie)
0.987  ( 10.3 / 10.5)      5  "Xah" <xah@best.com>
0.940  ( 11.4 / 12.1)      6  Nathan Torkington <gnat@frii.com>
0.930  (  8.5 /  9.1)     11  gebis@fee.ecn.purdue.edu (Michael J Gebis)
0.907  (  5.6 /  6.2)      7  "Matt Johnson" <mjohnson@getonthe.net>
0.899  ( 21.4 / 23.8)      8  snowhare@xmission.xmission.com (Snowhare)
0.842  ( 10.9 / 12.9)     11  tchrist@mox.perl.com (Tom Christiansen)
0.814  (  2.0 /  2.4)      6  "Martin" <minich@globalnet.co.uk>
0.808  (  4.2 /  5.3)      5  ronald_f@my-dejanews.com

Bottom 10 Posters by OCR (minimum of five posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

0.464  (  6.0 / 13.0)     11  sholden@cs.usyd.edu.au
0.449  (  6.6 / 14.6)     11  "Tupshin Harper" <tupshin@tupshin.com>
0.446  (  7.7 / 17.4)     20  danbeck@eudoramail.com (Daniel Beckham)
0.446  (  3.5 /  7.7)      8  Jonathan Stowe <gellyfish@btinternet.com>
0.435  (  7.9 / 18.1)     18  Uri Guttman <uri@fastengines.com>
0.390  (  3.0 /  7.6)      7  WMWilson <m.v.wilson@erols.com>
0.367  (  2.3 /  6.4)     10  Tk Soh <r28629@email.sps.mot.com>
0.362  (  7.4 / 20.4)     19  Uri Guttman <uri@camel.fastserv.com>
0.326  (  5.2 / 15.8)     13  keithmur@mindspring.com
0.182  (  1.4 /  7.8)      5  "Justin B. Harvey" <jbharvey@auspex.net>

73 posters (13%) had at least five posts.

Top 10 Threads by Number of Posts
=================================

Posts  Subject
-----  -------

   86  Perl & Y2K - booby trap code
   33  Raleigh.pm (Raleigh, NC, USA perl mongers) has registered
   32  Not to start a language war but..
   31  What isn't Perl good for?
   26  Perl Cookbook - is this the best perl book?
   22  help shorten one-liner
   15  *Why* does clpm attract non-perl posts?
   15  += operator produces error, = operator doesn't?
   15  Perl Y2K copmliance
   12  New Module: File::Finder -- OO version of File::Find

These threads accounted for 18.3% of all articles.

Top 10 Threads by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Subject
--------------------------  -----  -------

 166.2 ( 67.3/ 90.1/ 56.4)     86  Perl & Y2K - booby trap code
  70.9 ( 25.9/ 41.3/ 29.7)     32  Not to start a language war but..
  61.6 ( 24.7/ 33.9/ 21.6)     31  What isn't Perl good for?
  53.8 (  4.0/ 49.8/ 47.4)      5  Perl, dynamic loading, SCO OS 5
  52.8 ( 29.2/ 21.7/ 12.0)     33  Raleigh.pm (Raleigh, NC, USA perl mongers) has registered
  48.7 ( 21.2/ 26.1/ 16.6)     26  Perl Cookbook - is this the best perl book?
  42.5 ( 14.6/ 26.0/ 13.9)     22  help shorten one-liner
  41.9 (  5.9/ 35.7/ 16.3)      8  Who can help me write full-text search engine in Perl with indexing
  32.3 ( 10.9/ 20.3/ 13.5)     15  *Why* does clpm attract non-perl posts?
  28.0 (  9.9/ 16.5/ 13.1)     12  New Module: File::Finder -- OO version of File::Find

These threads accounted for 22.2% of the total volume.

Top 10 Threads by OCR (minimum of five posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Subject
-----  --------------  -----  -------

0.958  (  8.3/   8.6)      5  programing fun: trees: Part...
0.951  ( 47.4/  49.8)      5  Perl, dynamic loading, SCO OS 5
0.857  ( 16.6/  19.3)      6  PERL & simple flat file database???
0.831  (  2.6/   3.2)      6  Gnu Unzip?????
0.822  (  3.9/   4.8)      5  Forks and other Utensils
0.805  (  5.6/   7.0)      5  Camel book: References.
0.796  (  2.0/   2.5)      6  I digress...
0.794  (  2.8/   3.6)      6  round a value
0.792  ( 13.1/  16.5)     12  New Module: File::Finder -- OO version of File::Find
0.779  (  3.1/   4.0)      5  Can someone help me with the following for a friend I know?

Bottom 10 Threads by OCR (minimum of five posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Subject
-----  --------------  -----  -------

0.474  (  2.7 /  5.8)     10  Boston.pm will be Quiz Kings [was] Randal's Big Day in Big D
0.462  (  3.7 /  8.1)     10  how do you search subdirectories for a file?
0.459  (  4.4 /  9.5)      8  Overloaded '.' wreaking havoc
0.458  ( 16.3 / 35.7)      8  Who can help me write full-text search engine in Perl with indexing
0.458  (  3.4 /  7.5)      5  about ssi and <img src...
0.453  (  2.1 /  4.5)      5  Slow Sort?
0.438  (  1.7 /  3.8)      5  Help:Tried installing PERL under WIN3.11, it simply gave me an error 2 on bat. installation
0.436  (  1.9 /  4.3)      8  PERL and a DATABASE..
0.412  (  2.3 /  5.5)      9  reference to array
0.378  (  1.6 /  4.2)      7  Pink?  Blue?  What color _is_ it???

79 threads (16%) had at least five posts.

Top 10 Targets for Crossposts
=============================

Articles  Newsgroup
--------  ---------

      32  comp.lang.python
      23  comp.lang.perl
      22  comp.lang.perl.modules
       8  alt.perl
       5  comp.lang.perl.tk
       5  comp.unix.sco.misc
       5  alt.html
       4  alt.lang.s-lang
       3  pl.comp.lang.perl
       3  alt.perl.sockets

Top 10 Crossposters
===================

Articles  Address
--------  -------

       5  tadmc@flash.net (Tad McClellan)
       4  "Jakob V. Nielsen" <jakob@gemino.no>
       4  Ray McVay <rmcvay@acm.org>
       4  "Commitman" <commitman@digitalnet.com.br>
       4  cg@pobox.com
       3  Tom Phoenix <rootbeer@teleport.com>
       3  tchrist@mox.perl.com (Tom Christiansen)
       3  metcalfjm@my-dejanews.com
       3  builderlive@cnet.com (CNET Builder.com Live!)
       3  danbeck@eudoramail.com (Daniel Beckham)


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

Date: 26 Oct 1998 10:53:05 -0500
From: jete@dgs.dgsys.com (Jete Software Inc.)
Subject: System command (why a LIST??)
Message-Id: <7125t1$egu@dgs.dgsys.com>

I notice in the Camel book (pg 230) that the system takes a LIST argument.
Almost everytime that I have seen it in people's code they have coded it
as a single scalar string  system("cp /etc/hosts /etc/hosts.BAK").
Now I understand that they can get away with this because it is simply
a one-element list. But is there any advantage to writing it like this:
	(@args) = ("cp", "/etc/hosts", /etc/hosts.BAK");
	system(@args) == 0 or die "system @args failed: $?"

Thanks!!

-- Norman


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

Date: Mon, 26 Oct 1998 08:05:45 -0800
From: Andrew Perrin <aperrin@mcmahon.qal.berkeley.edu>
To: "Jete Software Inc." <jete@dgs.dgsys.com>
Subject: Re: System command (why a LIST??)
Message-Id: <36349DD9.3F1809AF@mcmahon.qal.berkeley.edu>

[posted & sent via e-mail]

I take it as another in the 'there's more than one way to do it' philosophy.
The list implementation can be cleaner & more convenient in some
circumstances; for example, something along the lines of:

$path = '/usr/local/bin/';
$cmd = 'perl';
$arg[0] = '-v';
$arg[1] = '-w';
system("$path$cmd",@arg);

 ...but I can't think of a situation in which it's *necessary*.  Just keeps you
from having to (1) do lots of concatenation; or (2) do some/a lot of
backslashing to get the point across...

ap

Jete Software Inc. wrote:

> I notice in the Camel book (pg 230) that the system takes a LIST argument.
> Almost everytime that I have seen it in people's code they have coded it
> as a single scalar string  system("cp /etc/hosts /etc/hosts.BAK").
> Now I understand that they can get away with this because it is simply
> a one-element list. But is there any advantage to writing it like this:
>         (@args) = ("cp", "/etc/hosts", /etc/hosts.BAK");
>         system(@args) == 0 or die "system @args failed: $?"
>
> Thanks!!
>
> -- Norman



--
-------------------------------------------------------------
Andrew J. Perrin - NT/Unix/Access Consulting -  (650)938-4740
aperrin@mcmahon.qal.berkeley.edu (Remove the Junk Mail King)
     http://www.geocities.com/SiliconValley/Grid/7544/
-------------------------------------------------------------




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

Date: Sun, 25 Oct 1998 23:24:16 GMT
From: hex8@my-dejanews.com
Subject: using a variable from another file
Message-Id: <710bv0$g6g$1@nnrp1.dejanews.com>

Ive got a script which needs to be able to read a couple of variables from
another file. how would i go about doing something like this?

open (TEST, "test") || die ("cant open test");
while (<TEST>) {
      system ("rsa $d $n $msg");
}
the file test contains the following:

$d="kjhf09248ylsjfhp93247ylkdhgp9347ydfkjbv9473jhdfg98o3thjdf";
$n="dfikj0384dlhg0835ljkdfg083ldjfgp309kldfjg035kjdfgh034knfd";

i need to be able to use the keys (which change) from the test file.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Mon, 26 Oct 1998 00:11:19 -0000
From: "Martin" <minich@globalnet.co.uk>
Subject: Re: using a variable from another file
Message-Id: <710env$ro8$1@newnews.global.net.uk>

>Ive got a script which needs to be able to read a couple of variables from
>another file. how would i go about doing something like this?

open(TEST,"testfile.txt") || die("can't open test\n\n $!");
while (<TEST>) {
  chomp;
  $_ =~ s/^\$(.*?)\s{0,}=\s{0,}\"(.*?)\"/{${$1} = $2}/se;
}
close(TEST);

Works - if you must. There are easier ways though ...

Martin




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

Date: Mon, 26 Oct 1998 00:41:15 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: using a variable from another file
Message-Id: <LyPY1.26$4V4.167049@nsw.nnrp.telstra.net>

In article <710bv0$g6g$1@nnrp1.dejanews.com>,
	hex8@my-dejanews.com writes:
> Ive got a script which needs to be able to read a couple of variables from
> another file. how would i go about doing something like this?
> 
> open (TEST, "test") || die ("cant open test");
> while (<TEST>) {
>       system ("rsa $d $n $msg");
> }
> the file test contains the following:
> 
> $d="kjhf09248ylsjfhp93247ylkdhgp9347ydfkjbv9473jhdfg98o3thjdf";
> $n="dfikj0384dlhg0835ljkdfg083ldjfgp309kldfjg035kjdfgh034knfd";
> 
> i need to be able to use the keys (which change) from the test file.

Since you are suggesting that the file you will be reading is valid
perl code, you could use do:

# perldoc -f do

I would not really recommend that though. It's probably cleaner to
parse the lines, and store this stuff in a hash. Alternatively, you
could read in the lines, and eval them.

There is always more than one way to do it.

Personally, I would probably parse the lines myself, unless I could be
absolutely certain that they would not contain garbage.

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


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

Date: Sun, 25 Oct 1998 21:57:12 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: What isn't Perl good for?
Message-Id: <36389de5.68042449@nntp.ix.netcom.com>

On 25 Oct 1998 19:07:41 GMT, abigail@fnx.com (Abigail) wrote:

>Just because you can write legible, maintable, bugfree or comprehensible
>code in Perl doesn't mean others have the same limitations.
>
>
>
>
>Abigail
>-- 
>sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
>'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
>'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
>'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
>'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))

Obviously, Abigail does not suffer from these limitations :-)
--
Michael M Rubenstein


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

Date: 25 Oct 1998 18:35:48 -0500
From: Matt Curtin <cmcurtin@interhack.net>
To: jlewchuk@junctionnet.com
Subject: Re: What isn't Perl good for?
Message-Id: <xlxsogcgqp7.fsf@gold.cis.ohio-state.edu>

jlewchuk@junctionnet.com (Michael Lewchuk) writes:

> If you're busy doing something that can't be explained as a simple
> set of UNIX commands, then it's time to go for the old C/C++ manual.

Do you even know Perl?  Perl is not a shell, yet that's exactly what
you're describing.  Perl was created to fill that (huge) space between 
jobs for shells and jobs for C.

Why would you post such a flatly bald assertion?

> if it's a batch job, use PERL, if it's a program, use C/C++.  In
> other words, if you were limited to using shell commands only, could
> you do it?  If so, use PERL.

Funny.  How, precisely, would you represent an arbitrary-length hash
of arbitrary-length arrays in shell?  This is completely trivial in
Perl, and nowhere do you need a shell command to do the deed.

Just out of curiosity, how would you even do that in C?

You also obviously don't know how Perl really works.  Perl is a
compiled language, unlike shells.  Perl compiles its source to
platform-independent parse trees that are then fed to the Perl
interpreter.  The result is yet another way that Perl lets you have
your proverbial cake and eat it too: (most of) the advantages of the
interpreted languages with (most of) the advantages of compiled
languages.

> Also, from my POV, PERL is treated as a programming language, which
> it's not.  If you try to treat it like one, you will fail miserably
> in producing good code.  Either it'll be illegible, unmaintainable,
> buggy, incomprehensible, or all of the above.  You'll try to turn a
> program into a batch job, thereby producing a botch job instead.

Stick this in your pipe and smoke it: httpd-p.pl, available from
http://www.interhack.net/people/cmcurtin/perl/ 

If this is illegible, unmaintainable, or incomprehensible to you, quit 
calling yourself a programmer.  And it's certainly not buggy.  Not a
single line of shell.  I dare you to show me how this is faster,
easier, or more maintainable in any shell, or any compiled language
that will run on a dozen or more platforms completely unmodified.  You 
get bonus points for having automatically installed documentation.

Put up or shut up, programmer boy.

#!/usr/bin/perl -w
# 
# Author          : C Matthew Curtin <cmcurtin@interhack.net>
# Created On      : <1998/08/22 16:56:31 cmcurtin>
# Last Modified By: $Author: cmcurtin $
# Last Modified On: $Date: 1998/08/23 14:34:54 $
# 
=pod

=head1 NAME

httpd-p -- Query httpd daemons and report their types and versions

=head1 SYNOPSIS

httpd-p inputfile

=head1 DESCRIPTION

B<httpd-p> accepts input from a file specified as the first argument.
The format of the file is:

  www.example.com
  site2.net:8080
  www.site3.org

Sites whose port number is not specified (with C<:port> notation)
will be queried on port 80.

Errors including sites that could not be queried will be reported on
STDERR;
results will be sent to STDOUT, in the form

  9 : some_server/1.0
  8 : another_server/1.4
  1 : another_server/1.2
  1 : still_another

=head1 RETURN VALUE

Returns 0 on success, 1 otherwise.

=head1 EXAMPLES

If you want to check all of the servers listed in F</tmp/httpd-hosts>,
and want to send your output to F</tmp/httpd-results>, with errors
being kept in F</tmp/httpd-failures>, you might try the following,
which assumes a sensible shell, i.e., a Bourne-shell derivative:

 httpd-p /tmp/httpd-hosts >/tmp/httpd-results 2>/tmp/httpd-failures

(How to do this sort of redirection with B<csh> is an excercise left
to the reader, perhaps one that will cause him to conclude to change
shells.)

=head1 BUGS

No thanks.

=head1 AUTHOR

C Matthew Curtin E<lt>http://www.interhack.net/people/cmcurtin/E<gt>

=head1 HISTORY

 $Log: httpd-p.pl,v $
 Revision 1.1  1998/08/23 14:34:54  cmcurtin
 Fixed minor problems in pod markup.

 Revision 1.0  1998/08/23 13:53:47  cmcurtin
 Initial revision



=cut

require 5.003;

use strict;

my $input = $ARGV[0];
my $h_name;
my $h_port;
my %targets;
my $target;
my %httpds;
my $key;
my $version  = '$Revision: 1.1 $ ';
my $referer = "http://www.interhack.net/people/cmcurtin/perl/";
my @results;

usage("I want exactly one argument, to specify the target file.")
  unless scalar(@ARGV) == 1;

open(TARGETS, "< $input") || die "Cannot read $input: $!";
while(<TARGETS>) {
  chomp;
  ($h_name, $h_port) = split(/:/, $_, 2);
  $h_port = 80 unless $h_port;
  eval {$target = whatareyou($h_name, $h_port)};
  if (defined $target && !$@) {
    $targets{$target}++;
  } else {
    $targets{FAILED}++;
    print STDERR "\t(host $h_name:$h_port could not be checked.)\n";
  }
}
close(TARGETS);

print STDOUT "Done!\nresults:\n";
print STDOUT "Failed: $targets{'FAILED'}\n";
undef $targets{FAILED};
foreach $key (keys %targets) {
  push(@results, "$targets{$key} : $key\n") if defined $targets{$key};
}
print STDOUT sort descending @results;

exit(0);

# tcp client fetch, accepts target, returns SERVER string

sub descending {
  my ($a, $b);
  $a <=> $b;
}

sub whatareyou ($$) {
  use IO::Socket;
  
  my $host;
  my $port;
  my $iaddr;
  my $paddr;
  my $proto;
  my $line;
  my $whatami;
  my $foo;

  $host = shift;
  $port = shift;

  my $doc = IO::Socket::INET->new( Proto    => "tcp",
		   PeerAddr => $host,
		   PeerPort => $port,
		 );

  unless ($doc) { die "$host, $!" }
  $doc->autoflush(1);
  print $doc "GET / HTTP/1.0\nReferer: $referer\nUser-Agent: interhack httpd-p/$version\n\n";
  while(<$doc>) {
    chomp;
    if(/^Server:\s+?(.*)/i) {
      $whatami = $1;
      $whatami =~ s/
//;
    }
  }
  close $doc;

  return $whatami;
}

sub usage($) {
  my $reason = shift;
  print "httpd-p: $reason\nUsage: httpd-p input_file\n";
  exit(1);
}


-- 
Matt Curtin cmcurtin@interhack.net http://www.interhack.net/people/cmcurtin/


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

Date: Mon, 26 Oct 1998 01:21:31 -0500
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: What isn't Perl good for?
Message-Id: <363414E9.68D0BFC1@email.sps.mot.com>

Michael Lewchuk wrote:
> 
> On Tue, 20 Oct 1998 03:11:02 GMT, Elaine -HappyFunBall- Ashton
> <eashton@bbnplanet.com> wrote:
> 
> >Martien Verbruggen wrote:
> >
> >> Perl isn't horrible at anything. And it is always time to use C.
> 
> Really?  Perhaps you'd like to hire someone to write a 3DFX card device driver
> in PERL for you, then be forced to maintain it.
> 
> >Perl never cooked for me. Anything else, it rocks. C is painful by
> >comparison, from an SA POV anyway. The day Perl makes coffee and muffins
> >for me in the morning, I'll never have eyes for another language. :)
> 
> From my POV, it depends on what you're doing.  If you're playing with UNIX
> commands all day, PERL takes a real load off the old keyboard (and the fingers
> thereby).  If you're busy doing something that can't be explained as a simple
> set of UNIX commands, then it's time to go for the old C/C++ manual.  Those of
> you who have been around computers for 20 years may understand this reference:
> if it's a batch job, use PERL, if it's a program, use C/C++.  In other words,
> if you were limited to using shell commands only, could you do it?  If so, use
> PERL.
> 
> Also, from my POV, PERL is treated as a programming language, which it's not.
> If you try to treat it like one, you will fail miserably in producing good
> code.  Either it'll be illegible, unmaintainable, buggy, incomprehensible, or
> all of the above.  You'll try to turn a program into a batch job, thereby
> producing a botch job instead.
> 
> The only reason to move from C/C++ to PERL is that you can do many high-level
> useful things easily.  PERL is not better than C/C++, it's just easier on the
> brain and fingers for high-level tasks.

This is by far the most amazing post I have read on this ng.

   s/maz/mus/;

Since I failed to determine your rationale behind, IMHO, it was a end-result
of your dainbramage after using Perl incorrectly. Too bad <sigh>.

-tk


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

Date: Mon, 26 Oct 1998 15:43:44 GMT
From: ullrich@math.okstate.edu
Subject: Re: What isn't Perl good for?
Message-Id: <7125bg$e89$1@nnrp1.dejanews.com>

In article <70vstt$7iv$2@client3.news.psi.net>,
  abigail@fnx.com wrote:
> Michael Lewchuk (jlewchuk@junctionnet.com) wrote on MDCCCLXXX September
> MCMXCIII in <URL:news:36325997.7071805@news.junctionnet.com>:
> ++
> ++ Also, from my POV, PERL is treated as a programming language, which it's
not.
> ++ If you try to treat it like one, you will fail miserably in producing good
> ++ code.  Either it'll be illegible, unmaintainable, buggy, incomprehensible,
or
> ++ all of the above.  You'll try to turn a program into a batch job, thereby
> ++ producing a botch job instead.
>
> Just because you can write legible, maintable, bugfree or comprehensible
> code in Perl doesn't mean others have the same limitations.

         Hah - so you admit it, the _goal_ is to write incomprehensible
code! (Sorry - haha.)

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 26 Oct 1998 13:05:38 GMT
From: doug_seay@my-dejanews.com
Subject: Re: What's the "best" way to call one Perl script from another?
Message-Id: <711s32$3j2$1@nnrp1.dejanews.com>

In article <70qfsi$dt6@transfer.stratus.com>,
  alfred@hw.stratus.com (Alfred von Campe) wrote:
> Daniel Beckham (danbeck@eudoramail.com) wrote:
> |>Why not just turn those seperate scripts into functions and use the main
> |>script to glue the functions together?  If you still want to have the
> |>functions in seperate files for re-usability, you can use the require
> |>statement to pull the function files into the main script.
>
> Because these other scripts still need to be standalone scripts
> that a user can invoke.  The script I'm currently writing is a
> "super" script if you will that automates our regression process,
> but users still need to run tests manually.

Don't knock Daniel's approach.	It can be expanded upon to do what you want
with not too many changes.

My solution is that each of those scripts defines everything it does of
interest in a single function where all the interesting stuff is passed as
parameters.  I often name this function the same as the file.  Then each
starts with a block that looks like

if ( ! caller )
   {
   parse args
   call function
   }

This lets me have well named functions that I can use how ever I want, but let
the script be called as a standalone program.  This has given me the best of
both worlds.

I usually use "require" to import the scripts.	I don't remember why (old
age), but I dislike "do".  I think it reloads the file each time it is called
while "require" is a bit more efficient.  I don't doubt that "do" works, but
I gave it up when I made the jump to Perl5.

- doug


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 26 Oct 1998 12:26:48 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: Windows Nt server IIS perl and blat help
Message-Id: <36346A88.BE3C0A9F@technologist.com>

Is BLAT in a directory that the IUSER_SERVERNAME has rights to?  If so,
does said user have rights to the program?

Don't use "exec" unless you want your program to end right there.  Exec
doesn't return.  Either use "system" or the back-ticks ``

Are you able to successfully run BLAT from the command-line?

Good luck,
brent
-- 
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$            Brent Michalski             $
$         -- Perl Evangelist --          $
$    E-Mail: perlguy@technologist.com    $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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