[8783] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2400 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 23 07:08:18 1998

Date: Thu, 23 Apr 98 04:00:30 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 23 Apr 1998     Volume: 8 Number: 2400

Today's topics:
    Re: 'each' and recursion, do they mix? (Bart Lateur)
    Re: Array / List question <dformosa@st.nepean.uws.edu.au>
    Re: CGI.PM Question & ASCII/HEX problem squid@fish.net
    Re: Eat my dust - Perl running on Windows 95 (Bart Lateur)
    Re: File attach (Abigail)
        fixed width text files (Jeff)
    Re: float to hex conversion <igor.k@usa.net>
        getting line numbers from file - grep -n <elbit4@mail.netvision.net.il>
    Re: getting line numbers from file - grep -n <cnwetzel@linguistik.uni-erlangen.de>
        Help w/ printing file contents to screen? <djoyce@netunlimited.net>
    Re: Help w/ printing file contents to screen? <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: Help: crypt for Win32 ?? (Karel Sprenger)
        Help: To Kill an Object <jerome.bradenbaugh@firstunion.com>
    Re: Help: To Kill an Object <ljz@asfast.com>
    Re: How to create a new file? (Martien Verbruggen)
    Re: if ($string eg "y") or if ($string == "y") (Abigail)
    Re: Java Script in CGI <quednauf@nortel.co.uk>
        matching man page lines (John Erjavec V)
        Nested Multiline array sort help needed! lawm@hotmail.com
        print reverse pack strangeness? (Marcus P Hertlein)
    Re: Problem with Perl read on NT <noels@chilli.net.au>
    Re: QUESTION: foreach $scalar can this be foreach $hash (Jason Gloudon)
    Re: Remote Process Monitoring reboot@tir.com
    Re: Remote Process Monitoring (Martien Verbruggen)
    Re: Removing spaces from a variable, how? <mhchau@cse.cuhk.edu.hk>
    Re: Replacement without counting return ???? <vallon@pearl.fi.bear.com>
    Re: SendMail on NT <coryj@***NOSPAM***i-check.net>
    Re: SendMail on NT (Martien Verbruggen)
    Re: spoiled noobie <tchrist@mox.perl.com>
        sprintf documentation (was: Re: Question on: printf %o  <cnwetzel@linguistik.uni-erlangen.de>
    Re: Sprite (Martien Verbruggen)
        techniques for tagging substitution areas in templates? <dtbaker_@flash.net>
    Re: UNIX mail script (Martien Verbruggen)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 22 Apr 1998 07:04:04 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: 'each' and recursion, do they mix?
Message-Id: <354193b5.3457858@news.tornado.be>

Jean-Louis Leroy wrote:

>it seems that 'each' uses a single iterator per hash. That's 
>disappointing, and makes 'each' unsuitable for recursive algorithm that 
>iterate over the same hash at different levels of recursion.

>2) If not, what is the most efficient *and* reentrant way of iterating 
>over a hash, besides the obvious 'foreach my $val (keys %h)...'?

Urm... I doubt if it's efficient, but I'm sure it's reentrant. Make a
local copy of the hash!

	local (%hash) = %hash;

HTH,
Bart.


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

Date: 22 Apr 1998 23:39:57 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: Array / List question
Message-Id: <893288397.641589@cabal>

In <soncz8of.fsf@mailhost.panix.com> Jonathan Feinberg <jdf@pobox.com> writes:

[...]

>> grep($_ *= 2, @Array) ;

>The use of grep in void context is now officially considered harmful.
>Please use foreach instead.

Who officially decleared it?

BTW it looks like grep in void context is more effent then foreach.


--
I'm a perl programer if you need perl programing hire me. Buy easter bilbies.
Please excuse my spelling as I suffer from agraphia see the url. Support NoCeM
http://www.cit.nepean.uws.edu.au/~dformosa/Spelling.html  http://www.cm.org/ 
I'm sorry but I just don't consider 'because its yucky' a convincing argument


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

Date: Thu, 23 Apr 1998 01:31:24 GMT
From: squid@fish.net
Subject: Re: CGI.PM Question & ASCII/HEX problem
Message-Id: <353e98cc.1161278@news.earthlink.net>

