[7818] in Perl-Users-Digest
Perl-Users Digest, Issue: 1443 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 9 17:17:23 1997
Date: Tue, 9 Dec 97 14:00:22 -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, 9 Dec 1997 Volume: 8 Number: 1443
Today's topics:
Re: Checking if integer/real <jay@rgrs.com>
Re: Checking if integer/real <rootbeer@teleport.com>
Re: Fileupload <bill@adcn.on.ca>
how to monitor new file creation from the web <h.syed@larc.nasa.gov>
Re: Improving CGI.pm (brian d foy)
Re: Listing files on your server as scalar values. (brian d foy)
Re: Listing files on your server as scalar values. (Scott DiNitto)
Re: Multiple tie/untie on gdbm database failing (Steve van der Burg)
Re: Multiple tie/untie on gdbm database failing (Steve van der Burg)
Re: Need help stripping whitespace (brian d foy)
Re: Need help stripping whitespace <chawla@corp.home.net>
Re: Need help stripping whitespace <rootbeer@teleport.com>
Re: Need help stripping whitespace <h.syed@larc.nasa.gov>
Re: NT EventLog <leberre@bandol.grenoble.hp.com>
Re: opendir DIR, '/' <w.stanton@auckland.ac.nz>
Pie chart with GD.pm <c4sshir@srv.pacbell.com>
Re: Printing to file.. (brian d foy)
Re: questions on counters and printing form variables <chawla@corp.home.net>
Referring to Perl modules on the net? (Kartik Subbarao)
Re: Referring to Perl modules on the net? (brian d foy)
Re: Running Perl in "NICE" mode? (brian d foy)
Re: Running Perl in "NICE" mode? <rootbeer@teleport.com>
Socket I/O in Perl5 <erikdj@cyberjunkie.com>
Syntax problems with RegConnectRegistry in NT <richard@luckwelr.demon.co.uk>
Re: the skinny on my() vs local() - thanks to all (Faust Gertz)
Re: translate forms to mail <rootbeer@teleport.com>
Re: Using Pipe with Fork (Charles DeRykus)
Re: Win32::EventLog <leberre@bandol.grenoble.hp.com>
Writing fixed-length records to file speed@racer.cartoon.spam.address
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 09 Dec 1997 14:51:52 -0500
From: Jay Rogers <jay@rgrs.com>
To: "Hans Van Lint" <hvanlint@lodestar.be>
Subject: Re: Checking if integer/real
Message-Id: <82zpmab8h3.fsf@shell2.shore.net>
"Hans Van Lint" <hvanlint@lodestar.be> writes:
> I check the user's input like this (integer/real or not):
>
> $response = ($veld =~ /^\d+$/) ? "OK" : "NOT INTEGER/REAL";
>
> My problem:
>
> Users can't fill in real numbers like 0.001, 3.35, ...
How about relying on the perl warning feature? :-)
eval {
local $^W = 1;
local $SIG{'__WARN__'} = sub { die "non-numeric\n" };
$veld *= 1;
};
$response = !$@ ? "OK" : "NOT INTEGER/REAL";
--
Jay Rogers
jay@rgrs.com
------------------------------
Date: Tue, 9 Dec 1997 12:42:54 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Matthew Cravit <mcravit@best.com>
Subject: Re: Checking if integer/real
Message-Id: <Pine.GSO.3.96.971209123945.26951f-100000@user2.teleport.com>
On 9 Dec 1997, Matthew Cravit wrote:
> Hmm...the regexp I came up with was:
>
> /^-?(0|[1-9]+)(\.\d+)?$/
>
> which seems to work OK for the test cases I tried,
Didn't try these, did you? :-)
1024
29.
-.5
And did you mean for -0 to be all right? Keep trying! :-)
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 09 Dec 1997 15:33:59 -0500
From: Bill Davidson <bill@adcn.on.ca>
Subject: Re: Fileupload
Message-Id: <348DAB37.5DBD@adcn.on.ca>
Jeremy D. Zawodny wrote:
>
> [original author automagically cc'd via e-mail]
>
> On Sun, 7 Dec 1997 16:06:35 -0800, "Myles Lawrence"
> <myleslawrence@email.msn.com> wrote:
>
> >Can somebody send me an example for file upload or point me in that
> >direction?
>
> Grab a copy of CGI.pm from your local CPAN site. The docs have a
> working example, I believe.
I am also struggling with file uploads. All of the examples I have seen
for CGI.pm show how to take a text file as an upload and print it back
to the user browser screen. I want to receive binary files (*.gif) and
move them to another directory with a new name (client_id.gif).
How can I get the file handle or copy the tempfile directly..?
Please send an e-mail response to bill@adcn.on.ca
Thanks in advance.
------------------------------
Date: Tue, 09 Dec 1997 15:17:21 -0500
From: Hazari Syed <h.syed@larc.nasa.gov>
Subject: how to monitor new file creation from the web
Message-Id: <348DA750.946FD882@larc.nasa.gov>
--------------1D4AAEBE7FF4EE8584D1CABC
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi:
My Web CGI perl script needs to monitor new files being created. It
has
to report the existence of the new file only if it has completely been
written and closed. For example, a new tar file may be created.. It has
to
only report once the tar command has complted creation of the new file..
If the file size is growing, then the file existance has to fail.. Any
help will
be appreciated..
Hazari
--
**********************************************************************
Hazari I Syed h.syed@larc.nasa.gov
**********************************************************************
--------------1D4AAEBE7FF4EE8584D1CABC
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
Hi:
<BR> My Web CGI perl script needs to monitor new files being created.
It has
<BR>to report the existence of the new file only if it has completely been
<BR>written and closed. For example, a new tar file may be created..
It has to
<BR>only report once the tar command has complted creation of the new file..
<BR>If the file size is growing, then the file existance has to fail..
Any help will
<BR>be appreciated..
<P>Hazari
<PRE>--
**********************************************************************
Hazari I Syed h.syed@larc.nasa.gov
**********************************************************************</PRE>
</HTML>
--------------1D4AAEBE7FF4EE8584D1CABC--
------------------------------
Date: Tue, 09 Dec 1997 15:40:55 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Improving CGI.pm
Message-Id: <comdog-ya02408000R0912971540550001@news.panix.com>
In article <348cbc6d.0@usenet.fccj.cc.fl.us>, "Webmaster" <bill@astro.fccj.cc.fl.us> wrote:
>Tom Phoenix wrote in message ...
>>On 7 Dec 1997, Tushar Samant wrote:
>>
>>> CGI.pm should have a method which returns a hash of all the params.
>>
>>I'd agree, but what to do about parameters which can return more than one
>>item? If the hash uses a listref there, that's likely to cause confusion -
>>but maybe that's not unwarranted. :-)
>PMFJI, but I would have sworn the CGI.pm documentation states that param
>returns $variable in scalar, and @variable in array, etc.
and so it does. the appropriate line from the param method shows
what is happening:
return wantarray ? @{$self->{$name}} : $self->{$name}->[0];
if you ask for an array (which wantarray knows), you get an array.
if not, you get a scalar.
if you want to know more about data storage, see the parse_params
method. :)
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Tue, 09 Dec 1997 15:43:42 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Listing files on your server as scalar values.
Message-Id: <comdog-ya02408000R0912971543420001@news.panix.com>
In article <881656967.30439@dejanews.com>, jerryl@connecti.com wrote:
>Hi, I want to set each file I have on my remote server as a scalar
>value. I wrote the following script that will list all the files in my
>directory (unix system) but the information is in a file not a scalar
>variable.
[snip `ls -l` approach]
you might want to consider use of the directory reading family of
functions: opendir, readdir, and so on, along with the file test
operators.
see the perlfunc and perlop manual pages for more information.
good luck :)
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Tue, 09 Dec 1997 21:17:17 GMT
From: sdinitto@kronos.com (Scott DiNitto)
Subject: Re: Listing files on your server as scalar values.
Message-Id: <348db4c6.340338570@news>
On Tue, 09 Dec 1997 02:51:25 -0600, lineberry@cyberdude.com wrote:
>Hi, I want to set each file I have on my remote server as a scalar
>value. I wrote the following script that will list all the files in my
>directory (unix system) but the information is in a file not a scalar
>variable.
>
>Here's what I got so far:
>
>#!/usr/bin/perl
>
>$foo = `ls -l`;
>open(AUTOLIST, ">dir");
>print AUTOLIST $foo;
>close(AUTOLIST);
>
>-------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
I am going to assume you want to do this per directory... try this
#!/bin/perl
#Get a directory listing
system ("ls > dir.temp");
#remove/create dir RM WILL COMPLAIN IF DIR DOES NOT YET EXIST
system ("rm dir");
system ("touch dir");
#Open the file and input a $
open (AUTOLIST, "dir.temp");
$LSlist = <AUTOLIST>;
while ($LSlist){
#Split the Scalar where . exists
@LSlistSplit = split (/\./, $LSlist);
#Now join the two parts back together
$LSlistJoin = join ("", @LSlistSplit);
open (NEWDIR, ">>dir");
print NEWDIR "\$$LSlistJoin";
close NEWDIR;
$LSlist = <AUTOLIST>;
};
close AUTOLIST;
system ("rm dir.temp");
---
This is messy crappy code, but I believe it does what you want. I had
it split the filename where a '.' exists because scalars may not take
kindly to a '.' in their name at all times. Also, because I did this
so quick, I did not fancy or creative to recreate the dir file, so if
it does not exist, the command "rm" will complain dir does not exist
on first try or in new directories. Hope this works for you, and if it
does I expect food.
SD
------------------------------
Date: Tue, 09 Dec 1997 20:32:12 GMT
From: steve.vanderburg@lhsc.on.ca (Steve van der Burg)
Subject: Re: Multiple tie/untie on gdbm database failing
Message-Id: <66k9s6$ips@falcon.ccs.uwo.ca>
In article <66k5o0$cvo@falcon.ccs.uwo.ca>, steve.vanderburg@lhsc.on.ca (Steve van der Burg) wrote:
>Every time I run my script, it works fine the first time through the
>loop, but the second time it bombs with 'Interrupted system call'.
>
>Does anyone know what's going on? If I go from tie/untie back to the older
>dbmopen/dbmclose functions, it works fine (ie. I can open/close/open/close....
>just fine).
After some more digging, it turns out that the dbmopen/dbmclose code only
works because I don't check $! -- it's set to the same 'Interrupted system
call' that the 2nd tie generates, but the dbmopen has actually worked.
This made me very suspicious, so I changed back to tie/untie, stopped testing
$! to see if the tie had worked, and it turns out that the ties were working
all along.
This brings up another, more fundamental question: How do I tell if a tie has
been successful? Testing $! seems to be a bad idea...
..Steve van der Burg
steve.vanderburg@lhsc.on.ca
Steve van der Burg
Technical Analyst, Information Services
London Health Sciences Centre
London, Ontario, Canada
Tel: +1 519 663-3300 x 5559 (work)
+1 519 472-6686 (home)
Email: steve.vanderburg@lhsc.on.ca
WWW: http://www.lhsc.on.ca/~vanderbg/
------------------------------
Date: Tue, 09 Dec 1997 20:53:51 GMT
From: steve.vanderburg@lhsc.on.ca (Steve van der Burg)
Subject: Re: Multiple tie/untie on gdbm database failing
Message-Id: <66kb4n$kd1@falcon.ccs.uwo.ca>
In article <66k9s6$ips@falcon.ccs.uwo.ca>, steve.vanderburg@lhsc.on.ca (Steve van der Burg) wrote:
>>Every time I run my script, it works fine the first time through the
>>loop, but the second time it bombs with 'Interrupted system call'.
>>Does anyone know what's going on? If I go from tie/untie back to the older
>>dbmopen/dbmclose functions, it works fine (ie. I can open/close/open/close....
>>just fine).
>
>After some more digging, it turns out that the dbmopen/dbmclose code only
>works because I don't check $! -- it's set to the same 'Interrupted system
>call' that the 2nd tie generates, but the dbmopen has actually worked.
>This made me very suspicious, so I changed back to tie/untie, stopped testing
>$! to see if the tie had worked, and it turns out that the ties were working
>all along.
>
>This brings up another, more fundamental question: How do I tell if a tie has
>been successful? Testing $! seems to be a bad idea...
Sorry to subject everyone to what's turning out to be a conversation with
myself, but after using Perl 5 for 2 years, and tieing to gdbm databases all
that time, I have somehow managed to avoid learning about the tied() function!
I'm now using it to determine if a tie has succeeded, and making sure that I
undef the reference created by a test after a successful tie...
..Steve
Steve van der Burg
Technical Analyst, Information Services
London Health Sciences Centre
London, Ontario, Canada
Tel: +1 519 663-3300 x 5559 (work)
+1 519 472-6686 (home)
Email: steve.vanderburg@lhsc.on.ca
WWW: http://www.lhsc.on.ca/~vanderbg/
------------------------------
Date: Tue, 09 Dec 1997 15:07:12 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Need help stripping whitespace
Message-Id: <comdog-ya02408000R0912971507120001@news.panix.com>
In article <348d78e8.4607544@snews.zippo.com>, rob@gadgetguru.com (Rob Braden) wrote:
>In the meantiime, I need to write a program that wil identify and
>remove any whitespace within the URLs - there may be more than one URL
>per line.
$url =~ s/\s//g; #removes whitespace
is there more to the problem that you aren't telling?
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Tue, 09 Dec 1997 12:09:17 -0800
From: Naren Chawla <chawla@corp.home.net>
To: rob@gadgetguru.com
Subject: Re: Need help stripping whitespace
Message-Id: <348DA56C.FF014BA8@corp.home.net>
Rob:
This works...
#!/usr/bin/perl -w
#
# %W% %E%
#
##test
#
my $string = "www. something.com";
print "STRING: $string\n";
$string =~ s/ //g;
print "STRING: $string\n";
If you are in the Bay area, lets go for dinner. If you need additional
help, feel free to email.
--Naren
~
Rob Braden wrote:
> Hi!
> I've got a problem. We've got some software here that is munging
> some data. In particular, it's inserting spaces into URLs, which is a
> bad thing, obvioulsy. I don't have the source to this particular
> program, and it's critical to our operations, so I just have to wait
> patiently for a patch from the vendor.
>
> In the meantiime, I need to write a program that wil identify and
> remove any whitespace within the URLs - there may be more than one URL
> per line. I'm pretty new to Perl, and this one's got me scratching my
> head. I'm sure I could figure it out, but I need it quick! Any
> assistance will earn my eternal gratitude, and I'll buy you dinner if
> you're ever in the neighborhood.
>
> Thanks!
> Rob Braden
> rob@gadgetguru.com
------------------------------
Date: Tue, 9 Dec 1997 12:27:28 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Rob Braden <rob@gadgetguru.com>
Subject: Re: Need help stripping whitespace
Message-Id: <Pine.GSO.3.96.971209120409.26951c-100000@user2.teleport.com>
On Tue, 9 Dec 1997, Rob Braden wrote:
> In the meantiime, I need to write a program that wil identify and
> remove any whitespace within the URLs - there may be more than one URL
> per line.
In general, this can't be done. For example, suppose you have this line.
At the site http://www.somewhere.c om/ hello.html is a document.
That could become any of these:
At the site http://www.somewhere.com/ hello.html is a document.
At the site http://www.somewhere.com/hello.html is a document.
At the site http://www.somewhere.com/hello.htmlis a document.
At the site http://www.somewhere.com/hello.htmlisa document.
At the site http://www.somewhere.com/hello.htmlisadocument.
Some of these may seem improbably, but who is to say that they're wrong?
(You may think that the most likely one must end in .html, but that's
certainly not required for URLs! :-)
If you know where the errant whitespace is, of course, it's not hard to
remove. Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 09 Dec 1997 15:21:08 -0500
From: Hazari Syed <h.syed@larc.nasa.gov>
Subject: Re: Need help stripping whitespace
Message-Id: <348DA834.493C1156@larc.nasa.gov>
Some thing like this should work, though testing is required..
$line=~s/^\s+//g; # strip beginning white space
Hazari
Rob Braden wrote:
> Hi!
> I've got a problem. We've got some software here that is munging
> some data. In particular, it's inserting spaces into URLs, which is a
> bad thing, obvioulsy. I don't have the source to this particular
> program, and it's critical to our operations, so I just have to wait
> patiently for a patch from the vendor.
>
> In the meantiime, I need to write a program that wil identify and
> remove any whitespace within the URLs - there may be more than one URL
> per line. I'm pretty new to Perl, and this one's got me scratching my
> head. I'm sure I could figure it out, but I need it quick! Any
> assistance will earn my eternal gratitude, and I'll buy you dinner if
> you're ever in the neighborhood.
>
> Thanks!
> Rob Braden
> rob@gadgetguru.com
------------------------------
Date: Tue, 09 Dec 1997 12:14:49 +0100
From: Philippe Le Berre <leberre@bandol.grenoble.hp.com>
To: Elijah Kagan <administrator@barakitc.co.il>
Subject: Re: NT EventLog
Message-Id: <348D2829.74C9D077@bandol.grenoble.hp.com>
Hi,
On standard NT programming one use FormatMessage. The trouble is that
the Perl implementation of is limited to error message !
A work around is to use GrepEventId to retrieve the error message from
the message file.
check out : <http://www.inforoute.cgs.fr/leberre1/>.
Cheers,
--
Philippe Le Berre
SSG - CSBU R&D
Advance Technology Lab, Europe
----------------------------------------------------------------
Hewlett-Packard <leberre@bandol.grenoble.hp.com>
5 av Raymond Chanas Tel : 33 4 76 14 66 05
38053 Grenoble Cedex 9, France Fax : 33 4 76 14 14 65
------------------------------
Date: 10 Dec 1997 10:01:12 +1200
From: Worik Macky Stanton <w.stanton@auckland.ac.nz>
Subject: Re: opendir DIR, '/'
Message-Id: <wkd8j6qiqf.fsf@auckland.ac.nz>
mgjv@comdyn.com.au (Martien Verbruggen) writes:
>
> > When using the Activeware port of perl, I've noticed that using 'c:/',
> > or '/' wouldn't work with opendir(), but 'c:/.' did.
>
> Just as a matter of interest: Does '/.' work as well? Maybe someone
> with a DOS/win32 version of perl could test a few of these, and supply
> this as a FAQ to the win32 FAQ maintainers?
>
'/.' works.
'/' does not. Still.
'c:/.' works
'c:/' does not. (Today as well as yeterday)
Worik
------------------------------
Date: Tue, 09 Dec 1997 12:16:59 -0800
From: Chandra Shirashyad <c4sshir@srv.pacbell.com>
Subject: Pie chart with GD.pm
Message-Id: <348DA73B.3D61@srv.pacbell.com>
I am trying to create a pie-chart with GD.pm, but not very successful
doing so. The arc function is not very helpful in creating a pie chart.
Have anyone of you created a pie-chart using GD? Please let me know what
was your approach.
Thanks,
Chandra
------------------------------
Date: Tue, 09 Dec 1997 15:23:55 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Printing to file..
Message-Id: <comdog-ya02408000R0912971523550001@news.panix.com>
In article <Pine.GSO.3.95.971208034706.13184A-100000@mercury>, Jerry Lineberry <jerryl@connecti.com> wrote:
[snip other snippets]
>If I try to open a file and print to it like this:
>
>{
>open(FN, "str.txt");
>while (<FN>) {
> /jerryl/;
> $all = $`."\n";
> }
>open(FN, ">result");
>print FN $all;
>close(FN);
>}
>
>I only get the very first domain name in the "result" file.
let's look a bit more closely at your algorithm.
1. you open a file
2. you take in a line from the file
3. $all is set to the value of $` (from the last *successful* match)
4. if there is another line in the file, you go back to 2).
5. if there is not another line in the file, you open a file
for writing.
6. you print the value of $all to the file (this is a single
scalar value)
7. you close the file
perhaps you wanted something like
open(INPUT, 'str.txt') or die "opening str.txt: $!\n";
open(OUTPUT, '> result') or die "opening result: $!\n";
while( $line = <INPUT> ) { print OUTPUT "$`\n" if $line =~ m/jerryl/ }
close INPUT;
close OUTPUT;
this is the same thing you did when you were printing to standard output
(the default filehandle for print) except that you are printing to
OUTPUT.
HTH :)
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Tue, 09 Dec 1997 12:34:27 -0800
From: Naren Chawla <chawla@corp.home.net>
To: carolynv@huntsville.sgi.com
Subject: Re: questions on counters and printing form variables
Message-Id: <348DAB53.DD6FF076@corp.home.net>
Carolyn:
I will answer part 2 of your question:
2) I would like to print my form variables in my own order instead of
the sorted order that "foreach (sort keys $in)" does. How can I do this?
I know that I should say something like "foreach ('lastname',
firstname', ....)".
"foreach (sort keys $in)" - this is wrong, I think..
I suspect, you mean to write: foreach (sort keys %in)
where %in is an hash (associative array)
Once you have hash, its easy to access the value whenever you need.
For example, you can access the lastname as:
$in{'lastname'} - where lastname is the name of the key
So now you can print form variable in any order you wish.
For example:
my $lastname = $in{'lastname'};
my $firstname = $in{'firstname'};
my $dob = $in{'dob'};
print "$firstname $lastname". "'s birthday is on $dob\n";
Feel free to email, if you have further questions...
--Naren
Carolyn Vo wrote:
> Hi, everyone,
>
> I have some questions that are basic ones (I'm still getting the hang of
> CGI scripts and Perl):
>
> 1) I would like to include a counter in my web page. I have access to a
> counter script, but I don't know what to do to include it in my HTML
> document. What should I do to activate the script when the page is
> accessed?
>
> 2) I would like to print my form variables in my own order instead of
> the sorted order that "foreach (sort keys $in)" does. How can I do this?
> I know that I should say something like "foreach ('lastname',
> firstname', ....)".
>
> Thanks a lot!
> Carolyn Vo
> --
> *************************************
> Carolyn Vo
> Systems Engineer Coop
> 1500 Perimeter Pkwy, Suite 100
> Huntsville, AL 35806
> (205)864-3435
> FAX: (205)830-5438
> EMAIL: carolynv@huntsville.sgi.com
> *************************************
------------------------------
Date: 9 Dec 1997 20:16:57 GMT
From: subbarao@aurora.lf.hp.com (Kartik Subbarao)
Subject: Referring to Perl modules on the net?
Message-Id: <66k8vp$msk$1@hpavua.lf.hp.com>
I was thinking about what it might take to use Perl modules without
having to download and install them ahead of time. For instance, if you
said "use foo;", there would be some scheme whereby it would look for foo
somewhere on the network, download it dynamically, and perhaps cache it on
the local system.
That way, in theory, repositories like CPAN could maintain the latest and
greatest versions of perl modules, which you could automatically refer to
(perhaps authenticated with digital certificates?).
Of course, I know I'm glossing over tons of practical issues here, but what
do people think? Does this basically sound like a good idea?
-Kartik
--
Kartik Subbarao, Internet Solution Center, Hewlett-Packard
Email: Kartik_Subbarao@hp.com, Phone: (302) 633-8830, Fax: (302) 633-7490
Inside HP: http://aurora.lf.hp.com/home/
Internet Mirror: http://www.geocities.com/SiliconValley/Way/1234
------------------------------
Date: Tue, 09 Dec 1997 15:55:12 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Referring to Perl modules on the net?
Message-Id: <comdog-ya02408000R0912971555120001@news.panix.com>
In article <66k8vp$msk$1@hpavua.lf.hp.com>, subbarao@aurora.lf.hp.com (Kartik Subbarao) wrote:
>I was thinking about what it might take to use Perl modules without
>having to download and install them ahead of time. For instance, if you
>said "use foo;", there would be some scheme whereby it would look for foo
>somewhere on the network, download it dynamically, and perhaps cache it on
>the local system.
>Of course, I know I'm glossing over tons of practical issues here, but what
>do people think? Does this basically sound like a good idea?
well, in you scheme, you still have to download it and install it, so why
not just download and install it?
perhaps the CPAN module does what you want?
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Tue, 09 Dec 1997 15:04:11 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Running Perl in "NICE" mode?
Message-Id: <comdog-ya02408000R0912971504110001@news.panix.com>
In article <348D8D7D.95F29AA8@pop.pitt.edu>, ptomsic@pop.pitt.edu wrote:
>Assume that you're running a CPU intensive program every X hours. Is
>there a way to run this program
>in a NICE mode that wouldn't gobble up all the CPU , but rather only use
>what's currently available?
your operating system may have facilities for this sort of thing. the
best place to ask would be in a newsgroup devoted to your OS.
good luck :)
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
likes to be nice to his systems. renice even.
------------------------------
Date: Tue, 9 Dec 1997 12:35:50 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Paul Tomsic <ptomsic@pop.pitt.edu>
Subject: Re: Running Perl in "NICE" mode?
Message-Id: <Pine.GSO.3.96.971209123051.26951d-100000@user2.teleport.com>
On Tue, 9 Dec 1997, Paul Tomsic wrote:
> Assume that you're running a CPU intensive program every X hours. Is
> there a way to run this program in a NICE mode that wouldn't gobble up
> all the CPU , but rather only use what's currently available?
It's hard to use anything that's not available. :-)
But you can either run your program under nice(1), or you can set its
priority from within Perl directly. See whether the setpriority function,
documented in perlfunc(1), will do what you need. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 09 Dec 1997 13:54:13 -0500
From: "Erik D. Jones" <erikdj@cyberjunkie.com>
Subject: Socket I/O in Perl5
Message-Id: <348D93D5.B800556@cyberjunkie.com>
I am working with PERL5.003 and I'm writing a program that scans a range
of IP addresses. For each IP address it attempts a socket connection to
a particular PORT. Everything works great and I am able to process the
errors properly and all that (set by errno from the connect() function
call), but the connection timeout value is set so high that without
creating a multithreaded program, this scan is going to take a million
years.
get/setsockopt does not seem to have a value that specifically relates
to connection timeouts. It has
SO_SNDTIMEO and SO_RCVTIMEO, but those timers seem to be related to the
actual data comm. once a connection has already been established. I
looked in my $INCLUDE/sys/socketvar.h and saw that the socket struct has
a
so_timeo private variable related to connection timeouts, but I can't
change that.
What do I do??? ARgh!!
Here's the code:
use Socket;
.... code
.
.
.
sub tryscan
{
... code
.
.
########################
## Attempt connection ##
########################
socket(WWWTRANS, &AF_INET, &SOCK_STREAM, $proto) or
die "I cannot make my own socket:$!\n";
bind(WWWTRANS, $myport) or die "I cannot bind my own
socket:$!\n";
select(WWWTRANS); $|=1; select(STDOUT); #unbuffer the i/o to
our socket
connect(WWWTRANS, $srvport); #connect to the remote
socket
return $! if $!;
...code
.
}
------------------------------
Date: Tue, 09 Dec 1997 20:47:44 +0000
From: Richard Luckwell <richard@luckwelr.demon.co.uk>
Subject: Syntax problems with RegConnectRegistry in NT
Message-Id: <348DAE70.459A6EAE@luckwelr.demon.co.uk>
Im trying to use RegConnectRegistry to connect to remote registries for
editing Im using the following lines.
use Win32::Registry;
Win32::Registry::RegConnectRegistry("\\\\$NodeName", HKEY_USERS, $key);
This works fine and connects to the remote registry but I cannot find
the correct syntax or work out how to use GetKeys to get the registry
keys from the remote registry.
As Im new to perl I would appreciate any help.
Thanks
Richard Luckwell
richard@luckwelr.demon.co.uk
------------------------------
Date: Tue, 09 Dec 1997 20:23:12 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: the skinny on my() vs local() - thanks to all
Message-Id: <348da31b.2305241@news.wwa.com>
On 08 Dec 1997 14:38:12 -0600, Kent Perrier
<kperrier@Starbase.NeoSoft.COM> wrote:
>Randal Schwartz <merlyn@stonehenge.com> writes:
>
>> And yes, it was a paid "celebrity endorsement". From the reaction
>> y'all are giving me, I'll try not to do that again. Sorry.
>
>Well considering these two lines together, I would say "Go for all of the
>paid celebrity endorsements you can get." I don't know about everyone else
>but, in light of these circumstances, I can forgive you for making this
>kind of endorsement.
Sure, it is only his credibility that is at stake. :-) I almost
bought the book based on Randal's endorsement alone, but for some
reason decided to look at the code first. After looking at code
samples, I started to wonder if I had misunderstood all the things I
thought I learned about good Perl and CGI programming by reading this
newsgroup and Randal's _Web Techniques_ articles. I didn't buy the
book and I am happy Randal came clean.
Streben nach Wahrheit
Faust Gertz
Philosopher at Large
"Even the gods, for all they are called wise, are no more to be
trusted than fleeting dreams. Among the gods, no less than mortal
men, confusion reigns." -- Orestes, _Iphigenia in Taurus_
------------------------------
Date: Tue, 9 Dec 1997 12:44:45 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Denis <d.rosmi@pd.nettuno.it>
Subject: Re: translate forms to mail
Message-Id: <Pine.GSO.3.96.971209124332.26951g-100000@user2.teleport.com>
On Tue, 9 Dec 1997, Denis wrote:
> I would like to know how i could translate some datas inserted in a html
> form to mail (subject, name, address, etc.)
This is usually done with a CGI script. Although those are frequently
written in Perl (and even using Perl modules), discussion of how to go
about making a CGI script takes place in newsgroups about CGI programming,
which have 'cgi' in their names. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 9 Dec 1997 19:07:20 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Using Pipe with Fork
Message-Id: <EKxrs8.796@bcstec.ca.boeing.com>
In article <3486FA0A.D5E@arl.mil>, Howell Caton (ISTD/TD) <caton> wrote:
> Greetings: I want to use pipe with fork to pipe data to and from the
> same executable, but I don't know how to associate READHANDLE and
> WRITEHANDLE with the executable. Do I use "open" like this?
>
> open(READHANDLE, "doit|");
> open(WRITEHANDLE, "|doit");
>
> I don't think so! The idea solution would be for someone to point
> me to an example where this is done. Thanks!
>
>
perldoc open2
HTH,
--
Charles DeRykus
------------------------------
Date: Tue, 09 Dec 1997 12:11:05 +0100
From: Philippe Le Berre <leberre@bandol.grenoble.hp.com>
To: kabe01@idt.net
Subject: Re: Win32::EventLog
Message-Id: <348D2749.B6A89A43@bandol.grenoble.hp.com>
Hi,
Can you read these logs with the Event viewer ? if not, you might not
have the rights to read the logs.
What are the messages returned in $! ?
Cheers,
--
Philippe Le Berre
SSG - CSBU R&D
Advance Technology Lab, Europe
----------------------------------------------------------------
Hewlett-Packard <leberre@bandol.grenoble.hp.com>
5 av Raymond Chanas Tel : 33 4 76 14 66 05
38053 Grenoble Cedex 9, France Fax : 33 4 76 14 14 65
------------------------------
Date: 09 Dec 1997 13:55:12 -0700
From: speed@racer.cartoon.spam.address
Subject: Writing fixed-length records to file
Message-Id: <yz267oykzin.fsf@advtech.uswest.com>
Ciao!
I have a fixed length record of delimited fields that I want to write to
a UN*X file. Quite often the last field of the record is blank so needs
to be filled with spaces.
When using perl formats, if the last field is blank, it is truncated to
the preceeding delimeter when written to file. Naturally this hoses my
fixed length record.
I could append a delimiter to the record before printing which preserves
the final field's length when filled with spaces, but this requires a
subsequent filter to strip the trailing delimeters which I would prefer
not to do.
There must be a cleaner solution to outputting fixed length records
which preserves the trailing field length even if it is blank or spaces.
The FAQ mentions using pack/unpack for manipulating fixed length
records. I have not applied this approach to printing of the record. I
will try it.
If anyone has comments on or a solution to the above problem, I would
appreciate hearing them. Thank you in advance.
Post or email ... although the return address for email is listed in the
sig, not in the "From".
Peace.
--
Bruce W. Hoylman (303/541-6557) -- bhoylma@advtech.USWest.COM ._ 0
- __0 Speaking for myself... /\/\ /\ / //\.
- - - _-\<,_ "Please saw my legs off". /~/~~\/\/~~\ ' \>> |
- __(_)/_(_)_____________________________/\ / \ \/\ \________\\ `_
------------------------------
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 1443
**************************************