[7144] in Perl-Users-Digest
Perl-Users Digest, Issue: 770 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 24 12:30:52 1997
Date: Thu, 24 Jul 97 08:01:42 -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, 24 Jul 1997 Volume: 8 Number: 770
Today's topics:
Re: ? typeglob of a hash in a hash. woo! (M.J.T. Guy)
Arrays and Refs - is this a feature ? (Helmut Jarausch)
CORBA and Perl <jacksodp@dragon.ham.muohio.edu>
Re: Date to Number function? (Clay Irving)
Re: Date to Number function? <rootbeer@teleport.com>
Re: File access from Perl <chrisl@worktechnology.com>
Re: File access from Perl <sfairey@adc.metrica.co.uk>
Re: Formating text: changing the \n to a <P> <dboorstein@ixl.com>
Re: generate e-mail with MIME .dat file (Franklin Hsia)
How to call a subroutine from a variable? (Toutatis)
Re: How to call a subroutine from a variable? <sfairey@adc.metrica.co.uk>
Re: How to Get Multiple Selected Options of a Multiple <rootbeer@teleport.com>
Re: Last US business date in Perl? (Clay Irving)
Re: Mod_perl + Apache. perl flags on startup question <dougm@osf.org>
multi-dimensional arrays in PERL - How ? (Dominic Feeley)
Re: multi-dimensional arrays in PERL - How ? <sfairey@adc.metrica.co.uk>
National Medal of Technology: Let's nominate Larry! (Bob Shair)
Re: National Medal of Technology: Let's nominate Larry! <zot@ampersand.com>
ole automation MSAccess?? (Richard/Barbara Males)
Re: Passing references around <sfairey@adc.metrica.co.uk>
Perl 5.004/Sybperl 2.07 on Windows NT <ar@pine.dk>
Perl RTF parser dominic@thiru.vetri.com
Please help with WWWboard, I know nothing of perl! <avpros@avpros.net>
Re: process handling <xrcc0494@dcaca037.ca.boeing.com>
Question. <brandon@mrgolm.com>
Re: Question: MacPerl & "require" <rootbeer@teleport.com>
Re: Re-Flowing ASCII Text <sfairey@adc.metrica.co.uk>
Reading from a text file? (Burt Lewis)
Re: Reading from a text file? (Nathan V. Patwardhan)
Re: simple? question <sfairey@adc.metrica.co.uk>
socket help <rmcguigan@ramresearch.com>
Re: Sprite Database (Jim Esten)
Use ODBM_File/NDBM_File...help (Seth Perlman)
WEB discussion tool <kjetilp@a.sn.no>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 21 Jul 1997 16:43:09 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: ? typeglob of a hash in a hash. woo!
Message-Id: <5r03it$edj@lyra.csx.cam.ac.uk>
Jahwan Kim <jahwan@supernova.math.lsa.umich.edu> wrote:
>
> OK, I read several followups, and now know how to work it out. But
>while we're on the subject, how do you make $idhash{"element1"} to be a
>synonym of $idhash{"element2"}, using typeglob?
You can't. Typeglobs are (roughly) symbol table entries and operations
on them change the variables associated with particular symbols.
A hash element doesn't have a symbol table entry - the symbol table
refers to the hash as a whole. So you can alias whole hashes but
not individual elements.
Mike Guy
------------------------------
Date: 21 Jul 1997 09:52:18 GMT
From: jarausch@numa1.igpm.rwth-aachen.de (Helmut Jarausch)
Subject: Arrays and Refs - is this a feature ?
Message-Id: <5qvbgi$4eq$1@news.rwth-aachen.de>
Hi,
I have come across the follow problem when using an array-element
as '-variable' to a Radiobutton (pTk)
use strict;
use vars qw/ @T /;
my ($T0,$T1)= (\$T[0],\$T[1]); # $T[0] doesn't seem to 'spring into existence'
@T=(1,1);
$$T1=2; # no warning or error message
print "@T\n"; #prints 1 1 - what a surprise
my ($S0,$S1)= (\$T[0],\$T[1]);
$$S1=2;
print "@T\n"; #prints 1 2 - as expected
------------------------------
obviously \$T[0] and \$T[1] are references to the Nirwana unless
something has been assigned to $T[0] and $T[1].
And '-w' doesn't help either in this case.
Perhaps a big warning could be added to the perlref man page UNLESS it's a bug.
Please comment,
Helmut.
--
Helmut Jarausch
Lehrstuhl f. Numerische Mathematik
Institute of Technology, RWTH Aachen
D 52056 Aachen, Germany
------------------------------
Date: 24 Jul 97 09:44:31 -0500
From: Dane P. Jackson <jacksodp@dragon.ham.muohio.edu>
Subject: CORBA and Perl
Message-Id: <1997Jul24.094431.5986@nntp.muohio.edu>
The site for corba/perl is at http://www.lunatech.com/cope
hope that helps.
--
Dane Jackson - jacksodp@dragon.ham.muohio.edu
"Never date a woman with a brother named Nunzio."
-Walter Slovotsky's Law #22
------------------------------
Date: 24 Jul 1997 10:06:43 -0400
From: clay@panix.com (Clay Irving)
Subject: Re: Date to Number function?
Message-Id: <5r7nhj$46k@panix.com>
In <33d6c006.5805297@news.pipcom.com> ils@pipcom.com (Scott Card) writes:
>Is there a perl date to number function that converts the date to a
>number of days from a specific date (ie Jan 1, 1980)
This program:
#!/usr/local/bin/perl -w
use Date::Parse;
use Date::DateCalc qw(dates_difference);
$then = "Jan 1 1980 00:00";
($d1,$m1,$y1) = chop_date($then);
$today = localtime;
($d2,$m2,$y2) = chop_date($today);
$days_left = dates_difference($y1,$m1,$d1, $y2,$m2,$d2);
print "Today is $today\n";
print "$days_left days since Jan 1 1980!\n";
sub chop_date {
my $date = shift;
(undef,undef,undef,$dd,$mm,$yy,undef) = strptime($date);
$yy += 1900;
$mm++;
return ($dd, $mm, $yy);
}
prints:
Today is Thu Jul 24 10:11:31 1997
6414 days since Jan 1 1980!
--
Clay Irving <clay@panix.com> http://www.panix.com/~clay/
------------------------------
Date: Thu, 24 Jul 1997 07:30:47 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Scott Card <ils@pipcom.com>
Subject: Re: Date to Number function?
Message-Id: <Pine.GSO.3.96.970724072936.13627H-100000@kelly.teleport.com>
On Thu, 24 Jul 1997, Scott Card wrote:
> Is there a perl date to number function that converts the date to a
> number of days from a specific date (ie Jan 1, 1980)
Yes, and if you look through the modules list, you might find it on CPAN.
:-) 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/
------------------------------
Date: 24 Jul 1997 12:59:17 GMT
From: "Chris Lawless" <chrisl@worktechnology.com>
Subject: Re: File access from Perl
Message-Id: <01bc9831$4ef91f20$5a605cc3@cml.worktechnology.com>
Just to prove I'm trying whilst hoping for more help I have my first script
running, exciting as it is all it does is:
open(test1,">test1.txt");
print test1 "Writing to file 3333\n";
close(test1);
an, by adding another > I can make it append!
Now, I was going to try and work out how to test if the file existed then
decide how to open it but a little more testing shows it's needless as with
and open for apend it creates it if it doesn't already exist.
Next bit, how do I receive form data, enclose each variable in quotes (")
and seperate them by commas, then write them to the file?
C. *getting excited*
------------------------------
Date: Thu, 24 Jul 1997 15:04:04 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: Chris Lawless <chrisl@worktechnology.com>
Subject: Re: File access from Perl
Message-Id: <33D760D4.C75BA6D4@adc.metrica.co.uk>
Chris Lawless wrote:
> Just to prove I'm trying whilst hoping for more help I have my first
> script
> running, exciting as it is all it does is:
> open(test1,">test1.txt");
> print test1 "Writing to file 3333\n";
> close(test1);
> an, by adding another > I can make it append!
>
> Now, I was going to try and work out how to test if the file existed
> then
> decide how to open it but a little more testing shows it's needless as
> with
> and open for apend it creates it if it doesn't already exist.
>
> Next bit, how do I receive form data, enclose each variable in quotes
> (")
> and seperate them by commas, then write them to the file?
>
> C. *getting excited*
If you are talking about getting data from a web form then I suggest
you get the CGI.pm module, look through it and the various examples and
then if you are still stuck post a message to the
comp.infosystems.www.authoring.cgi newsgroup.
Simon
------------------------------
Date: Thu, 24 Jul 1997 10:08:12 -0400
From: Dan Boorstein <dboorstein@ixl.com>
Subject: Re: Formating text: changing the \n to a <P>
Message-Id: <33D761CC.1DC68919@ixl.com>
Faust Gertz wrote:
>
>
> Well,
>
> $text =~ s/\n/<BR>/g;
>
> will put a line break anywhere the person has hit return. While this
> is what I would do, it might not be what you want.
>
Don't forget that, if this is input from a web browser, different OS's
send different characters to indicate usage of the 'return/enter' key.
I believe it is as follows:
UNIX - \n
MAC - \r
PC - \r\n
In my dealings with these situations I usually do something like this:
$text =~ s/\r\n/<BR>/g; # get rid of PC 'enter's
$text =~ s/[\r\n]/<BR>/g; # get rid of MAC and UNIX 'enter's
Cheers,
Dan Boorstein
danboo@ixl.com
------------------------------
Date: Thu, 24 Jul 1997 09:13:22 -0600
From: fwh01@health.state.ny.us (Franklin Hsia)
Subject: Re: generate e-mail with MIME .dat file
Message-Id: <869752923.17569@dejanews.com>
Check out the MIME-tools module on CPAN. Makes creating MIME
attachments a breeze. Also, in addition to CPAN, you can check
out the author's webpages at http://www.mcs.net/~eryq
HTH
Franklin Hsia
In article <5r0t11$e9r@netnews.upenn.edu>,
ayfishma@mail2.sas.upenn.edu (Ariel Y Fishman) wrote:
>
> Greetings! I am trying to write a CGI perl script that will turn
form
> submissions into an e-mail with a MIME attachment containing the
form
> data as a tab-delimited spreadsheet. I'm not having much luck,
however.
> I've been trying just to generate the e-mail in a perl script, send
it
> using sendmail, and make it look like there is an attachment
present, but
> it doesn't seem to work (it reads the e-mail message literally, and
not
> as an attachment.)
>
> Can someone suggest a way either to do what I'm doing above, or a
> different way (i.e. instead of sendmail with another program?).
Also, are
> my carriage returns/newlines in the right place?
>
> Thanks in advance,
>
> Ariel
>...
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 21 Jul 1997 10:49:16 GMT
From: toutatis@remove.this.toutatis.net (Toutatis)
Subject: How to call a subroutine from a variable?
Message-Id: <toutatis-ya023180002107971249190001@news.euro.net>
My code:
use strict;
foreach $var(@vars){
$subroutine = "check_$var";
&$subroutine($arguments);
}
strict complains it cannot use $subroutine as a subroutine reference.
Ok, well how DOES this have to be written?
--
Toutatis
------------------------------
Date: Mon, 21 Jul 1997 12:18:23 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: Toutatis <toutatis@toutatis.net>
Subject: Re: How to call a subroutine from a variable?
Message-Id: <33D34578.153288CB@adc.metrica.co.uk>
Toutatis wrote:
> My code:
>
> use strict;
> foreach $var(@vars){
> $subroutine = "check_$var";
> &$subroutine($arguments);
> }
>
> strict complains it cannot use $subroutine as a subroutine reference.
> Ok, well how DOES this have to be written?
>
> --
> Toutatis
I think that is the whole idea behind the strict module in that the
above is not meant to work full stop. You will probably have to 'no
strict 'refs'' in an inner loop to get around this. You could also look
into storing the subroutine references in a hash and accessing them that
way, i.e:
use strict;
my $var;
my %refs = ( 'one' => \&print_one,
'two' => \&print_two,
'three' => \&print_three,
'four' => \&print_four );
foreach $var ( qw( one two three four ) ) {
&{$refs{$var}}();
}
sub print_one { print "\nOne" }
sub print_two { print "\nTwo" }
sub print_three { print "\nThree" }
sub print_four { print "\nFour" }
Hope this gets you somewhere.
Simon
------------------------------
Date: Thu, 24 Jul 1997 07:41:59 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: $j,u?OE" <swsung.bbs@cis.nctu.edu.tw>
Subject: Re: How to Get Multiple Selected Options of a Multiple Select Object???
Message-Id: <Pine.GSO.3.96.970724074055.13627J-100000@kelly.teleport.com>
On 24 Jul 1997, =A4j=AC=F5=BFO=C5=A2 wrote:
> In using cgi-lib, I used $input{'SelectName'} to get
> the multiple selected options of a multiple select object.
> However, I could only get the first selected option.
>=20
> How can I get all the selected options?
Use CGI.pm instead. Hope this helps!
--=20
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/
------------------------------
Date: 24 Jul 1997 09:51:57 -0400
From: clay@panix.com (Clay Irving)
Subject: Re: Last US business date in Perl?
Message-Id: <5r7mlt$snj@panix.com>
In <hh67u1zdzx.fsf@dres.elam.org> James LewisMoss <dres@dimensional.com> writes:
>>>>>> On Thu, 17 Jul 1997 00:12:21 -0600, treed@cpr.com said:
> treed> Hi, I need to determine whether a particular date was a US
> treed> business day. I also need to determine the last 5 US business
> treed> dates. Does anyone know of a Perl package that can help?
>look at the Date::Manip package in CPAN. It does business days,
>parses dates (like "today" or "last sunday"), and it'll do relative
>date ("today", "-1 week"; etc)
And it lets you build a calendar to define "business days" with neat
constructs like:
Thanksgiving last Thursday in November
If cron was only so friendly...
--
Clay Irving <clay@panix.com> http://www.panix.com/~clay/
------------------------------
Date: Sun, 20 Jul 1997 19:24:11 -0400
From: Doug MacEachern <dougm@osf.org>
To: Microserf <sb@netcom.com>
Subject: Re: Mod_perl + Apache. perl flags on startup question
Message-Id: <33D29E1B.1518@osf.org>
Microserf wrote:
>
> hi,
> we have a test Apache server, with Mod_perl running on an IRIX
> system. i would like to setup the server, so that perl(5) is started
> up with certain debugging flags (perl -d:DProf). i've looked through
> the docs, but couldn't find a way to do this. can someone help me set
> this up plesae?
You should be able to 'setenv PERL5OPT -d:DProf' before starting the
server (with perl5.004 or better), but I have not tried it with -d:DProf.
-Doug
>
> thanks,
> sb
> --
> WIDE AWAKE IN AMERICA
> Sanjay Bhatia <sb@ip.com> www.best.com/~sanjay
> 408 588-1100 X547 Intranet Partners, Santa Clara, CA
------------------------------
Date: 23 Jul 97 09:01:55 GMT
From: D.Feeley@unixa.nerc-wallingford.ac.uk (Dominic Feeley)
Subject: multi-dimensional arrays in PERL - How ?
Message-Id: <33d5c883.0@wltss01.nerc-wallingford.ac.uk>
Keywords: multi dimension array PERL
Hello,
I have tried to set up a multi-dimensional array in PERL 5,
but am having no luck in accessing the array.
Could someone give me an example so I can have a
two-dimensional array, or a pointer to some tutorials. I've looked in
"Learning PERL" and "Programming PERL", but they haven't
helped me. Neither did a search on the web.
perl -v returns the following:
This is perl, version 5.003 with EMBED
built under solaris at Jan 16 1997 13:10:33
+ suidperl security patch
Thanks in anticipation,
--
Dominic Feeley
ITSS UNIX Systems Group, Wallingford, England
------------------------------
Date: Thu, 24 Jul 1997 15:01:44 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: D.Feeley@unixa.nerc-wallingford.ac.uk
Subject: Re: multi-dimensional arrays in PERL - How ?
Message-Id: <33D76047.E6FA5465@adc.metrica.co.uk>
Dominic Feeley wrote:
> Hello,
>
> I have tried to set up a multi-dimensional array in PERL 5,
> but am having no luck in accessing the array.
>
> Could someone give me an example so I can have a
> two-dimensional array, or a pointer to some tutorials. I've looked in
> "Learning PERL" and "Programming PERL", but they haven't
> helped me. Neither did a search on the web.
>
> perl -v returns the following:
>
> This is perl, version 5.003 with EMBED
> built under solaris at Jan 16 1997 13:10:33
> + suidperl security patch
>
> Thanks in anticipation,
>
> --
> Dominic Feeley
> ITSS UNIX Systems Group, Wallingford, England
See the perllol manpage and the FAQ they have all the info and
exapmles you should need.
Simon
------------------------------
Date: 20 Jul 1997 22:48:36 GMT
From: rmshair@uiuc.edu (Bob Shair)
Subject: National Medal of Technology: Let's nominate Larry!
Message-Id: <5qu4k4$i1v$1@vixen.cso.uiuc.edu>
The US Department of Commerce is soliciting nominations for the
1998 National Medal of Technolgy. See: http://www.ta.doc.gov/MEDAL
When I think of technological improvement which has made it possible
for me, and countless others like me, to do our jobs better, both by
improving the quality of work and by making it easier to do,
Larry Wall is ad the head of the list.
Anyway, I'm tired of seeing these all go to people who represent
(or have founded what are now) big companies. Last year's winners:
## Norman R. Augustine, CEO and Chairman, Lockheed Martin;
## Ray Dolby, Founder and Chairman of Dolby Laboratories, Inc.;
## Robert S. Ledley, Director of Medical Computing and Biophysics
and Professor of the Department of Radiology and Physiology and Biophysics
for Georgetown University Medical School;
## team of Vinton Cray Cerf, Senior Vice President of Data Architecture, MCI;
and Robert E. Kahn, President, Corporation for National Research Initiatives.
--
Bob Shair Open Systems Consultant
1018 W. Springfield Avenue rmshair@uiuc.edu
Champaign, IL 61821 217/356-2684
< Not employed by or representing the University of Illinois >
------------------------------
Date: 21 Jul 1997 10:03:39 -0400
From: Mark Atwood <zot@ampersand.com>
To: tpi@perl.org
Subject: Re: National Medal of Technology: Let's nominate Larry!
Message-Id: <v6afjgh58k.fsf@tick.dev.ampersand.com>
rmshair@uiuc.edu (Bob Shair) writes:
>
> The US Department of Commerce is soliciting nominations for the
> 1998 National Medal of Technolgy. See: http://www.ta.doc.gov/MEDAL
>
> When I think of technological improvement which has made it possible
> for me, and countless others like me, to do our jobs better, both by
> improving the quality of work and by making it easier to do,
> Larry Wall is ad the head of the list.
>
No kidding. The Perl Institute should probably be the one to submit
the application, but it probably would not be hard to get at least the
minimum 6 Letters Of Recommendation. I'm reasonably sure one can be
shaken out of my employer (we do a *LOT* of Perl stuff).
Hey, Perl Institute, you want want to do this? Maybe we should start
an online campaign, "Give Larry a Medal". (semi-serious)
--
Mark Atwood | Thank you gentlemen, you are everything we have come to
zot@ampersand.com | expect from years of government training. -- MIB Zed
------------------------------
Date: 24 Jul 1997 14:55:01 GMT
From: males@iac.net (Richard/Barbara Males)
Subject: ole automation MSAccess??
Message-Id: <5r7qc5$fnj$1@ocoee.iac.net>
I am looking for an example .pl script using ole automation to add
records to a table in an existing MSAccess database. I am new to
OLE automation, and have looked at the Excel examples in eg of
Win32, but would appreciate something showing me how to get around
in Access.
Thanks in advance
Dick Males
Cincinnati, Ohio, USA
------------------------------
Date: Wed, 23 Jul 1997 12:18:19 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: Neil Edmondson <neiled@enteract.com>
Subject: Re: Passing references around
Message-Id: <33D5E87A.A1109287@adc.metrica.co.uk>
Neil Edmondson wrote:
> The following snippet works. What I would like to do is use a scalar
> (the
> additional path_info passed by CGI), to reference the hash. The
> scalar
> will contain the value "fabric" e.g. $path_info = "fabric". How do I
> write
> the code to turn $themeref into a reference to %fabric based on the
> value
> of $path_info?
See below...
>
>
> TIA, Neil - email to neiled@enteract.com gratefully received.
> -------------------------------------------------------------
> --------------
>
> $path_info = "fabric"; #note this scalar is not YET used in the
> following
> %fabric = (
> "Garden Splendor", "1",
> "Market Day Plaid", "2",
> "Classic Blue", "3",
> "Heritage Green", "4",
> "Traditional Red", "5",
> "Natural", "6",
> "Holly", "7",
> "Imperial Stripe", "8",
> "Rose Trellis", "9",
> "Emerald Vine", "10");
>
> $themeref = \%fabric;
Change the above to: $themeref = \%$path_info;
( Look in the perlref page this sort of thing is covered there )
Which should work fine, if not it will do but just needs some tweak I
have temporarily forgotten about.
Let me know if its what you want.
Simon
------------------------------
Date: Mon, 21 Jul 1997 10:04:40 +0200
From: "Antony C. Roberts" <ar@pine.dk>
Subject: Perl 5.004/Sybperl 2.07 on Windows NT
Message-Id: <869472332.491443@oak>
Has anybody managed to get Sybperl 2.07 to work with the Perl 5.004
distribution on NT? If so, how?
Cheers in advance,
Antony C. Roberts
PS: Please CC your reply to ar@pine.dk
------------------------------
Date: Mon, 21 Jul 1997 10:25:03 -0600
From: dominic@thiru.vetri.com
Subject: Perl RTF parser
Message-Id: <869493836.30658@dejanews.com>
Hello Perlians,
Is there any free RTF parser Perlscript available on the Net. I have
alrady got rtf2sgml. has any one evaluated it?
Mainly I want to convert some RTF/Word DOC files to some other format. So
if a Perlscript reads a RTF file and gives information by filling some
sort of structures it will be well and good.
Thanks and Regards
Dominic
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 20 Jul 1997 23:47:53 GMT
From: "Audio Video Pros" <avpros@avpros.net>
Subject: Please help with WWWboard, I know nothing of perl!
Message-Id: <01bc9567$097ba700$26a328ce@avpros>
I have been trying to install WWWboard and I keep getting a 500 error,
Internal server error. I know nothing about this but I beleive it has to do
with my base directory. I do not know how to find out the path for it, no
reply from my webmaster. If I go to the contents of the program, that is
the main page for WWWboard and not enter a name I get the no name entered
page so I guess some processing is happening. But if I fill the form out
and try to post the info I get the error. HELP!
Check out the contents at http://www2.thecia.net
/users/avpros/wwwboard/wwwboard.html
Dave
dave@avpros.net
------------------------------
Date: Mon, 21 Jul 1997 18:17:33 GMT
From: "robert c. combs" <xrcc0494@dcaca037.ca.boeing.com>
Subject: Re: process handling
Message-Id: <33D3A7BD.55D@dcaca037.ca.boeing.com>
I'm not sure about the background and the reasons for
implementing this in a perl script. But, if you simply
want to be sure a process stays running here's the ol
tried and true:
#!/bin/csh
while (1)
thepath/theprocess
end
run the above c-shell (background or foreground)
everytime the process dies the while loop starts
another.
However, if you want stop and start from within a perl
script, or keep track of process ids etc. That's another
matter all together.
-bob
Alan Strassberg wrote:
>
> I want to test if a process has died, and restart it if it has.
> A simple "ps ax | grep process" and restart if missing.
>
> The script below works, but what's a "better" method ?
>
> open (PROC, "ps -ax 2>&1 |") or die "cannot fork $!";
> while (<PROC>) { push(@ps,$_); }
> close(PROC);
> # @ps array built, see if squid's in there
> @sq = grep (/squid/,@ps);
> system ('/u1/squid/bin/squid &') if ! @sq;
>
> I've read perlfaq8 to no avail.
>
> alan
> --
> alan@wj.com
------------------------------
Date: Mon, 21 Jul 1997 08:33:41 -0400
From: Brandon Golm <brandon@mrgolm.com>
Subject: Question.
Message-Id: <33D35724.A440CA5@mrgolm.com>
To any who. I am currently working on a statistics program that tracks
large numbers of bandwitdh usage. I have a subroutine that converts
numbers to there proper bytes units, base on 2**10, 2**20,etcs but when
the number is over 2_000_000_000 which should be a gig it does not get
recognized, and converts it to a bytes ( which is the fail all in the if
else statments. I know there is a big int package so please don't tell
me to use that becuase I plan on it it seems to be what I need. My
question is what is the limits that perl can handle an integer? Is
there some limit that it won't recognized of 2 trillion??
Thanks in advance.
BTW: I have looked through all the books I have and comb the FAQ's and
DOC's. Please if someone know let me know. Reply on the news groups
though.
------------------------------
Date: Thu, 24 Jul 1997 07:53:14 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Mousheng Xu <mxu@eecs.ukans.edu>
Subject: Re: Question: MacPerl & "require"
Message-Id: <Pine.GSO.3.96.970724075245.13627M-100000@kelly.teleport.com>
On Wed, 23 Jul 1997, Mousheng Xu wrote:
> 'common.cgi' did not return a true value.
See what the perldiag manpage has to say about this message. 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/
------------------------------
Date: Mon, 21 Jul 1997 13:01:22 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: Marc Haber <s_haber@ira.uka.de>
Subject: Re: Re-Flowing ASCII Text
Message-Id: <33D34F8B.AF991595@adc.metrica.co.uk>
Marc Haber wrote:
> Hi!
>
> I would like to have a perl program that takes a text file and
> re-flows it to some other line width while preserving paragraphs.
> Before writing it myself, I'd like to ask if this special kind of
> wheel already has been invented.
>
> Any hints will be appreciated.
>
> Greetings
> Marc
>
> --
> -------------------------------------- !! No courtesy copies, please
> !! -----
> Marc Haber | " Questions are the |
> s_haber@ira.uka.de
> Karlsruhe, Germany | Beginning of Wisdom " | Fon: *49 721 966
> 32 15
> Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966
> 31 29
Have a look at the text proccessing modules at the CPAN, there might
be something there. Otherwise I am sure what you ask is more than
doable, so if you can't find what you need ask again and provide any
relevant details.
Simon
------------------------------
Date: 24 Jul 1997 13:23:52 GMT
From: burt@ici.net (Burt Lewis)
Subject: Reading from a text file?
Message-Id: <5r7l18$58o$1@bashir.ici.net>
Appreciate any help on this, can't seem to get:
I'm working with a simple text file like:
10:apples:pears:grapes
09:books:paper:envelopes
08:red:green:blue
I want to be able to:
1. read and change a specific line and field
2. delete a specific line
3. insert at specific lines
If anyone knows where I can find some simple examples of this, please let me
know.
Thanks!
Burt Lewis
burt@ici.net
------------------------------
Date: 24 Jul 1997 13:35:53 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Reading from a text file?
Message-Id: <5r7lnp$54e@fridge-nf0.shore.net>
Burt Lewis (burt@ici.net) wrote:
: I'm working with a simple text file like:
: 10:apples:pears:grapes
: 09:books:paper:envelopes
: 08:red:green:blue
[snip]
Given your format, you can do this yourself (what you're doing now),
or you can download Sprite.pm from a CPAN near you that does exactly
what you want without re-inventing the wheel. :-)
http://www.perl.com/CPAN/modules/by-module/Sprite/
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Wed, 23 Jul 1997 12:05:14 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: Scratchie <upsetter@zip1.ziplink.net>
Subject: Re: simple? question
Message-Id: <33D5E568.841C3D8B@adc.metrica.co.uk>
Scratchie wrote:
> Greetings all;
>
> My apologies if this is a FAQ, but I've been wrestling with various
> perl
> documentation for a couple of days now without being able to figure
> this
> out.
>
> My problem is that I'm trying to update my web site so it uses CGI.pm
> rather than cgi-lib. I'm trying to add a lot of new functionality and
> would rather do it "right" than extend my existing, kludgy scripts
> (that
> were written as I was learning perl 4, for the most part).
>
> Unfortunately, doing so requires learning
> * object oriented programming
> * the cgi.pm module specifically
> * the perl 5 syntax for objects and references
>
> all at the same time.
>
> So my question is:
>
> Why is it that sometimes I can write (for example) "print p;"
> and
> get a "<P>", but sometimes I need to write "print query->p;". OTOH,
> sometimes when I write the latter, I get an error message. What does
> it
> mean to write "print query->p" or "print query->h1(This is my
> heading)"
> when neither of these HTML elements seems to have any explicit
> connection
> to the actual data being sent to the cgi script?
>
> Is there some web tutorial somewhere that makes sense of this? The
> CGI.pm
> documentation assumes that you're familiar with using objects and
> methods,
> and sometimes uses "print p" (or whatever) and sometimes "print
> query->p".
> The documentation on objects assumes you're familiar with references,
> and
> vice versa, but I'm really new to all of this (I've been writing perl
> for
> over a year, but mostly sticking to perl 4 features) and I'm just
> swamped.
> There's probably some simple concept that I'm missing here, but I feel
>
> like I'm just chasing my tail, from the CGI.pm documentation, to the
> Camel
> book, to CPAN and back again.
>
> Thanks in advance,
>
> --Art
>
> -----
> --------------------------------------------------------------------
> National Ska & Reggae Calendar
> http://www.ziplink.net/~upsetter/ska/calendar.html
>
> -------------------------------------------------------------------------
This really is a cgi question but if you look in the documentation at
the section on 'Importing CGI Methods' your first question should
hopefully be answered.
Essentially if you import the standard methods when you 'use' CGI.pm
i.e.
use CGI qw(:standard);
Then you do not need the $query part.
I know this is not a complete answer to your problem but hopefully it's
a start.
Simon
------------------------------
Date: 24 Jul 1997 14:38:44 GMT
From: "Ryan" <rmcguigan@ramresearch.com>
Subject: socket help
Message-Id: <01bc9840$0c0e6490$6e6fa1cd@www>
Hi, I'm planning on writing a script that will search through all the files
in a website and check for broken links. All it will do is connect to the
server and try to retrieve each file. I've done this with telnet and I've
figured out basically how to do it, but the only problem I have is, I've
never done any socket programming in perl, and I cannot find any
documentation that explains how to do it. I have a perl book, but it
doesn't even mention socket programming. If it comes down to it, I can
write an external program to communicate with the servers, but I'd rather
not. Thanks for any help I get.
Ryan
RMcGuigan@RAMResearch.com
------------------------------
Date: 24 Jul 1997 08:47:55 -0500
From: jesten@earth.execpc.com (Jim Esten)
Subject: Re: Sprite Database
Message-Id: <5r7meb$8uo$1@earth.execpc.com>
: Hope this helps. Has anyone else used Sprite.pm to with any success?
: Faust Gertz
We've implemented it for an intranet bug report database
with pretty good success. It is a little fussy about blank
lines and the documented multiple changes don't seem to
work "as documented", but it is pretty simply to work with.
I'll package up what we use and send it along to anyone
interested...
Jim
------------------------------
Date: 21 Jul 1997 06:24:26 -0400
From: seth@fellspt.charm.net (Seth Perlman)
Subject: Use ODBM_File/NDBM_File...help
Message-Id: <5qvdcq$r57@fellspt.charm.net>
Can anyone get around the limits which I am finding to odbm/ndbm maps?
Using perl5.003 (use ODBM_File vs. use NDBM_File), running on a
Sun 5.5.1 Generic sun4u sparc SUNW,Ultra-1, I get the following
result when creating a DBM map from a file of 200000 uniq records like the
following:
210280 506235:210280::d999khdswSbfw::/export/home/210280:/bin/ksh
The dbm map never finishes(I had to kill the program).
Since it appears that the underlying code has already lseek'd to
a page which is the size of the filesystem, perhaps it hangs because it is
trying to get a page whose offset is larger than the filesystem size?
-rw-r--r-- 1 seth prog 2144826368 Jul 21 02:15 byuidodbm.pag
-rw-r--r-- 1 seth prog 218152960 Jul 21 02:15 byuidodbm.dir
When I read the above map and print out its contents, it only writes
around 10500 good records before it just repeats one particular line
ad infinitum.
Using NDBM_File I get the following error msg after it loaded 69595 lines:
ndbm store returned -1, errno 2, key "506217" at uidnew.pl line 34,
<PASSWD> chunk 69596.
-rwx------ 1 seth prog 2025 Jul 21 02:39 uidnew.pl
-rw-r--r-- 1 seth prog 669040640 Jul 21 02:40 byuidndbm.pag
-rw-r--r-- 1 seth prog 81920 Jul 21 02:40 byuidndbm.dir
Any insights into this? Is it possible to load a couple million rows
into dbm or ndbm maps...is there any way to get these modules to accept
this or do odbm and ndbm have builtin scalability limits?
I know this may be more of a unixy question than a perl question but my
request for help on several unix lists was a total bust.
Thanks...
Seth Perlman seth@charm.net (410)358-4355
--
Seth Perlman Unix/Sybase Consultaant
6000 Rusk Avenue
Baltimore, Md. 21209
(410) 358-4355 seth@charm.net
------------------------------
Date: Mon, 21 Jul 1997 16:58:37 +0200
From: Kjetil Palmquist <kjetilp@a.sn.no>
Subject: WEB discussion tool
Message-Id: <33D3791D.51CE@a.sn.no>
Where can I find tools for running web based discussion groups?
------------------------------
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 770
*************************************