On Wed, 22 Apr 1998 15:52:55 GMT, Tom Phoenix <rootbeer@teleport.com>
wrote:

>On Wed, 22 Apr 1998 squid@fish.net wrote:
>
>> Scenario:  Graphics files and a user fill-out form being uploaded via
>> http file upload from both PC and Macintosh(ugh).
>
>You mis-placed that groan. :-)
>
They are both uncooperative. :-o

>> while ($bytesread = read($filename,$buffer,1024)) {
>
>Is $filename, as the name implies, a file name? That's odd...
>
$filename is the filename...the var was used for example

>> Problem: P.C. uploads work like a champ but the friggin' Mac's uploads
>
>If you're following the proper protocol but some browser doesn't
>cooperate, then it's the other program's fault. If you're not following
>the protocol, then it's your fault. If you aren't sure about the protocol,
>you should read the protocol specification. If you've read it and you're
>still not sure, you should ask in a newsgroup about the protocol. 
>
The only Browser being used is Netscape V 3 and/or 4. ( I tried IE for
the hell of it with the same results).

>Hope this helps!
I hope it does too. I'll re-read the proto-spec to see if I missed
anything
>
>-- 
>Tom Phoenix       Perl Training and Hacking       Esperanto
>Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/
>

Thanks...Any other suggestions in case this doesn't turn up (turnip)
anything?



---GEO


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

Date: Thu, 23 Apr 1998 07:25:34 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Eat my dust - Perl running on Windows 95
Message-Id: <353fe677.1996963@news.tornado.be>

Fain wrote:

>  Wow! you guys really know how to get off subject!

What subject?

	Bart.


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

Date: 23 Apr 1998 01:23:32 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: File attach
Message-Id: <6hm56k$9j5$1@client2.news.psi.net>

Polyakov Ilya (poliak@main.com2com.ru) wrote on MDCXCV September MCMXCIII
in <URL: news:353E4F90.B0C1A4DB@main.com2com.ru>:
++ I need to E-mail a non-text file.
++ Pls, tell me where I can find a Perl script for it.


perl -we 'system "uudecode file file | mail user@domain"'



Abigail
-- 
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
           print+Just (), another (), Perl (), Hacker ();'


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

Date: Wed, 22 Apr 1998 15:54:03 GMT
From: jeffmcc@mindspring.com (Jeff)
Subject: fixed width text files
Message-Id: <353e11ec.13355604@news>

I have a text file with approximately 400 rows.  Each row has 31
columns, and each column has a different width.  I'm a newbie so if
this elementary question frustrates anyone I apologize.  But, how can
I read from this file and set the width for each individual column so
I can reference them?

TIA,
Jeff


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

Date: Wed, 22 Apr 1998 15:24:54 -0700
From: "Igor Krivokon" <igor.k@usa.net>
Subject: Re: float to hex conversion
Message-Id: <6hlqgj$p7b$1@news.ncal.verio.com>

Ron Shipp wrote in message <6hli6p$90s@news.outer.net>...
>A colleague generated some C code to convert a floating point number
>into a hex value. This code works fine, and looks like this:
>
>    int main (argc, argv)
>    int   argc;
>    char *argv[];
>    {
>      float fval;
>      sscanf( argv[1], "%f", &fval );
>      printf("%08x \n", *((int*)&fval) );
>    }
>
>Is there an equivalent to this in perl? I realize that I can compile this
>into an executable, and use some sort of system call, but I would like
>to do it without that.


print unpack("H8", pack "f", $ARGV[0]) . "\n"; 

Byte order here is system-dependent (as well as in your C code), so be careful.

Regards,

Igor Krivokon
<igor.k@usa.net>




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

Date: Thu, 23 Apr 1998 09:05:27 +0300
From: Elbit4 <elbit4@mail.netvision.net.il>
Subject: getting line numbers from file - grep -n
Message-Id: <353EDA27.1037@mail.netvision.net.il>

Hello
I'm looking for a way to get the line numbers of lines that contain a 
word I'm looking for in a file, something like what grep -n does in 
shell. I don't want to go over the file line by line.

TIA
Alon


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

Date: Thu, 23 Apr 1998 10:54:38 +0200
From: Christian Wetzel <cnwetzel@linguistik.uni-erlangen.de>
Subject: Re: getting line numbers from file - grep -n
Message-Id: <353F01CE.45C3@linguistik.uni-erlangen.de>

Elbit4 wrote:
 
> I'm looking for a way to get the line numbers of lines that contain a
> word I'm looking for in a file, something like what grep -n does in
> shell. I don't want to go over the file line by line.

Sorry, but how do you want to get the matching lines
(or linenumbers of matching lines) without looking
at each line?

Or do you mean that you don't want to read in the file
line by line (but at once)? If you do so you have to
track how many newlines you have seen before finding a 
match in your huge string which contains the file. But
I see no advantage there.

If you don't want to do it by yourself, you just have to
call the Unix grep command and catch the results. Or 
look at CPAN if someone has released a module for that
(which I doubt).

Christian


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

Date: Thu, 23 Apr 1998 03:57:31 -0400
From: "David Joyce" <djoyce@netunlimited.net>
Subject: Help w/ printing file contents to screen?
Message-Id: <6hmsai$uvj$1@news.netunlimited.net>

I can print to a file with <STDIN> pretty successfully, but how do I print
file contents to screen in my scripts?  <STDOUT>?  If so, how?!?!


David Joyce




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

Date: 23 Apr 1998 12:21:43 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Help w/ printing file contents to screen?
Message-Id: <7xd8e8rg7c.fsf@beavis.vcpc.univie.ac.at>

Re: Help w/ printing file contents to screen?, David
<djoyce@netunlimited.net> said:

David> I can print to a file with <STDIN> pretty
David> successfully, but how do I print file contents to

<boggle>You can?</boggle>

<STDIN> reads from the handle STDIN, you can't print to it.

David> screen in my scripts?  <STDOUT>?  If so, how?!?!

The handle is called STDOUT, <STDOUT> would try to read from
STDOUT which is pretty silly :-)

