[8004] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1629 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 13 15:19:54 1998

Date: Tue, 13 Jan 98 12:00:32 -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           Tue, 13 Jan 1998     Volume: 8 Number: 1629

Today's topics:
     Re: A newbie is trying to use perl <joseph@5sigma.com>
     Re: alphabetical subset of hash keys (M.J.T. Guy)
     ANNOUNCE:  FREE WEB ANALYZER works w/ CGI and PERL <rbraddy@bmc.com>
     Re: C-style assert()ions (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Re: Can I create a Linked List in Perl (Mark Daku)
     Can't read beyond ^Z.  Please Help. ()
     Re: Can't read beyond ^Z.  Please Help. (Mike Heins)
     Re: CPAN packages and makefiles for 5.004 on 95/NT (Gurusamy Sarathy)
     Examples using select and Open3 or sysread <tegoetz@srv.pacbell.com>
     fastest way for two-dimensional arrays? (Bernhard Freund)
     Re: Filtering (Stunt Pope)
     Guestbook help $$$ <john@iconjohn.com>
     Re: help with the following error message <*@qz.to>
     How do I convert 19971016085243 to time since the epoch <tkounste@bechtel.com>
     Re: Is "Camel Critiques" on the web still updated? <bwb@concentra.com>
     Re: Larry Wall on Dr. Dobb's Journal <joseph@5sigma.com>
     Re: Local paths in Perl for Win32 (Eric T. Wienke)
     Re: Multi-computer execution tool/controller for long p <webmaster@fccj.cc.fl.us>
     Re: Multi-computer execution tool/controller for long p <webmaster@fccj.cc.fl.us>
     Re: Newbie Sockets Question <jay@rgrs.com>
     Re: performing subroutine on a strange set of elements  <westxga@ptsc.slg.eds.com>
     Re: performing subroutine on a strange set of elements  (Tad McClellan)
     Re: Perl to Binary? <*@qz.to>
     PGP Plugin (Mark Guz)
     putenv equivalent? <engel@carmel.cc.huji.ac.il>
     Re: Question on 5.005 merge (Gurusamy Sarathy)
     Question- Sockets and TELNET <mark.werner@bst.bls.com>
     Re: qxurl/perl peculiarity (from perlfaq9) <*@qz.to>
     Re: recomended Perl books ? <pdcawley@bofh.org.uk>
     Re: recomended Perl books ? <tchrist@mox.perl.com>
     Re: Searching for an IP address in a string <*@qz.to>
     Solaris 2.6, Perl 5.004_56, gcc 2.7.2.3, "make test" fa <speight@sunsite.unc.edu>
     sorting arrows <jahnel@xarch.tu-graz.ac.at>
     Re: Speed up a file write? (perl tricks in a cgi script <joseph@5sigma.com>
     Style Q for modules:  best syntax for "hash" arguments? <eryq@zeegee.com>
     Re: Testing for valid numeric values <*@qz.to>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 13 Jan 1998 12:02:58 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: A newbie is trying to use perl
Message-Id: <34BBBA4F.8FABB162@5sigma.com>

reverse just makes a reversed copy of its argument.  You have
to assign it to something:

  @reversed = reverse @data;

Now, backing away from the trees so that we can see the forest,
you might want to consider whether perhaps this is a problem
someone else has already solved, and if so, perhaps you should
just find a log analyzer that's already been written.  :-)

It's a fun problem though.  See

  http://www.effectiveperl.com/contest.html

	-joseph

George Russell wrote:
> 
> I'm trying to use perl on linux to analyse a log file of visits to my
> web site.


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

Date: 13 Jan 1998 17:08:09 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: alphabetical subset of hash keys
Message-Id: <69g71p$9h4$1@lyra.csx.cam.ac.uk>

John Capell <jcapellSpamMeNot@mindspring.com> wrote:
>If I have a large hash, how can I run a routine on just the keys that
>start with a certain letter? I want something that looks like:
>
>    foreach $key (keysthatstartwithA %myhash) {
>        print "$myhash{$key}\n";
>    }
>
>to work like:
>
>    foreach $key (keys %myhash) {
>        if ( substr($key,0,1)=="A" ) { print "$myhash{$key}\n" };
>    }
>
>but without having to bang through every key in the hash to see if it
>starts with 'A' (that just seems inefficient to me)
>
>BTW - this hash is tied to a BTREE Berkely DB, so the hash keys will
>be returned in alphabetical order. What I'm trying to do is allow the
>user to 'query' the database by letter.

If you've got a BTREE Berkely DB, why not use the database facilities,
specifically the $db->seq method?


Mike Guy


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

Date: Tue, 13 Jan 1998 11:52:36 -0600
From: Rick Braddy <rbraddy@bmc.com>
Subject: ANNOUNCE:  FREE WEB ANALYZER works w/ CGI and PERL
Message-Id: <34BBA9E4.C351F521@bmc.com>

FREE WEB ANALYZER works with CGI, ASP, JAVA and NT/UNIX

Those of you developing Web applications will probably be interested in
downloading and
using BMC Software's FREE PATROL Web Analyzer(tm), a Java-based tool
for analyzing Web server and Web application (CGI, ASP, Java, etc.)
performance under
varying loads.  This tool is very easy to install and use since it's
Java-based.  To download or get details, go to:

http://www.bmc.com/cgiserver/info/webanalyzer/index.html

Here's how it works.  The Java applet is placed on the Web server that
will be tested,
which can be Microsoft IIS 3/4, Netscape 3/4 or Apache.  Windows NT
and most UNIX systems are supported.  The Java applet is configured to
drive an actual
load using multiple threads, simulating a number of concurrent browser
users hitting the Web server and application.  The applet then plots the
actual response
time for both the HTML pages and Web applications for a varying number
of simultaneous users.  All of this is done entirely within the Java
run-time environment of
a single browser.

PATROL Web Analyzer also comes with a built-in CGI load generator
utility, or you can (and
typically should) also specify your own Web application to be placed
under load.  Web
applications can be based on most any technology, including but not
limited to CGI,
Microsoft Active Server Pages (ASP), server-side JAVA, ISAPI, NSAPI,
IIOP, etc.

PATROL Web Analyzer is a great way to stress-test your Web applications,
and to see
how incresing concurrent Web application usage affects your Web server's
HTML response
time.  If you haven't stress-tested your Web applications and Web server
before, this tool
will quickly show you what's happening as multiple users converge on
your site.

If you're concerned about CGI applications or thinking about extending
intranet applications
to the Internet for Extranet purposes, while you're there check out
PATROL CGI Server(tm):

http://www.bmc.com/cgiserver

Rick Braddy
rbraddy@bmc.com



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

Date: Tue, 13 Jan 98 13:50:57 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: C-style assert()ions
Message-Id: <34bbc00c$2$ofn$mr2ice@speaker>

In <slrn6bmv42.364.gabor@vinyl.quickweb.com>, on 01/13/98 at 02:46 PM,
   gabor@vinyl.quickweb.com (Gabor) said:
+-----
| In comp.lang.perl.misc, Andy Lester <petdance@maxx.mc.net> wrote :
| # After having been bitten the other night by mixing up an instance method
| # and a class method, I'd like to do some C-style assertions.  For instance,
| #     ref $self eq "Foo" or die "Didn't pass a Foo";
| This would destroy the ability to inherit from your class.
+--->8

True, but a modification thereof would still be in line.

    use Carp;
    sub assert { (eval &{$_[0]} or croak("Assertion failed")) if $^W; }

    package mypackage;

    sub new {
        bless {};
    }

    sub mymethod {
        my $self = shift;
        assert(sub { ref($self) && $self =~ /^[\w\d]+=[A-Z]+\(0x[0-9a-f]+\)$/
});
        print "called mypackage::mymethod()\n";
    }

    ##############

    my $x = new mypackage;
    $x->mymethod(1);
    mypackage::mymethod(1);
    die("Assertion didn't trap") if $^W;

Run with -w and it checks assertions; run without -w and the overhead goes
away (except for the compile-time overhead of the anonymous sub).

Common assertion predicates might be collected in a new package (e.g. "use
Assert; ... assert_classref($self);", whose implementation is an exercise for
the reader :-)

-- 
use 5.004;sub AUTOLOAD{print$_{$_.++$x{$_}}}sub new{my%x;%_=map{++$a%2?$_.++$x{
$_}:$_}split(//,pack('N*',unpack('w*',unpack('u*','M@H*HP\'2"@\C`88+SE/!EA(F!'.
"A'6\$LZV0+(3;C9QRA9NAPG2&D\\G(88:KL=A0\n4AN.5W\"\"&\\[W>;H>3S>0\@A\\N\@PB\$`")
)));bless{}}$b=(new main);map{$b->_}split(//,' Brandon S. Allbery KF8NH') # :-)



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

Date: 13 Jan 1998 13:05:49 -0500
From: daku@nortel.ca (Mark Daku)
Subject: Re: Can I create a Linked List in Perl
Message-Id: <esqlnwk45c2.fsf@nortel.ca>

scott@softbase.com writes:

> >I was wondering if it was possible to create a c-style
> > linked list and perl.
> 

First off take a look at the pages perlref, perldsc and look up
something about hash's.  Use the hash as a data structure and have
some element in the hash be your element that holds a ref to another
hash.  Tada that's it.  It's really rather simple.  Oh you could also
read the data structures cook book as well.  I still find the syntax a
little hard but that's just me, I have this absolute hate on for C and
C++ pointers and the syntax just reminds me of them so much.  MAN I
HATE POINTERS.

Once you have it down you won't go back.

Mark Daku






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

Date: 13 Jan 1998 16:50:54 GMT
From: lame@clark.net ()
Subject: Can't read beyond ^Z.  Please Help.
Message-Id: <69g61e$sv7@clarknet.clark.net>

I'm trying to parse through a binary file and process it using perl.
Nothing was working and I finally figured out that the program was
terminating as soon as it encountered a ^Z character in the file.
Even the following test program doesn't work if "test2.svg" contains
any ^Z's.

-----------------
#/usr/local/bin/perl

open SVGIN, "<test2.svg";
open HEXLOUT, ">test2.hex";

while (read SVGIN, $_, 1) {
#while ($_ = (getc SVGIN)) {
#while (<SVGIN>) {
  print HEXLOUT;
}

close HEXLOUT;
close SVGIN;
-----------------------------

All three of the while loops in the test program terminate
at the first ^Z in the file (so apparently perl thinks that
^Z is the end-of-file character).  I also tried used the eof
function to test for end of file and it still quit at the
first ^Z.

In any case, I'd really really appreciate some help in figuring
out how to process a binary file using perl. 

Oh, I should mention that I'm using perl 5 under Windows95.  
Specifically, here are the notes from the readme file that came with it.
If a simple upgrade to something better will do the trick, let me know.

"This is the second major release of the Perl 5 language for the Win32
Platform. The original target platform was Windows
NT 3.51, but this has been expanded to include Windows 95. Perl 5 for Win32
is a straight port from the Unix version of
perl5.001m, with extra NT-specific functionality provided via module
extensions. "

Thanks in advance,
John

(Both followups to this newsgroup and email to lame@clark.net 
 are welcome.)






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

Date: 13 Jan 1998 17:19:03 GMT
From: mheins@prairienet.org (Mike Heins)
Subject: Re: Can't read beyond ^Z.  Please Help.
Message-Id: <69g7m7$lde$1@vixen.cso.uiuc.edu>

lame@clark.net wrote:
: I'm trying to parse through a binary file and process it using perl.
: Nothing was working and I finally figured out that the program was
: terminating as soon as it encountered a ^Z character in the file.
: Even the following test program doesn't work if "test2.svg" contains
: any ^Z's.
: 
: -----------------
: #/usr/local/bin/perl
: 
: open SVGIN, "<test2.svg";
: open HEXLOUT, ">test2.hex";
: 

	binmode(SVGIN);

: while (read SVGIN, $_, 1) {
: #while ($_ = (getc SVGIN)) {
: #while (<SVGIN>) {
:   print HEXLOUT;
: }
: 
: close HEXLOUT;
: close SVGIN;

It is that simple. Check the FAQ for why this is necessary.

Regards,
-- 
Mike Heins
This message reflects the opinion of my employer.


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

Date: 13 Jan 1998 17:56:53 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: CPAN packages and makefiles for 5.004 on 95/NT
Message-Id: <69g9t5$eqk@srvr1.engin.umich.edu>

  [ mailed and posted ]

In article <wk1zyco51t.fsf@searle1.demon.co.uk>,
Chris Searle  <chris@searle1.demon.co.uk> wrote:
>make returns 
>
>Makefile:629: *** missing separator.  Stop.
[...]
>pm_to_blib: $(TO_INST_PM)
>	@$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \
>	"-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Install \
>        -e "pm_to_blib(qw[ <<pmfiles.dat ],'$(INST_LIB)\auto')"
>	
>$(PM_TO_BLIB)
><<

That syntax is only legal for nmake.

[...]

>I'm using the 5.004 bindist of perl (borland compiled) installed to c:\perl
>
>The make in use is the cygwin32 make (GNU).

This is your problem.  MakeMaker decides what makefile syntax to emit
based on the 'make=foomake' entry in your Config.pm.  dmake and nmake
are the two makefile syntaxes currently supported.  GNU make is not
(yet) supported.  Should be easy to support though (using an external
perl tool to create temporary files).

>I'va also tried borland and MS make packages, same problem.

Don't use Borland make.  Use the dmake that comes with bindist04.

Are you sure nmake also fails?  I do this routinely, and it doesn't
fail for me.

>This is set as the environment variable PERL5OPT=-MWild.pm
>
>This causes the following problems
>
>Use of uninitialized value at C:\PERL\lib/File/DosGlob.pm line 112.

This is fixed in the DosGlob that comes with 5.004_04.

>Subroutine doglob redefined at C:\PERL\BIN/perlglob.bat line 30.
>Subroutine glob redefined at C:\PERL\BIN/perlglob.bat line 112.
>Subroutine import redefined at C:\PERL\BIN/perlglob.bat line 114.

Copy this to perlglob.pl:

----------8<----------
use File::DosGlob;
$| = 1;
while (@ARGV) {
    my $arg = shift;
    my @m = File::DosGlob::doglob(1,$arg);
    print (@m ? join("\0", sort @m) : $arg);
    print "\0" if @ARGV;
}
----------8<----------

Run "pl2bat perlglob.pl" to create perlglob.bat, and replace the
installed perlglob.bat with it.

This will be fixed in the next bindist (no, don't ask when, watch clpa).
Thanks for the report.

 - Sarathy.
   gsar@umich.edu


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

Date: Tue, 13 Jan 1998 10:23:21 -0800
From: Thomas Goetze <tegoetz@srv.pacbell.com>
Subject: Examples using select and Open3 or sysread
Message-Id: <34BBB118.41C67EA6@srv.pacbell.com>

Does anyone have any working code that gives examples about
how to use the (4 argument) select along with open3 and
sysread to correctly handle any (or most) situations that could occur
when running a system command?

Basically, I expect to run a shell command and want to
monitor STDOUT and STDERR, not knowing which order they
may be ready to be read from. In some cases, STDERR may
indicate that something needs to be sent to STDIN to
continue the command. The Camelbook, (in the section
on IPC::Open2) suggests that select and sysread is the
right way to do it. I think I understand the basic
concepts involved, but that is usually just the start
of getting some working code.

I have used open2 and open3 before, but always when I knew
the possible order of the readiness of the filehandles.
As I forge into this new territory, I'm willing to accept
suggestions from others who have gone there before.

Thanks,

Tom Goetze
tegoetz@pacbell.com


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

Date: 13 Jan 1998 12:10:49 GMT
From: 0542760043-0003@t-online.de (Bernhard Freund)
Subject: fastest way for two-dimensional arrays?
Message-Id: <69flk9$lbj$1@news01.btx.dtag.de>

Hi!

I'm new to Perl as well as to newsgroups,
and I've got two questions:

What is the fastest way to create and access 
something comparable to a two-dimensional array?
(Some lines of code would help me getting used to the syntax...)

How can get C-subroutines in my perl programs?

                                So long,

                                        Bernhard Freund


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

Date: 13 Jan 1998 19:27:59 GMT
From: markjr@mail.PrivateWorld.com (Stunt Pope)
To: strider@ShadowMAC.org (Raul Almquist)
Subject: Re: Filtering
Message-Id: <69gf7v$j94$2@newsbell.bellglobal.com>

[Posted and mailed]

------------------------Begin ROT26 Encoded Text

In article <strider-ya02408000R0405971933400001@news.winternet.com>,
	strider@ShadowMAC.org (Raul Almquist) writes:
> I am working with filename filtering...  I have everything filtered except
> one stinking character, or so I think :_)
> 
[snip]
>   Now the character that I can not seem to filter out of possible filenames
> is the "\" character...  I have tried several different configs for the
> filtering of the "\" character out of any filenames, but nothing appears to
> work, and I do not see a method to set s/ or tr/ to use a hex code to
> determine the character to be filtered.
> 

Are you escaping the backslash? (with a backslash) i.e.

markjr@bofh:~> perl -e '$x="\\\\";$x=~s/\\/_/g;print "$x\n";'
__
markjr@bofh:~>

works fer me

regards, markjr

------------------------End ROT26 Encoded Text

Mark Jeftovic		aka: mark jeff or vic, stunt pope. 
markjr@shmOOze.net	http://www.shmOOze.net/~markjr	
PWC's BOFH		http://www.PrivateWorld.com
irc: L-bOMb		Keep `em Guessing


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

Date: Tue, 13 Jan 1998 12:57:34 -0500
From: John Donovan <john@iconjohn.com>
Subject: Guestbook help $$$
Message-Id: <34BBAB0E.362F707C@iconjohn.com>

Hi I am designing a web site and don't know s__t about PERL

I have the form ready and hacked Matts CGI Scripts. I can get the script
to run from the command line in Telnet, but can't via the web.

I need somebody to take over the ball. And I have a $100.00 for the
project. Any helpers?

thanks in advance

John Donovan
john@iconjohn



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

Date: 13 Jan 1998 19:22:17 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: help with the following error message
Message-Id: <qz$9801131414@qz.little-neck.ny.us>

David J. Boyd <djboyd@sam.on-net.net> wrote:
> I get the following error message:
>       Cannot create a file when that file already exists.
> 
> From the following code seqment:
>   $FirstProcessObj->Wait(INFINITE) || &ProcessError("WAIT");
>   $FirstProcessObj->GetExitCode($ExitCode) || warn
> &ProcessError("GetExitCode");
>   &RptError ("Exit code for Process wait is: $ExitCode");
> 
> What does it mean?

That code won't run for me:

#!/usr/bin/perl -w
   $FirstProcessObj->Wait(INFINITE) || &ProcessError("WAIT");
   $FirstProcessObj->GetExitCode($ExitCode) || warn
 &ProcessError("GetExitCode");
   &RptError ("Exit code for Process wait is: $ExitCode");
__END__

:r! perl -x %
Can't call method "Wait" without a package or object reference at
/home/qz/.article.7880 line 2.

So you want to share some more information about this?

Elijah
------
or maybe read the source/documentation that came with it?


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

Date: Tue, 13 Jan 1998 19:19:09 GMT
From: "Toby Ounsted" <tkounste@bechtel.com>
Subject: How do I convert 19971016085243 to time since the epoch??
Message-Id: <01bd2057$f7289f00$48a30193@lonw3633>

Hi All,

	I'm trying to use perl to parse some log files.  The string 19971016085243
specifies the date that an event occoured, i.e. Year=1997, Month = 10th,
Day =16th, time was 08:52:43 AM.  What I would like to do is to convert
this string into the number of seconds since the epoch, in order that I can
correlate the results and builtd up a table showing the frequency of the
event over time.  Does anyone know of an easy way of doing this, or am I
going to have to write a conversion routine from scratch?  I saw some time
conversion routines on www.perl.com but sadly have not been able to get
these working under perl for NT.  

	Is anyone out there familiar with this kind of thing??

		Thanks in advance,

		Toby.


		tkounste@bechtel.com



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

Date: Tue, 13 Jan 1998 14:05:01 -0500
From: "Brent Benson" <bwb@concentra.com>
Subject: Re: Is "Camel Critiques" on the web still updated?
Message-Id: <69gdtd$rg$1@icadnewshost.concentra.com>

Joseph R. Justice wrote in message <698ged$f67@access2.digex.net>...
>
>I was browsing comp.lang.perl.misc, and I noticed a message thread
>titled something like "Camel Critiques: <book title>". [...]
>
>However, when I looked at this page, and other pages (e.g. What's New)
>on this site, it didn't look as if anything had been changed on them
>for quite a while. [...]

Another site that reviews and recommends Perl books is Flat Hill Books.
The content, though, is slightly different than "Camel Critiques."
Instead of dividing the books into rating categories, they simply list
what they consider to be the top books with explanations:

  http://www.flathill.com/languages/perl/






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

Date: Tue, 13 Jan 1998 11:56:06 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Larry Wall on Dr. Dobb's Journal
Message-Id: <34BBB8B3.A084FDE0@5sigma.com>

This is a good article.  Thanks to DDJ for putting it online.

	-joseph

John Robson wrote:
> 
> The current issue of the Dr. Dobb's Journal (February 1998) is entirely
> devoted to scripting languages and has some articles on Perl.
> 
> The highlight is a long interview of Larry Wall in which he talked about
> Perl 5.005, the Resource Kit, and (what else!!?) the philosophy and
> art of Perl.  As always, Larry is as entertaining and enlightening as ever.
> 
> Go read the interview at:
> http://www.ddj.com/ddj/1998/1998_02/


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

Date: Tue, 13 Jan 1998 18:45:14 GMT
From: eric@NOSPAM_liquidsilver.com (Eric T. Wienke)
Subject: Re: Local paths in Perl for Win32
Message-Id: <34bbb587.40974147@192.168.0.1>

On Tue, 13 Jan 1998 13:10:32 GMT, "GarryG"
<newspost@dyna_cs.demon.co.uk> wrote:

>
>I have a real painful problem when writing perl scripts.
>
>When I run them from a comamnd prompt to test them, I have to reference the
>data directory from the current directory the script is run from.
>
>eg: script in /cgi-bin/project
>data dir = ../../docs/project/data
>actually http://localhost/project/data
>
>but when I run the script through the web browser the current directory is
>cgi-bin,
>so the data directory is 
>
>../docs/project/data
>
>Is this an oddity with perl or perl for win32, or should I look at the way
>my server is setup?
>
>-- 
>--
>Garry Goodwin
>Dynamic Computer Solutions Ltd
>
>http://www.dyna_cs.demon.co.uk
>(Change underscore to minus for my real address!)
>--

Any reason in particular you are not simply using full paths, i.e.
c:/foo/docs/project/data ?

Eric T. Wienke

To send email remove "NOSPAM_" from the address.


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

Date: Tue, 13 Jan 1998 14:01:20 -0500
From: Bill Jones <webmaster@fccj.cc.fl.us>
To: Clark Dorman <clark@s3i.com>
Subject: Re: Multi-computer execution tool/controller for long processes
Message-Id: <34BBB9FB.10DE@fccj.cc.fl.us>

Clark Dorman wrote:
> 
> Greetings,
> 
<Snip -- Long draw out discussion deleted...>
> 
> --
> Clark Dorman                            "Evolution is cleverer than you are."
> http://cns-web.bu.edu/pub/dorman/D.html                -Francis Crick

I would hazard a guess that you would not need to go to such great
lengths in resolving this problem.  From what I just read and what I
think I know (scary, huh?) about what you would like to do - I think,
depending upon whether you really want to reinvent a multi-threaded,
multi-tasking, symetrical multi-processing architecture - what you have
described is over kill :-)

During your questioning, thinking out load sort-of message, you did not
say what SMP Unix you were using.  If in fact it is Unix, say AIX, then
the OpSys (which runs in a SMP and Cluster (multi-SMP) configuration)
has tools which would allow you to use Unix/Perl/Expect to perform the
monitoring/data Sync/User I/O you are looking for.

I am interested in this type of project.  I myself am not that good at
Perl/Expect/Unix, but believe I could help you write something using
those tools (in other words, everyone has an opinion :-)

For example - use the Perl Module Net::??? to create a distributed
master Perl Controller, have it send a simple T/F/U signal to a console
(even an SMP box needs a single console.)

Use Expect to control the interaction between the processes themselves
and the End-Users as well.

Next, use Unix itself (which is Multi-whatever) against Itself. Unix, in
my opinion is it's own best friend and worst enemy.

In other words, solve the problem, do not reinvent the wheel.  Sure, I
believe someone created a network monitor which has a WWW interface and
I know someone who wrote a HTTPd server out of perl, and I ran accross
several other pieces that you MIGHT be able to rewrite all of it to do
what you are looking for, but by that time you should probably have
written it from scratch.  And, given enough time, the problem has
changed into a new problem.

So, solutions are only as relevant as their timeliness.

I believe several others here may also feel as I do - This is a relevant
problem which needs a timely answer.  Most people who reads these groups
are either searching for answers to their questions or are looking for
things they did not see, know, or understand before.

Many may be able to help you, but it would have to be an open
colaboration (did I spelt that rite :-/ ?)  Oh well, you get the idea
:-)

Anyways, I would be interested in helping out with this type of
project.  Are the development/test platforms in a production evironment
as well?  If you are interested in help, let me know.

Bill


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

Date: Tue, 13 Jan 1998 14:04:31 -0500
From: Bill Jones <webmaster@fccj.cc.fl.us>
Subject: Re: Multi-computer execution tool/controller for long processes
Message-Id: <34BBBABA.183B@fccj.cc.fl.us>

Bill Jones wrote:
> 
> Clark Dorman wrote:
> >
> > Greetings,
> >
> <Snip -- Long draw out discussion deleted...>
> >
> > --
> > Clark Dorman                            "Evolution is cleverer than you are."
> > http://cns-web.bu.edu/pub/dorman/D.html                -Francis Crick
> 
> I would hazard a guess that you would not need to go to such great

<Snip -- Second long draw out discussion deleted...>

Well, I just see your web site and I would say, yes, you are wanting to
reinvent the wheel :-)

Bill


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

Date: 13 Jan 1998 13:19:52 -0500
From: Jay Rogers <jay@rgrs.com>
To: "Mark A. WErner" <mark.werner@bst.bls.com>
Subject: Re: Newbie Sockets Question
Message-Id: <821zyc9qyf.fsf@shell2.shore.net>

"Mark A. WErner" <mark.werner@bst.bls.com> writes:
> I am running this code on HP UX 10.01 on a K-Series.
> What I wanted to do was connect to the TELNET port and read the
> banner info it spits back at you. When I use the TELNET port, nothing
> comes back.

Something is coming back but it's non-printable characters.  The
TELNET protocol allows for option negotiation between the two ends
using the byte "\xff" like an escape character.

The TELNET server you connected to is most likely waiting for you to
respond to its requests before proceeding with I/O.

The Net::Telnet module will transparently handle this for you.

> connect(SH,$paddr) || die ("Connect failed $!\n");
> 
> print("CON PASSED\n");
> 
> sysread(SH,$buffer, 200);
> print("-------------------------\n");
> print($buffer);
> print("--------------------------n");
> close(SH);

Here's how to do that using Net::Telnet:

    use Net::Telnet ();
    $t = new Net::Telnet (Timeout => 10);
    $t->open($host);
    
    ($banner) = $t->waitfor('/login: $/');
    print $banner;
    $t->close;

> THANKS in Advance

You're welcome.

--
Jay Rogers
jay@rgrs.com


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

Date: Tue, 13 Jan 1998 13:17:07 +0000
From: Glenn West <westxga@ptsc.slg.eds.com>
Subject: Re: performing subroutine on a strange set of elements from array
Message-Id: <34BB6953.6A2A@ptsc.slg.eds.com>

Chris Lott wrote:
> 
> I have a 64 element array @foo. I want to perform a certain subroutine
> on elements 1,3,5,7,10,12,14,16,17 ...
> 
> I can't easily see a logical way to do this without doing each one
> separately, ie
> 
> @foo[1] = xxx
> @foo[3] = xxx
> 
> Is there a way to perform a subroutine on many selected elements this
> way?
> 

There may be a more elegant way but this works:

@values=(2,4,6,8,10,12,14,16);       
@elements=(1,3,5,7);                 
foreach $elemt (@elements) {         
        &subroutine($values[$elemt]);
        }                            
                                     
sub subroutine {                     
        local($value)=@_;            
                                     
        print "Value is: $value\n";  
        }


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

Date: Tue, 13 Jan 1998 13:17:30 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: performing subroutine on a strange set of elements from array
Message-Id: <akeg96.i99.ln@localhost>

Chris Lott (eclectic@polarnet.com) wrote:

: I have a 64 element array @foo. I want to perform a certain subroutine
: on elements 1,3,5,7,10,12,14,16,17 ...

: I can't easily see a logical way to do this without doing each one
: separately, ie

: @foo[1] = xxx
: @foo[3] = xxx

: Is there a way to perform a subroutine on many selected elements this
: way?


   foreach (@foo[1,3,5,7,10,12,14,16,17]) {   # array slice
      certain_subroutine($_);
   }


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 13 Jan 1998 18:23:53 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: Perl to Binary?
Message-Id: <qz$9801131312@qz.little-neck.ny.us>

Bart Lateur <bart.mediamind@tornado.be> wrote:
> jwbacon@ix.netcom.com (J. Bacon) wrote:
> >>Well, it *is* a "compiler" in the sense of "bring together". :-)
> >Sorry about the misrepresentation of 'compiler'.  merlyn@stonehenge.com is (as 
> >near as I can determine) COMPLETELY correct in the statement.  The product 
> >looks to me to be some sort of bundler, which allows a perl script to run 
> >without the Perl binary already installed on the target machine.
> >Still, it produces a (huge!) file which runs as a standalone executable.

Sounds like it just bundles the entire perl binary with a script. Perl
embed may be a better way to do that. (Better in the sense of being free
and under your control.)

> It sounds much like the "Save a runtime" option on the Macintosh.
> MacPerl has had this option for years. For free. Three cheers for
> Matthias! (the MacPerl porter)

Andrew Plotkin's z-machine game interpeter ("MaxZip"?) one ups that. It can
build game-bundled interpreters, which you can distribute for a one file
solution, and those can unbundle themselves to get the orginal program back.
Neat trick.

Elijah
------
wondering when someone will write a z-machine in perl


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

Date: Tue, 13 Jan 1998 16:47:57 GMT
From: mguz@sol.co.uk (Mark Guz)
Subject: PGP Plugin
Message-Id: <34bb9a8e.25117814@news.sol.co.uk>



Anyone recommend a good pgp plugin for perl???


Mark Guz


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

Date: Tue, 13 Jan 1998 19:25:08 +0200
From: michael engel <engel@carmel.cc.huji.ac.il>
Subject: putenv equivalent?
Message-Id: <Pine.SGI.3.96-heb-2.07.980113192250.10886A-100000@carmel.cc.huji.ac.il>


Is there in perl a command that is equivalent to "putenv" of C
(or setenv DISPLAY ...)?
Please answer to engel@cc.huji.ac.il.
THanks,
michael





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

Date: 13 Jan 1998 18:16:59 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: Question on 5.005 merge
Message-Id: <69gb2r$g49@srvr1.engin.umich.edu>

  [ mailed and posted ]

In article <69el8g$b9i@dfw-ixnews10.ix.netcom.com>,
J. Bacon <jwbacon@ix.netcom.com> wrote:
>Perls merge:  does anybody have a good idea (SWAG or better) on how much 
>modification existing scripts will need to run on the 'merged' flavor?

If you're running the standard port already, I'd guess you'll need
almost no changes whatsoever.

>My particular situation relies heavily on Aldo Calpini's Win32::API module, 
>and to a lesser extent his Win32::Console.  The Console.pm stuff I would give 
>up for the "GUI" stuff in G Saranthy's port, but without the API I am set back 
>about 4-6 months.

Win32:API runs on the standard port _now_.  There's no reason why that
should change.

 - Sarathy.
   gsar@umich.edu





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

Date: Mon, 12 Jan 1998 20:22:45 -0800
From: "Mark A. WErner" <mark.werner@bst.bls.com>
Subject: Question- Sockets and TELNET
Message-Id: <34BAEC15.7061@bst.bls.com>

Any help with the folloing would be appreciatted.
When I run the following code on a HP-UX 10.01 box and go to
the TELNET port I don't get anything back. I was hoping for the
"normal" TELNET banner and login. However, when I go to the SMTP
port I get back the SMTP banner just as expected. I know I'm missing
something, but I can't figure it out.

Thanks in advance
#!/usr/local/bin/perl
use Socket;
$iaddr = inet_aton('90.130.46.94');

$paddr = sockaddr_in(23,$iaddr);   # 23 Is Telnet, 25 is Mail
$proto=getprotobyname('tcp');


print("proto is $proto\n");

socket(SH,PF_INET,SOCK_STREAM,$proto) || die("SOCKET DIED: $!\n");
connect(SH,$paddr) || die ("Connetc fielled $!\n");

print("CON PASSED\n");

sysread(SH,$buffer, 200);
print("-------------------------\n");
print($buffer);
print("--------------------------\n");
close(SH);


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

Date: 13 Jan 1998 18:07:35 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: qxurl/perl peculiarity (from perlfaq9)
Message-Id: <qz$9801131259@qz.little-neck.ny.us>

John M. Klassa <klassa@aursgh.aur.alcatel.com> wrote:
> Tad McClellan <tadmc@flash.net> wrote:
> ->It *must* match '\1\s*>' at the end. So it has to keep going until
> ->it finds a double quote, followed by '>', with some optional
> *Doh*!  Yup, of course...  It was a stupid oversight on my part.  Thanks
> for pointing it out!

This is the sort of thing that has me often advocating against use
of the non-greedy constructs of perl. I don't think I use them at all
in my own code, and I do tend to write very regexp heavy code.

Elijah
------
#!/usr/bin/perl -- -*- my ny.pm sig -*-
$_=$^ ;s;s;sss;;s^.^ju^&&s&P&,\n&&&(s(_..)(ers)||s|^|^^|)&&s(T)(q(st%eg))eg;
s<.(o).><$& new 1$$>i+s+\dst.+$a--||reverse(q(rep k))+ge;s*%.+u* so+*i;s=\++
="me"=mex&&s%ege%l$"hke%;$a||s/^\S+ /\/\//;s;\d+;yor;;s[KE]<ac$&>i;print $_;


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

Date: 13 Jan 1998 19:06:57 +0000
From: Piers Cawley <pdcawley@bofh.org.uk>
Subject: Re: recomended Perl books ?
Message-Id: <54yb0knqge.fsf@gunnar.aladdin.net>

11 Jan 1998 16:22:35 GMT sitaram@diac.com (Sitaram Chamarty) comp.lang.perl.misc
> On 09 Jan 1998 10:56:46 +0000, Piers Cawley <pdcawley@bofh.org.uk> wrote:
> >quality up there as they're growing -- I don't think I've read any
> >of their books that is a waste of bookshelf space, and most stay on
> >the
> 
> <grin> try stuff like NT system admin books, or books on Excel - ORA
> has them too. </grin>

I've just picked up a copy of _NT User Administration_ and _NT in a
Nutshell_. A depressingly large number of the contracts that are
available at the moment seem to want you to at least know what NT is.
The ORA stuff is at least well designed and informative.

-- 
Piers Cawley -- Systems Genie for Aladdin
If a `religion' is defined to be a system of ideas that contains
unprovable statements, then Godel taught us that mathematics is not
only a religion, it is the only religion that can prove itself to be
one. -- John Barrow


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

Date: 13 Jan 1998 19:41:01 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: recomended Perl books ?
Message-Id: <69gg0d$md7$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Piers Cawley <pdcawley@bofh.org.uk> writes:
:A depressingly large number of the contracts that are
:available at the moment seem to want you to at least know what NT is.

I suppose that answering "an fragile, expensive, insanely complex,
piggish, single-user system masquerading as useful" isn't 
the answer they're looking for? :-=)

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com


There's going to be no serious problem after this.  --Ken Thompson


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

Date: 13 Jan 1998 18:45:23 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: Searching for an IP address in a string
Message-Id: <qz$9801131323@qz.little-neck.ny.us>

Dave Barnett  <barnett@houston.Geco-Prakla.slb.com> wrote:
> [automagically cc'ed to poster]

Yet you didn't leave the address in the body so other people could do so too?

> Adrian Lester wrote:
> > Could you please offer some help.  I'm trying to search a hosts file
> > for an IP address.  I thought it would work when I used quotemeta, but
> > it still doesn't find the IP address in the file.  I've already checked
> > the file permissions before calling the sub routine.
 ...
> 2.  Until you double backslash escape the "." characters in
> $safeIPAddress, this will never work.  $safeLine has 127\.0\.0\.1  When
> the regex engine encounters 127\. in $safeIPAddress, it gets converted
> to 127.0.0.1 
> (127any_one_character0any_one_character0any_one_character1) but your
> line you are searching in only has 127\.0\.0\.1    localhost
> 
> 3.  Make the above changes, and it should work okay.

One interesting thing about /etc/hosts is that it is parsed with the
inet(3) routines. These allow the use of decimal, octal or hexadecimal
in each quad. Further they allow middle values to be dropped.

	127.1 is the same as 127.0.1 is the same as 127.0.0.1
	127.1 is the same as 127.01  is the same as 127.0x1
	127.1 is the same as 0177.01 is the same as 0x7f.0x1

You really should do a proper parsing, because you never know when --
by accident or malicious design -- the "decimal" numbers you find there
will be at odds with how the OS is interpreting them.

Elijah
------
consult your manpages for the full details on inet(3)/hosts(5)


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

Date: Tue, 13 Jan 1998 13:25:51 -0500
From: Charlie Speight <speight@sunsite.unc.edu>
Subject: Solaris 2.6, Perl 5.004_56, gcc 2.7.2.3, "make test" fails
Message-Id: <Pine.GSO.3.96.980113131444.8422A-100000@titan.oit.unc.edu>


I've come to the end of my rope. Can someone help me find the problem
here. 

I use all the configure defaults and "make" completes without complaining. 

here is the output of myconfig:
*****
Summary of my perl5 (5.0 patchlevel 4 subversion 56) configuration:
  Platform:
    osname=solaris, osvers=2.6, archname=sun4-solaris
    uname='sunos daniels 5.6 generic sun4m sparc sunw,sparcstation-10 '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3= useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O', gccversion=2.7.2.3
    cppflags='-I/usr/local/include'
    ccflags ='-I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -lgdbm -ldl -lm -lc -lcrypt
    libc=/lib/libc.so, so=so
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fpic', lddlflags='-G -L/usr/local/lib'
*****

and here are the errors when I run "make test":
*****
lib/anydbm........Can't load '../lib/auto/Fcntl/Fcntl.so' for module
Fcntl: ld.so.1: ./perl: fatal: relocation error: file
 ../lib/auto/Fcntl/Fcntl.so: symbol main: referenced symbol not found at
 ../lib/DynaLoader.pm line 166.

 at ./lib/anydbm.t line 11
BEGIN failed--compilation aborted at ./lib/anydbm.t line 11.
FAILED at test 0

 ...

lib/filecopy......Can't load '../lib/auto/IO/IO.so' for module IO:
ld.so.1: ./perl: fatal: relocation error: file ../lib/auto/IO/IO.so:
symbol main: referenced symbol not found at ../lib/DynaLoader.pm line 166.

 at ../lib/IO/Handle.pm line 248
BEGIN failed--compilation aborted at ../lib/IO/Seekable.pm line 50.
BEGIN failed--compilation aborted at ../lib/IO/File.pm line 111.
FAILED at test 6
*****

it fails the same way for 22 tests. the other failures are:

lib/filehand
lib/gdbm
lib/io_dump
lib/io_pipe
lib/io_sock
lib/io_taint
lib/io_tell
lib/io_udp
lib/io_xs
lib/ndbm
lib/odbm
lib/opcode
lib/open2
lib/open3
lib/posix
lib/safe1
lib/safe2
lib/sdbm
lib/socket

the files are where they say they are, but all these tests fail.

please cc: me on any responses.

Thanks!
Charlie Speight



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

Date: Tue, 13 Jan 1998 20:39:10 +0100
From: Jahnel Klaus <jahnel@xarch.tu-graz.ac.at>
Subject: sorting arrows
Message-Id: <34BBC2DE.2B22F9B3@xarch.tu-graz.ac.at>

how can i sort arrows which i read from a file like that:
:
@test = ("test1","test0","test2","test3","test4",0102,......)
@test =("test1","test0","test2","test3","test4",0512,......)
@test = ("test1","test0","test2","test3","test4",4582,......)
@test =("test1","test0","test2","test3","test4",01252,......)

$test[5] is the index i want to sort /descending or vice verser

i want to have the same arrows but sorted
Klaus



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

Date: Tue, 13 Jan 1998 11:48:51 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Speed up a file write? (perl tricks in a cgi script?)
Message-Id: <34BBB700.C347CFD9@5sigma.com>

Do you have any idea whether the print statements are taking
up the time, or whether the time is being spent starting
up the Perl interpreter and loading Text::Wrap?

	-joseph
	 http://www.effectiveperl.com

Michael R Weholt wrote:
> 
> The following bit of code (a write to disk in a cgi script), using the
> "non-professional" version of the OmniHTTPd server on my local win95
> machine, takes nearly *8* CPU seconds to execute.  [...]]


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

Date: Tue, 13 Jan 1998 13:41:49 -0500
From: Eryq <eryq@zeegee.com>
Subject: Style Q for modules:  best syntax for "hash" arguments?
Message-Id: <34BBB56D.6172@zeegee.com>

Since this question relates to style considerations for
authoring reusable modules, I've posted in c.l.p.modules
as well...

Oftimes, we see subs which take arguments in a hash form,
like this [1]:

	foo(ThisThing => $this,
	    ThatThing => $that);

Sometimes, we see this instead [2]:

	foo(-this_thing => $this,
	    -that_thing => $that);

And even [3]:

	foo(THIS_THING => $this);

Not to mention some which do extra work to case-fold
arguments and chop leading '-'s off, so that you
can supply args in more than one style.

So: are we at all moving towards a Perl style standard for
this... and if so, what is it?  Although I've been doing [1]
for years, I've gradually warmed on [2].  And [3] looks 
too... um... "loud".

Perhaps a standard -- even a soft one -- isn't feasible: for
example, in my own HTML::Stream, I find it quite natural to
have people say:

	$H -> A(HREF=>$href) -> IMG(SRC=>$src, ALT=>$alt) -> _A;

even though this has a rather weird overall syntax: heavy
method chaining, all-uppercase hash args, uppercase instance
method names, and use of a leading _ to indicate something
other than a private method!  But in general, it all seems to
work.

However, it might be nice to have perlstyle guidelines for 
when there is "no good excuse to do otherwise".

Opinions?
-- 
   ___  _ _ _   _  ___ _  Eryq (eryq@zeegee.com)
  / _ \| '_| | | |/ _ ' / President, Zero G Inc: http://www.zeegee.com
 |  __/| | | |_| | |_| |      "Talk is cheap. Let's build." - Red Green.
  \___||_|  \__, |\__, |___/\ Visit STREETWISE, Chicago's newspaper by/
            |___/    |______/ of the homeless: http://www.streetwise.org


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

Date: 13 Jan 1998 19:18:02 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: Testing for valid numeric values
Message-Id: <qz$9801131342@qz.little-neck.ny.us>
Keywords: from just another new york perl hacker

John Porter  <jdporter@min.net> wrote:
> Matthew Cravit wrote:
> > sub IsNumeric($) {
> >         $_[0] =~ m/\D/ ? 0 : 1;
> > }
> > Hope this helps.

sub IsNumeric($) {
	(!($_[0] =~ tr/0-9//c))&&($_[0] ne "")
}

Has the advantage of not needing regexps at all, so it is probably faster
than some other solutions I've seen. 

> This subroutine returns True for arguments such as
> "Half-baked g0ggle-b0x d0-g00ders..."
> 
> Keep trying :-)
> (And see Brian's post)

No "Brian" participated in this thread. Maybe you meant brian? If
the New York Times has the presence of mind to heed is style guide,
maybe you should too:
   
<URL:http://www.computerdog.com/brian/style.html>

Hope that helps! :^)

Elijah
------
pay no mind to the comments


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

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

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