STDOUT is the default handle for print, so


    print "this will appear on stdout\n";

will do what you want.  To print to another handle do

    print HANDLE "blah blah blah\n";

perldoc -f print

hth
tony


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

Date: Thu, 23 Apr 1998 08:15:20 GMT
From: ks@ic.uva.nl (Karel Sprenger)
Subject: Re: Help: crypt for Win32 ??
Message-Id: <6hmtao$sm5$1@mail.ic.uva.nl>

In article <353EA6BB.867BA2DC@netscape.com>, vish@netscape.com wrote:
> 
> Where can I find UNIX-like "crypt" function for Win32 Perl ?? Does
> anyone have a crypt lib for NT Perl ??
> thanks
> 

I sure hope it is available somewhere in a precompiled form!  It's downright 
stupid that it is not in the GS distribution 'due to excessive paranoia'. 
Sigh! As if the source code is not available in a thousand places.

Cheers,

Karel Sprenger <ks@ic.uva.nl>               | phone: +31-20-525 2302
Informatiseringscentrum                     |        +31-20-525 2741
Universiteit van Amsterdam                  | fax  : +31-20-525 2084
Turfdraagsterpad 9, NL-1012 XT  AMSTERDAM   | home : +31-20-670 0942
*** PGP Public Key available on servers *** | email: <cjas@xs4all.nl>


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

Date: Wed, 22 Apr 1998 18:58:08 -0400
From: Jerome Bradenbaugh <jerome.bradenbaugh@firstunion.com>
Subject: Help: To Kill an Object
Message-Id: <353E7600.55AA@firstunion.com>

Dear Readers,

I'm developing a web spider that recurses through an array of URLs. In
order to index each document, I create a new UserAgent object.

This works fine, but I think the object remains after it has performed
its dirty work. Is there a way to kill an object after each use, or is
there perhaps a way to request multiple documents with the same object?

Please enlighten me using the e-mail address below. 

TIA,


Jerry Bradenbaugh
First Union National Bank


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

Date: 22 Apr 1998 21:13:13 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Help: To Kill an Object
Message-Id: <ltvhs1pcgm.fsf@asfast.com>

Tom Phoenix <rootbeer@teleport.com> writes:

> On Wed, 22 Apr 1998, Jerome Bradenbaugh wrote:
> 
> > This works fine, but I think the object remains after it has performed
> > its dirty work. Is there a way to kill an object after each use, or is
> > there perhaps a way to request multiple documents with the same object?
> 
> Yes, and yes. Check out the info on destructors in perlobj for the first.
> If you're wanting to re-use an object, though, generally... you re-use the
> object! :-)  Hope this helps!

You might also want to check out the Class::Singleton module, which
allows you to define a one-instance-only, reusable class.  Here's an
excerpt from its `readme' file:

  DESCRIPTION
      This is the Class::Singleton module. A Singleton describes an
      object class that can have only one instance in any system. An
      example of a Singleton might be a print spooler or system
      registry. This module implements a Singleton class from which
      other classes can be derived. By itself, the Class::Singleton
      module does very little other than manage the instantiation of a
      single object. In deriving a class from Class::Singleton, your
      module will inherit the Singleton instantiation method and can
      implement whatever specific functionality is required.


-- 
 Lloyd Zusman       ljz@asfast.com
 perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
 $t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
 $x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x\n"'


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

Date: 23 Apr 1998 01:04:50 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How to create a new file?
Message-Id: <6hm43i$9va$2@comdyn.comdyn.com.au>

In article <353C962A.90077295@psy.nsu.ru>,
	Eugene Gorlov <eugene@psy.nsu.ru> writes:
> I need to create a new file on the disk. How can I do it
> using Perl?

You need to read this newsgroup, particulary the responses to a
question posted by Matthew Bell on 20 April, with EXACTLY the same
subject as yours. Please at least put in a little bit of work before
posting questions as basic as this. Check www.dejanews.com, the faq
and the documentation in any order. Then post.

This was one of the answers:

You need to read some documentation, specifically about the open()
function:

# perldoc -f open
[snip]
If the filename begins with '<' or nothing, the file is opened for input.
If the filename begins with '>', the file is truncated and opened for
output.  If the filename begins with '>>', the file is opened for
appending.
[snip]

So, if the filename starts with '>', the file will be created if it
doesn't exist, truncated to zero length if it does exist, and opened
for writing.

open(CURRFILE, ">$NewFN") || die "Cannot create $NewFN: $!";

Also, read the following:

# perldoc perlfaq
# perldoc perlfaq5


Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Very funny Scotty, now beam down my
Commercial Dynamics Pty. Ltd.       | clothes.
NSW, Australia                      | 


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

Date: 23 Apr 1998 01:30:10 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: if ($string eg "y") or if ($string == "y")
Message-Id: <6hm5j2$9j6$1@client2.news.psi.net>

Yeu-Perng Nieh (ynieh@fhcrc.org) wrote on MDCXCV September MCMXCIII in
<URL: news:353E81CD.167E@fhcrc.org>:
++ Dear all,
++ 
++  Does anyone know the difference b/w 
++ 
++ if ($string eg "y") and if ($string == "y")?

You must mean 'eq' here.

++ It seems to me that the latter does not work for string matching.
++ Even $string is something totally different from "y",
++ the if statement is always true. Any comments?

Well, it's explained in the manual. Which part didn't you understand?


Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Additional/s) [0]'


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

Date: Wed, 22 Apr 1998 09:35:59 +0100
From: "Frank L. Quednau" <quednauf@nortel.co.uk>
Subject: Re: Java Script in CGI
Message-Id: <353DABEE.D0DFB4EE@nortel.co.uk>

Brent Michalski wrote:

> Have you tried modifying the .cgi script to put the code in the HTML for
> the java applet?  That's where I'd start.  You may also want to try the
> comp.infosystems.www.authoring.cgi newsgroup since this is not a perl
> question.

But you make this question one when you recommend CGI.pm :) The module also
supports handlers for javascripts, which should at least make life a little
bit easier...

--
____________________________________________________________
Frank Quednau
Phone: +44 (0)1279 402447
http://www.surrey.ac.uk/~me51fq MailTo:F.L.Quednau@bnr.co.uk
____________________________________________________________





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

Date: 22 Apr 1998 05:41:34 GMT
From: jev@pconline.com (John Erjavec V)
Subject: matching man page lines
Message-Id: <6hjvue$kn$1@bell.pconline.com>

Hello all-

I decided to write a script to strip out the header and footer information
from man pages, since I was tired of having the header and footer
information in the wrong places on the pages.  The following script works,
but it runs a little slowly (when running on the Sybperl manpage, it took
54 seconds once, and 1 minute 25 seconds a different time).  

I have a couple questions: 1) Has anyone done this before (so I don't 
reinvent more of the wheel)? and 2) Does anyone have any suggestions on how 
to speed up the regexes (or general advise on the state of the code)?

The code was some of my earlier work that I am getting back to, but it
works, and my boss hasn't fired me yet, so it must be good. :)

Any comments appreciated.  Thanks.

Here is the code:

#!/usr/bin/perl -w
#
# Purpose:	To print the Unix man pages without having the pages wrap.
#		The program uses the user's default printer to print the 
#		pages.  Correctly handles man pages generated from the 
#		HP-UX OS and from the Perl 5.00[34] distributions (and 
#		probably others as well).
#
# Author:	John Erjavec V
#
# Usage:	manprint <man_page>
#
# Last Modified: Wed Apr 22 00:32:02 CDT 1998
#

use strict;

unless (($#ARGV == 0) || ($#ARGV == 1)) {
	&Usage();
	exit;
}

my ($manprog, $manpage, $last_line, $blank, $temp_file, @system_args, $tmp);
$manpage = $ARGV[0];
$manprog = "/usr/bin/man $manpage | /usr/bin/col -b | uniq";
$temp_file = "/tmp/manprint$$";
	
open (MANUAL, "$manprog |") or die "Can't open man page $manpage: $!";
open (TEMPFILE, ">$temp_file") or die "Can't open file $temp_file: $!";
$blank = 0;
while (<MANUAL>) {
	next if (/^ Hewlett-Packard Company/); #for HP footers
	next if (/^\s+(.+).+(\1)\s*$/); #for all headers
	next if (/\d \-\s+Formatted: /); #for Perl footers
	next if (/^\s+perl \d\.\d+.+with\s+$/); #for perl 5.003 headers
	next if (/^\s+perl \d\.\d+\, patch \d+\s+$/); #for perl 5.004 headers

	if (/^\s*$/) {
		$blank++;
		if ($blank < 2) { #to make sure only one blank line gets
					#printed in a row
			print TEMPFILE; 
		} 
	} else {
		$blank=0;
		print TEMPFILE;
	}
}
close (MANUAL);
close (TEMPFILE);

if ($#ARGV == 1) {
	if (($ARGV[1] eq "4up") || ($ARGV[1] eq "2up") || ($ARGV[1] eq "2+")) {
		@system_args = ("lp", "-t$manpage", "-o$ARGV[1]", "$temp_file");
	} 
} else {
	@system_args = ("lp", "-t$manpage", "$temp_file");
}

system @system_args;
unlink $temp_file;

sub Usage {
	print "Usage:  manprint.pl <man page> [4up|2up|2+]\n";
}
__END__

-JEV
-- 
John Erjavec V	PGP fingerprint:
jev@pconline.com	7593 1B5A AE11 C0FE BA09  EB5E 8DE9 D2E5 BF5B 87AD
http://www.pconline.com/~jev/index.html
"I'll say it again for the logic impaired."  --Larry Wall


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

Date: Wed, 22 Apr 1998 01:26:35 -0600
From: lawm@hotmail.com
Subject: Nested Multiline array sort help needed!
Message-Id: <6hk2ir$9oe$1@nnrp1.dejanews.com>

Hi!
I have the following problem..tried reading the faq..didn't help much.
I have a text file  in the following format....

Header1
Header2
SEPARATOR (some string &l26a1H)
 .......6 lines
Key ( text identifier used for sorting)
 .......n lines
SEPARATOR
 .......6 lines
Key
 .......n lines
PATTERN get repeated a few thousand times
EOF

What I want to do is get the separator and all the text till next separator
into a large array for all separators till EOF
Then sort this large arrays by Key, Key will be the first string in the 8th
line of the array.

I don't know If I can do all this online (using map.Schwartzian Transform sp?)
or open a new file to store the arrays and then sort them. Any hints at will
be greatly appreciated.

P.S I just started learning perl and might not know some of the "easy" stuff.

Thanx
Lawrence

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Wed, 22 Apr 1998 08:43:20 GMT
From: hertlein@umich.edu (Marcus P Hertlein)
Subject: print reverse pack strangeness?
Message-Id: <I4i%.1284$p5.6090512@news.itd.umich.edu>

Hm. I don't quite understand this:

$factor = 1;

$foo = pack("f",$factor);          
$foo2 = reverse(pack("f",$factor));
    
print OUTFILE $foo;                                 # writes 3f 80 00 00
print OUTFILE $foo2;                                # writes 00 00 80 3f
print OUTFILE pack("f", $factor);                   # writes 3f 80 00 00
print OUTFILE reverse(pack("f", $factor));          # writes 3f 80 00 00
print OUTFILE reverse(scalar pack("f", $factor));   # writes 3f 80 00 00
     
Why do the last three lines write same thing to my file whether I use
the reverse or not? For some reason the bytes don't get reversed, as I was
expecting. I was expecting the same output as in line 2 of the print
statements.

Is this an issue with variable types or just the way bytes are stored before
they're written?
I still am puzzled, after checking the faq, man page, and Camel book...

Any ideas?

--- Marc
(hertlein at umich dot e d u)



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

Date: Wed, 22 Apr 1998 20:58:36 GMT
From: "Noel Sampol" <noels@chilli.net.au>
Subject: Re: Problem with Perl read on NT
Message-Id: <893242950.450790@ajatar.dragon.net.au>

Sorry, this is not a suggestion but a simple query...

Can UNIX CGI scripts run without modification on NT running a Perl
interpreter?
If not, is it just the first line such as '#!/usr/bin/perl' - what would you
change this to hypothetically if the NT Perl interpreter was in directory
'\bin\test' ?

Also, if the CGI script needed to write to a file on NT server how would you
make sure the file rights allowed ANONYMOUS to write to it - would that be
the Administrator's job or could a user do it? Normally, under UNIX you just
'chmod a+rw filename' to make it Read/Writable - and you'd have to make the
CGI script Executable by 'chmod a+rx cgifile' - if I remember correctly
ANONYMOUS can Read/Execute perl scripts - right?

Finally, do CGI scripts have to have a set filename extension to
automatically run under NT?

Thanks - I'd appreciate any comments from anyone ;-)

Noel Sampol
noels@chilli.net.au





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

Date: Thu, 23 Apr 1998 00:07:01 GMT
From: jgloudon@hyssop.bbn.com.bbn.com (Jason Gloudon)
Subject: Re: QUESTION: foreach $scalar can this be foreach $hash{ref}
Message-Id: <slrn6jt1gt.2fi.jgloudon@hyssop.bbn.com>

Terrence Brannon <brannon@lnc.usc.edu> wrote:
>As you can see, below I had to use a scalar as the argument for my
>foreach loops because apparently perl cant assign to the keys of a
>hash within the foreach stmt.

I can't see what perl can't do because you didn't explain it too clearly.
Could you show the -code- that doesn't work and explain what you wanted it
to do ?

If you have nested foreach's without loop variables which implicity use $_ 
it's value at any point is the current element of the foreach immediately 
containing that line of code. 

>    foreach $v_factor_40 (@factor) {
>	foreach $v_factor_51 (@factor) {
>	    foreach $v_factor_32 (@factor) {
>		foreach $v_factor_25 (@factor) {
>		    $v{factor_40}=$v_factor_40;
>		    $v{factor_51}=$v_factor_51;
>		    $v{factor_32}=$v_factor_32;
>		    $v{factor_25}=$v_factor_25;
>
> 		    run_jobs_{$branch}'br';
          Did you mean to type a space^ here ?
>		    }
>	    }
>	}
>    }

--
Jason Gloudon


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

Date: Wed, 22 Apr 1998 20:25:55 -0400
From: reboot@tir.com
Subject: Re: Remote Process Monitoring
Message-Id: <353E8A93.3C29CCB@tir.com>

Thanks, but I am seeking a solution in Perl to monitor processes(remotely) on a
NT server. NOt just processes I've created. Any further help would be greatly
appreciated.

James Richardson wrote:
> 
> Mike Schlienz <mike@sccs.com> wrote in article <353D2E0C.8FFB940F@sccs.com>...
> 
> > Does anyone know of a way to monitor processes running on a remote/network
> > server? Thanx in advance for any info.
> >
> 
> Yes, if you have HP MC/ServiceGuard installed, then you can
> type cmviewcl -v, and it will show you if all the critical processes are running ok.
> 
> Did you want to know anything about Perl?
> 
> James
> 
> PS: Even if your question has nothing to do with perl, it would be helpful if you mentioned what OS you are using.
> 
> PPS: I seem to recall answering a similar question here only a week or two ago? Did you check DejaNews?


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

Date: 23 Apr 1998 01:21:48 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Remote Process Monitoring
Message-Id: <6hm53c$9va$5@comdyn.comdyn.com.au>

In article <353D2E0C.8FFB940F@sccs.com>,
	Mike Schlienz <mike@sccs.com> writes:
> Does anyone know of a way to monitor processes running on a remote/network
> server? Thanx in advance for any info.

What server? What OS? What sort of process? Do you want to monitor all
processes? Do you want specific processes that you write to be
monitorable? What sort of information do you want about or from these
processes? You really will have to at least outline what you want to
accomplish. 

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: 22 Apr 1998 08:50:10 GMT
From: Sleep <mhchau@cse.cuhk.edu.hk>
Subject: Re: Removing spaces from a variable, how?
Message-Id: <6hkb02$h1n@eng-ser1.erg.cuhk.edu.hk>

Craig Berry <cberry@cinenet.net> wrote:
> bjf (ben@wallroyds.demon.co.uk) wrote:
> : How do you remove all spaces ... ie ... " " .... from a variable using
> : pattern-matching?

> This is actually a much better job for tr:

>   $var =~ tr/ //d;

what's the difference if we use :

   $var =~ s/ //g;

?


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

Date: 22 Apr 1998 03:23:53 -0400
From: Justin Vallon <vallon@pearl.fi.bear.com>
Subject: Re: Replacement without counting return ????
Message-Id: <x6eg1j6mi9i.fsf@pearl.fi.bear.com>

Move the replace out of the print:

$var = "blubb";
$var =~ tr/b/k/;
# print "Replaced: ".$var."\n";
print "Replaced: $var\n";

=>

Replaced: klukk

 ...unless you want it there.

haert@wharp.rhein-main.de (Michael Haertfelder) writes:

> Suppose we have:
> 
> $var = "blubb";
> print "Replaced: ".$var =~ tr/b/k/."\n";
> print $var."\n";
> 
> the result will be:
> 
> Replaced: 3
> klukk
> 
> Is it possible to get
> 
> Replaced: klukk
> 
> as a oneliner ?
> 
> Thanx in advance
> 
> Michael
> 
> ------------- Michael Haertfelder Frankfurt/Main, Germany ----------------
> ------------- http://odb.rhein-main.de/people/haertfelder/ ----------------
>                        

-- 
-Justin
vallon@bear.com


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

Date: Wed, 22 Apr 1998 00:28:19 -0700
From: "Cory Johnson" <coryj@***NOSPAM***i-check.net>
Subject: Re: SendMail on NT
Message-Id: <6hk678$itm@sjx-ixn4.ix.netcom.com>

No, But I did a very extensive search on perl.com and many other perl
resources.

Andy Lester wrote in message <6hidda$jmr$1@supernews.com>...
>: : > I'm switching from a Unix system to a NT system and I have to convert
all my
>: : > perl cgi scripts over.  I was wondering if there is a module I can
use on NT
>: : > that would replace Unix's "sendmail".
>
>I don't suppose you did a search in any searchengines on "sendmail and
>NT".
>
>xoxo,
>Andy
>
>
>--
>--
>Andy Lester:        <andy@petdance.com>       http://tezcat.com/~andy/
>Chicago Shows List: <shows@ChicagoMusic.com>  http://ChicagoMusic.com/
>




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

Date: 23 Apr 1998 00:57:23 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: SendMail on NT
Message-Id: <6hm3lj$9va$1@comdyn.comdyn.com.au>

In article <354662ac.74427773@melcupa>,
	tonyyeh@earthlink.net writes:
> Hmm... I can't find module Net::SMTP on ftp.funet.fi

stop #1 for all your perl modules:

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

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | I took an IQ test and the results were
Commercial Dynamics Pty. Ltd.       | negative.
NSW, Australia                      | 


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

Date: 22 Apr 1998 20:55:58 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: spoiled noobie
Message-Id: <6hllgu$t9f$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, sitaram@diac.com (Sitaram Chamarty) writes:
:$var =~ s/(^ +)|( +$)//g;
:
:Change the spaces inside the parens to \s if you mean whitespace,
:not just space.

Do you realize how slow that is?

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
    If I don't document something, it's usually either for a good reason,
    or a bad reason.  In this case it's a good reason.  :-)
            --Larry Wall in <1992Jan17.005405.16806@netlabs.com>


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

Date: Thu, 23 Apr 1998 10:27:45 +0200
From: Christian Wetzel <cnwetzel@linguistik.uni-erlangen.de>
Subject: sprintf documentation (was: Re: Question on: printf %o STDOUT)
Message-Id: <353EFB81.1380@linguistik.uni-erlangen.de>

James Richardson:

> From what I understand of your question, you might want to look at the docs for 'sprintf'
> (perldoc -f sprintf), which allows you to assign formatted strings to variables.

Ah by the way, why is the CPAN HTML Version of perlfunc/sprintf
<URL:http://language.perl.com/CPAN/doc/manual/html/pod/perlfunc/sprintf.html>
missing the explanation of the conversions (%c, %s etc.)?
(perldoc -f sprintf is complete instead.)

Are the CPAN docs older than 5.004_04? Why?

Christian


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

Date: 23 Apr 1998 01:26:52 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Sprite
Message-Id: <6hm5cs$9va$6@comdyn.comdyn.com.au>

In article <353C9281.28EA8434@express-news.net>,
	Ron Woods <rwoods@express-news.net> writes:
> Is there a NT version of Sprite? I've found the Sprite download files;
> but they create unix executables. How do I get the NT executables? Or do
> they exist?

They create unix executables on a NT box? What sort of cross-compiler
do you have? Come to think of it, Sprite doesn't need any compilation.
It's plain perl.

What you need is a read of the perl faq. You also need something that
can read gzipped tar files (winzip for example). 

# perldoc perlfaq
# perldoc perlfaq8
/How do I install a CPAN module

Also read the perl for win32 faq at www.perl.com.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Inside every anarchy lurks an old boy
Commercial Dynamics Pty. Ltd.       | network - Mitchell Kapor
NSW, Australia                      | 


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

Date: Wed, 22 Apr 1998 09:52:44 -0600
From: Dan Baker <dtbaker_@flash.net>
Subject: techniques for tagging substitution areas in templates?
Message-Id: <353E124C.36D4@flash.net>

in cases where a small number of substitutions may be desired to an
existing document in KNOWN areas... i.e. inserting auto-generated
sections into a HTML or plain text template.  What are some good
techniques for tagging the areas to insert/substitute?

do you use <!-- comment tags --> and read for a specific comment string,
or do something else?

is it better to auto-generate the whole document rather than substitute?
I'm guessing that you still have to build the page with HTML to get the
format right, and then insert the source into a perl program? I can see
where this might be ok for simple forms, but get hard to edit with a
more complex document.

It seems that it would be easier to maintain the "look" of an HTML
template page if it were left in HTML with some internal tags... If you
have some examples of where I can look at programs that read through a
file looking for a tag, and do a substitution, it would be very helpful!

I'd love to get your ideas on the most efficient ways to go from a
prototyped HTML page, identify substitution areas, and wrap it in perl.

thanx,

Dan


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

Date: 23 Apr 1998 01:09:32 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: UNIX mail script
Message-Id: <6hm4cc$9va$3@comdyn.comdyn.com.au>

> Well, mail is not called SMTP for nothing, it is actually very easy to get
> mail sent without having a mail program.

<nitpick>
The original phrase was actually 'mail client' not 'mail program'. 
If you write your own client that implements SMTP, then that IS your
mail client. If you use telnet to connect to a SMTP server, then that
is your mail client.
</nitpick>

Of course the original poster meant things like 'external mail client'
like sendmail or blat or whatever.

-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | The gene pool could use a little
Commercial Dynamics Pty. Ltd.       | chlorine.
NSW, Australia                      | 


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

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

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