[7904] in Perl-Users-Digest
Perl-Users Digest, Issue: 1529 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 23 15:07:18 1997
Date: Tue, 23 Dec 97 12: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, 23 Dec 1997 Volume: 8 Number: 1529
Today's topics:
BLAT wont work on NT 4 (CGI Form) marce@here-i.com
Re: book on perl <tchrist@mox.perl.com>
Date parsing <justinb@ebony.cray.com>
die() exit value different between 5.004 and 5.003? (Tad McClellan)
Re: embare-assed newbie Q ushere@ibm.net
Re: Error Compiling JPL Sample on IRIX <scotth@sgi.com>
Re: Fast Suggestions for this string manipulation probl (Michael Budash)
Re: File read/write efficiency <reibert@mystech.com>
Re: find2perl and GNUish find <merlyn@stonehenge.com>
Re: getting the pid from a system call rbell@osha-slc.gov
Re: HELP! using a while statement <henk@ripe.net>
Re: Highlight diff between documents <brianbaquiran@usa.net>
Re: Perl 5.004_04 on MP-RAS problems. (Steve Manning)
Re: Perl Dbase Access <ebohlman@netcom.com>
Re: Perl editor needed (Timothy Nicholson)
Re: Perl fails to update file under Peer Web Server... (Adam Turoff)
Re: sorting multi-dimensional array <rfeldman@sftek.com>
Re: Starting a Daemon in a CGI script <real@earthling.net>
Re: Starting a Daemon in a CGI script charlot@SPAM-FREE.org
Re: SVD(singular value decomposition) <reibert@mystech.com>
Re: Teaching programing <brianbaquiran@usa.net>
Re: Which language pays most 17457 -- C++ vs. Java? (Robert J. Kent)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 23 Dec 1997 10:21:23 -0600
From: marce@here-i.com
To: marce@here-i.com
Subject: BLAT wont work on NT 4 (CGI Form)
Message-Id: <882893826.1153171473@dejanews.com>
I have installed BLAT v1.5 on an WinNT Server, use IIS and my PERL works
just fine.
When I run the script from within the browser, I get a status code from
'system' of 512 --which I guess means 2 (divided by 256), and doesn't
deliver the message. When I run it directly from the NT Console (DOS
prompt) it works fine and delivers the message; the status code is 0.
I tried using an invalid path for BLAT.EXE or just using a nonsense name
to force a 'file not found' error code and got 256. So, definitively 512
is not a 'file not found error'. I suspect some permitions problems but
had no luck changing them. It's not supposed that the installation takes
care of any permissions or registry issues???
Any thoughts? Any suggestions?
I really appreciate your time. Thanks in advance.
-MARIO
Included script segment:
========================
$recipients = "user1\@domain.com";
$ccaddress = "";
$knownsender = "user2\@domain.com";
$fromsender = "";
$subject = "sending msg.txt";
$message = "msg.txt ";
$blatpath = "blat.exe ";
$server = "mail.domain.com";
$commandline = $blatpath;
$commandline .= $message;
$commandline .= "-s \"$subject\" " if $subject;
$commandline .= "-t \"$recipients\" " if $recipients;
$commandline .= "-f $fromsender " if $fromsender;
$commandline .= "-c $ccaddress " if $ccaddress;
$commandline .= "-server $server " if $server;
print "\$commandline \= $commandline";
print "<P>\n";
# Send mail using blat and the system command ############
system($commandline);
print "<P>\n";
print "Blat has been executed. Status $? <P>\n";
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 23 Dec 1997 15:56:52 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: book on perl
Message-Id: <67on04$8q7$1@csnews.cs.colorado.edu>
Keywords: from just another new york perl hacker
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, comdog@computerdog.com (brian d foy) writes:
:Larry Wall, Tom Christensen & Randal L. Schwartz
s/e/ia/
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
Emacs is a fine programming language, but I still prefer perl.
------------------------------
Date: 23 Dec 1997 11:10:03 -0600
From: Justin Banks <justinb@ebony.cray.com>
Subject: Date parsing
Message-Id: <o8nd8ioouj8.fsf@ebony.cray.com>
Hello -
Does one of the modules enable me to find the number of
business days between two dates? I've looked at Date::DateCalc,
and it doesn't appear to do what I want, but before I roll my own,
I figured I'd make sure someone else hadn't already done so
(apparently I possess at least one of the programmer's virtues).
-justinb
--
Justin Banks \ if the answer is the same whether you're programming
Silicon Graphics \ in Perl, C, or Visual Modula 17++ with JavaBeans and
Eagan, Minnesota \ Digital Satellite TV Support, it's not a Perl question.
------------------------------
Date: Tue, 23 Dec 1997 11:33:17 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: die() exit value different between 5.004 and 5.003?
Message-Id: <tkso76.j22.ln@localhost>
The exit value provided by die() is different under 5.004
than under 5.003 (I've tested it on both Linux (5.00401) and
Solaris (5.00404))
I tried more "instrumented" versions of the scripts where I put
the system() exit value into a variable ($ret = system('second'))
and examined $! (always zero, as expected) and whatnot, but got
no enlightenment.
I've looked in perldelta.pod and the Changes* files in the distribution,
didn't see anything related to this.
Am I missing something?
eg:
------------------------------
#!/bin/sh
# fail.sh
exit 1
------------------------------
#!/usr/bin/perl5.00401 -w
# second
system('fail.sh') &&
die "second: system('fail.sh') failed \$? = '$?'\n";
print STDERR "second: system('fail.sh') worked\n";
------------------------------
#!/usr/bin/perl5.00401 -w
# first
system('second') &&
die "first: system('second') failed \$? = '$?'\n\n";
print STDERR "first: system('second') worked\n\n";
------------------------------
#!/bin/sh
# test_driver
echo "using 5.00401 in both scripts:"
echo
first
perl -p -i -e 's/perl5.00401/perl5.003/' first second
echo "-----"
echo "using 5.003 in both:"
echo
first
# put them both back to 5.00401
perl -p -i -e 's/perl5.003/perl5.00401/' first second
------------------------------
I get this output from running 'test_driver':
using 5.00401 in both scripts:
second: system('fail.sh') failed $? = '256'
first: system('second') worked
-----
using 5.003 in both:
second: system('fail.sh') failed $? = '256'
first: system('second') failed $? = '256'
If this becomes a bug report, I'll include OS and perl -V info here.
Abbreviated ones for now:
perl5.003 -V
Summary of my perl5 (5.0 patchlevel 3 subversion 0) configuration:
perl5.00401 -V
Summary of my perl5 (5.0 patchlevel 4 subversion 1) configuration:
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 23 Dec 1997 11:55:22 -0500
From: ushere@ibm.net
To: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: embare-assed newbie Q
Message-Id: <349FECFA.13B8@ibm.net>
Eric Bohlman wrote:
>
> ushere@ibm.net wrote:
>
> You've already heard about what your separator problem is, but there's
> another bug that just hasn't hit you yet.
>
> : open PENCIL, "> $fid" || die "can't open $fid ... $! \n";
>
> If you really aren't able to open the file, this won't die. Either put
> parens around 'PENCIL, "> $fid"' or change the '||' to 'or'.
thank you very much... that one 'somehow' slipped right by me |:-)
-|- Who, has loved us more? -|-
------------------------------
Date: 23 Dec 1997 09:37:47 -0800
From: Scott Henry <scotth@sgi.com>
Subject: Re: Error Compiling JPL Sample on IRIX
Message-Id: <yd8ra74t0yc.fsf@hoshi.engr.sgi.com>
>>>>> "S" == Stephan Vladimir Bugaj <bugaj@bell-labs.com> writes:
S> Can't load '/usr/freeware/lib/perl5/site_perl/IP32-irix/auto/JNI/JNI.so'
S> for module JNI: 28106:perl: rld: Fatal Error: cannot successfully map
S> soname '/usr/freeware/lib/perl5/site_perl/IP32-irix/auto/JNI/JNI.so'
S> under any of the filenames
...
S> BEGIN failed--compilation aborted at Sample.pl line 3.
S> jpl stopped
S> ---
S> when trying to install the JPL under IRIX.
S> Has anyone successfully used the JPL on IRIX?
S> I had to edit the Makefile for the JNI by hand to use -n32 instead
S> of -32, and since there is no -R switch for IRIX cc and nothing in the
S> man page that seemed to be a proper substitute I had to take the two
S> -R switches out of Makefile.PL (I ran that, then hand-edited the
S> result), but the compile did not fail and it installed the library.
The version of Perl installed into /usr/freeware is compiled -32,
not -n32, except that it appears that you compiled your own, so I
hope you matched how you compiled Perl. Can't mix-n-match ABIs...
S> The lines the compile fails at above are the use statements in
S> Perl for importing the JNI(AutoLoader53), the AutoLoader(Class.pm2),
S> and JPL::Class(Sample.pl3), respectively, which makes sense.
Do a `which perl` to make sure that you are getting the correct one,
then run `file` on both the perl binary and the
existing-but-complaining .so. They must match, or RLD will refuse to
load it.
--
Scott Henry <scotth@sgi.com> / Help! My disclaimer is missing!
IRIX MTS, / GIGO *really* means: Garbage in, Gospel Out
Silicon Graphics, Inc / http://reality.sgi.com/scotth/
------------------------------
Date: Tue, 23 Dec 1997 10:43:56 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: Fast Suggestions for this string manipulation problem
Message-Id: <mbudash-2312971043560001@d154.pm4.sonic.net>
In article <wvp1zz4pa1e.fsf@edb.ejoper.dmi.min.dk>, Casper Kvan Clausen
<ckc@dmi.dk> wrote:
>> Yves Renoue <yrenoue@businessobjects.com> writes:
>>
>> > As you probably know the substitution $a =~ s/.*xxxx(.*)/something/ will
>> > get the last match of xxxx !
>>
>> So make it s/.*?xxxx(.*)/something $1/,
>> ^
>> using the non-greedy companion of *, *?.
>>
fyi: the space between "something" and "$1" introduces the space into the
final string...
--
Michael Budash, Owner * Michael Budash Consulting
mbudash@sonic.net * http://www.sonic.net/~mbudash
707-255-5371 * 707-258-7800 x7736
------------------------------
Date: Tue, 23 Dec 1997 08:28:22 -0700
From: "Mark S. Reibert" <reibert@mystech.com>
Subject: Re: File read/write efficiency
Message-Id: <349FD896.655F6605@mystech.com>
brian d foy wrote:
> it depends on what you are doing and what you think is efficient (use
> of memory, use of processor, and so on).
>
> sometimes the changes to be made to a file occur over more than one line,
> or depend on surrounding lines, so those need to be available when
> the changes are to be made - hence reading in large chunks of file.
>
> i would prefer line by line if i could get away with it. :)
In a multitasking OS with a more-or-less contiguous file, it is probably faster to read the entire file at
once due to disk I/O considerations (read/write latency, etc.). For example, if you are reading line-by-line
and another process moves the disk head(s) between your reads, your process will have to move them back for
your next read. This *may* be minimized if you read the entire file at once. Remember, disk I/O is still one
of the bottle necks of computer systems!
MSR
-----------------------------
Mark S. Reibert, Ph.D.
Mystech Associates, Inc.
3233 East Brookwood Court
Phoenix, Arizona 85044
Tel: (602) 732-3752
Fax: (602) 706-5120
E-mail: reibert@mystech.com
-----------------------------
------------------------------
Date: 23 Dec 1997 10:40:12 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: fishbowl@fotd.netcomi.com (J.L.M.)
Subject: Re: find2perl and GNUish find
Message-Id: <8chg80m003.fsf@gadget.cscaper.com>
>>>>> "J" == J L M <fishbowl@fotd.netcomi.com> writes:
J> $ find2perl /home -name WhatIWant -maxdepth 4 -mindepth 4
J> Unrecognized switch: -maxdepth
J> .... Why? Can I rebuild find2perl so that it can use the GNU find syntax?
J> Can you suggest a perlism that will help?
I don't have GNUfind around here (that I know of :-), but if -maxdepth
limits how deep you go, and -mindepth requires a minimum depth, you
can translate them as so:
find2perl /home -name WhatIWant -eval '
my $slashes = $File::Find::name =~ tr#/##;
return $File::Find::prune = 1 if $slashes > 4; # maxdepth
return if $slashes < 4; # mindepth
' ...
I might be off by one. You might want 3 instead of 4. As I said, I
don't know GNUfind.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 251 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 23 Dec 1997 19:23:05 GMT
From: rbell@osha-slc.gov
Subject: Re: getting the pid from a system call
Message-Id: <67p32p$58d$1@orthanc.reference.com>
I'm dealing with a similar problem. I need the PID of a background process started with either and exec or system call so I can kill the process from my application if needed. I've tried pipes and forks but I don't get the PID of the background process, just the child process that makes the exec/system call. From the command line when I start the background process I get the PID of the background process on the terminal. Standard Out <STDOUT>? How do I get that PID?
Any help would be appreciated.
Robert Bell
rbell@osha-slc.gov
--
Posted using Reference.COM http://www.reference.com
Browse, Search and Post Usenet and Mailing list Archive and Catalog.
Sift, Inc. accepts no responsibility for the content of this posting.
------------------------------
Date: Tue, 23 Dec 1997 16:26:05 +0100
From: Henk Uijterwaal <henk@ripe.net>
To: gossfam@wolfenet.com
Subject: Re: HELP! using a while statement
Message-Id: <349FD80D.7DE14518@ripe.net>
henry goss wrote:
> I am having trouble with the following code
> i am trying to get my program to loop more than once, but it wont loop a
> second time no matter what i do. If i change the "eq" to ==, it forces
> me too loop forever.
> what should i do to get this otherwise SIMPLE program to work? I have
> also tried changing the $yeah into a boolean value, but i am still
> having the same prob.
> Any help is greatly appreciated
> while ($yeah eq 'y') {
> print ("\nPlease enter a string>");
> $my_array[$count] = <STDIN>;
> $count++;
> print ("\n" . "Want to add another string(y or n)?>");
> $yeah = <STDIN>;
At this point, $yeah contains "y\n" (or "n\n"), thus ($yeah eq "y")
evaluates to false and you jump out of the loop. Simply remove the
newline from $yeah:
chop($yeah);
> print ("$yeah" . "\n"); #some debugging, tells me if i did anything
> to $yeah
You could have noticed this by carefully counting the number of newlines
after the "y". There were 2 new lines: the "\n" from the <STDIN> and
the one from the print statement:
Please enter a string>string1
Want to add another string(y or n)?>y
y
Please enter a string>
After adding the chop();, the program runs fine.
------------------------------------------------------------------------------
Henk Uijterwaal Email: henk.uijterwaal@ripe.net
RIPE Network Coordination Centre WWW: http://www.ripe.net/home/henk
Singel 258 Phone: +31.20.535-4414, Fax -4445
1016 AB Amsterdam Home: +31.20.6651962
The Netherlands Pager: +6.57626855
------------------------------------------------------------------------------
%DCL-E-NOCFFE, unable to locate coffee - keyboard input suspended.
------------------------------
Date: Tue, 23 Dec 1997 22:52:27 +0800
From: Brian Baquiran <brianbaquiran@usa.net>
To: Guo Jianyu <guojiany@iscs.nus.edu.sg>
Subject: Re: Highlight diff between documents
Message-Id: <349FD02B.13ECC0AD@usa.net>
Guo Jianyu wrote:
> I'm just wondering if there's any software that can compare two
> documents(e.g HTML files) and highlight the differences. If there is,
> where can I find it? Can anyone enlighten me? Thanks a lot.
I'm sure you can do it in perl, but there's an easier solution.
It's called diff and it should be available on almost all un*x systems.
RTFM.
Brian
------------------------------
Date: Tue, 23 Dec 1997 16:09:21 GMT
From: manning@execpc.com (Steve Manning)
Subject: Re: Perl 5.004_04 on MP-RAS problems.
Message-Id: <67onmi$dl@newsops.execpc.com>
wescott@cygnus.ColumbiaSC.NCR.COM (Mike Wescott) wrote:
>In article <slrn69tnan.3nl.laughman@soccer.cis.ohio-state.edu> laughman@wutang.acs.ohio-state.edu (jason m. laughman) writes:
>The simplest solution is to pick up the perl5.004_04.pkg.gz from ncrinfo.ncr.com
>and install that. Or, if you really want to build it yourself get the source
>from the same place and at least use the config.sh file to start with. The
>supplied source includes one fix to enable the DB_File extension.
Mike,
Could you post the DB_File patch?
Thanks.
BTW, here is a patch that fixes the select() mis-config:
----cut here----
*** perl5.004_04/hints/svr4.sh.orig Thu Jul 31 13:44:33 1997
--- perl5.004_04/hints/svr4.sh Fri Dec 5 12:40:14 1997
***************
*** 27,32 ****
--- 27,35 ----
d_suidsafe='define' # "./Configure -d" can't figure this out
easilly
usevfork='false'
+ # fix select() mis-configure
+ d_select='define'
+
# Configure may fail to find lstat() since it's a static/inline
# function in <sys/stat.h> on Unisys U6000 SVR4, and possibly
# other SVR4 derivatives.
----cut here----
Steve Manning
System Administrator
Mega Marts Inc.
Milwaukee, WI USA
manning@execpc.com
------------------------------
Date: Tue, 23 Dec 1997 16:30:49 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Perl Dbase Access
Message-Id: <ebohlmanELnHvE.H4v@netcom.com>
Steve <mrlock@flash.net> wrote:
: Is there a Dbase access Module for Perl 5.x?
Yep, more than one, although they all go by the name "xbase" (since
products other than Dbase use the file format). Take a look over on CPAN.
------------------------------
Date: Tue, 23 Dec 1997 18:55:05 GMT
From: timn@nospam-renewal-iis.com (Timothy Nicholson)
Subject: Re: Perl editor needed
Message-Id: <34a0089f.23574117@news.kivex.com>
On 22 Dec 1997 20:01:07 GMT, scott@softbase.com wrote:
Why wait for Multi-Edit when SlickEdit already has Perl syntax
support? Color coding, syntax expansion, matching parenthesis/curly
brace. Great editor! It even has Emacs support (although I can't
imagine anyone wanting to use it once familiar with the CUA interface
- ok, hit me with the flames now!).
>Perl editors under Windows ...
>
>Multi-edit, which is coming out with a new 8.0 native Win32 version Any
>Week Now (it's been in beta forever), is a good commercial editor with
>lots of functions and syntax highlighting. It has Perl support.
>It follows standard Windows conventions. It's not too expensive,
>under $100, and the Win32 version (8.0) would be a good investment
>since it should be usable for the next 5-10 years.
>
>PFE, the Programmer's File Editor, is similar to Multi-edit without
>the syntax highlighting. It is a free program, which makes it
>nice.
>
>Emacs is the best all around editor for programming. Its drawback is
>you have to learn how to use it, which puts off a lot of people who
>don't want to bother with this kind of thing. Learning Emacs is a good
>investment in your programming career, though, since it is available on
>most platforms and has an unmatched degree of advanced editing.
>
>For people who are used to Developer Studio, check out the Dec 1997
>Windows Developer's Journal, which has an article (by me) on developing
>Perl apps in DevStudio. It can be done.
>
>For more info, look around my web site. I have a large section of
>the Windows 95 Book FAQ dedicated to editors and books about them.
>
>Note: Even if you use Emacs, it has pitiful printer support in
>Windows, so PFE or Multi-edit is nice to have for printing.
>
>Scott
>--
>Look at Softbase Systems' client/server tools, www.softbase.com
>Check out the Essential 97 package for Windows 95 www.skwc.com/essent
>All my other cool web pages are available from that site too!
>My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more.
------------------------------
Date: 23 Dec 1997 12:28:08 -0500
From: ziggy@panix.com (Adam Turoff)
Subject: Re: Perl fails to update file under Peer Web Server...
Message-Id: <67osb8$g8p@panix.com>
In article <349E8A95.B75CD336@texas.net>,
Moises G. Solis <moises@texas.net> wrote:
>I'm hoping someone else has solved this problem.
>I'm trying to update a flat file. My Perl script
>works fine while run in a shell. It fails when I
>run it under NT and Peer Web Server.
If it works fine in the shell, it's not a Perl problem. It's either
a programmer error or a server (programmer) error.
>The directory permissions have been set to read,
>write, and delete. The directory has been set to
>read permissions in Peer Web Services under the
>directory tab.
>
>Basically, can I append to a flat file under CGI
>or is this not allowed?
>
>Thanks in advance. This problem has been
>bothering me for four days.
Consult the docs that come with your webserver.
Oh, wait, you're using a server which comes with no documentation!
#include <std_ms_flame.h>
The problem is with your server. You're probably not executing the
script from where you think you are, so you should use an absolute
pathname.
Even better, write a better perl script using File::Basename.
HTH,
-- Adam.
------------------------------
Date: Tue, 23 Dec 1997 09:28:43 -0800
From: Ron Feldman <rfeldman@sftek.com>
To: Bennett Todd <bet@network.rahul.net>
Subject: Re: sorting multi-dimensional array
Message-Id: <349FF4CB.723B1BE@sftek.com>
Thanks very much, Bennett! This worked very well for me.
The country names are not unique, but the country codes are (these are
international telephone country codes).
After listing out the sorted country names in an html <select> tag using
the index as the value, I simply looked up $sorted[index][2] to get the
rate values I needed.
Thanks again,
..Ron
Bennett Todd wrote:
> I'd tend to start off organizing that as an array of arrays. Suppose
> you had a
> text file that looks like the above; you could scan it into such an
> array with
> something like
>
> use IO::File;
> my(@data);
> my($fi) = IO::File->new("input_file.txt");
> $fi->getline(); # toss the headers
> while ($_ = $fi->getline()) {
> chomp;
> push @data, [split];
> }
>
> So now $data[0] is a reference to an array containing the first
> record,
> $data[0][0] is 25, $data[0][1] is "turkey", $data[1][1] is "bahamas",
> and so
> on.
>
> >I need to sort by the second field for readability, [...]
>
> my(@sorted) = sort { $a->[1] cmp $b->[1] } @data;
------------------------------
Date: 23 Dec 1997 16:27:18 GMT
From: "Real" <real@earthling.net>
Subject: Re: Starting a Daemon in a CGI script
Message-Id: <01bd0fbf$931c0860$822c57c0@pc0130.pica.nl>
For me, it's just the other way around. If I'm using exec, the script never
comes back. To answer you question; Yes, "system()" is a good way to start
another process BUT it depends on your environment. I'm using Perl-5 on a
Dec-Unix v3.2 system.
Here's my test-script. It might run different on your system (use -e to
choose between "exec()" and -otherwise- "system()"). The PerlDaemon script
might by anything - a shell-script containing a sleep would be enough.
#!/usr/bin/perl
sub ProcessRunning {
local($Status) = 0;
chomp(@AllPrcs = qx!ps -A -opid=,command=!);
foreach (@AllPrcs) { /$_[0]/ && do { $Status = 1; }; }
return $Status;
}
if (! &ProcessRunning("PerlDaemon")) {
print "Start PerlDaemon process ...\n";
if ($ARGV[0] eq "-e")
{ exec("PerlDaemon &"); print "(using exec) "; }
else { system("PerlDaemon &"); print "(using system) "; }
if (&ProcessRunning("PerlDaemon"))
{ print "Process successfully started\n"; }
else { print "Process NOT running !\n"; }
}
else {
print STDERR "$0: process PerlDaemon was already running - not
started.\n";
}
Cheers,
Real.
maverner@hotmail.com wrote in article
<882838582.1860698115@dejanews.com>...
> Hi,
>
> I have a perl script in my cgi-bin file which is supposed to start a
> daemon and then return a simple message.
>
> My script is essentially:
>
> if (!daemonRunning)
> {
> system("runDaemon.pl &");
> }
> print htmlHeader();
> print "I'm back";
> return 1;
>
> The problem is my perl script never comes back from starting runDaemon.pl
> The daemon does get started and the next time I run the script, it
returns
> a nice html page since the daemon is already running.
>
> Is the "system" command the right way to launch a job asynchronously?
> The Camel book seems to suggest this should work as far as I can tell.
>
> My server is running NetBSD 1.2.
>
> Thanks for any help.
>
> Matt
>
> -------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
>
------------------------------
Date: 23 Dec 1997 11:55:16 -0500
From: charlot@SPAM-FREE.org
Subject: Re: Starting a Daemon in a CGI script
Message-Id: <67oqdk$it@stratus.CAM.ORG>
In article <01bd0fbf$931c0860$822c57c0@pc0130.pica.nl>,
Real <real@earthling.net> wrote:
>For me, it's just the other way around. If I'm using exec, the script never
>comes back.
>
That's the documented behaviour. "exec" _replaces_ the invoking process with
the one given in argument. That's why it's often preceded by "fork" to create
a new process first.
Richard.
--
Richard Bellavance -- charlot(at)cam(dot)org -- http://www.cam.org/~charlot/
"All along this path I tread / My heart betrays my weary head
With nothing but my love to save / From the cradle to the grave"
(Eric Clapton, "From the cradle")
------------------------------
Date: Tue, 23 Dec 1997 08:44:53 -0700
From: "Mark S. Reibert" <reibert@mystech.com>
Subject: Re: SVD(singular value decomposition)
Message-Id: <349FDC75.C4F25E35@mystech.com>
Yoon, SahngHo wrote:
> I am looking for a perl program which does singular value
> decomposition).
>
> Thanks in advance.
>
> Yoon, Sahngho
> Shinsegi Telecom.
Are you sure you want to go there via Perl? SVD is a nontrivial algorithm
that is generally efficient for small matrices, but can easily become
computationally intense for moderate to large size matrices. I suggest
using C for this app, then calling your C routine from Perl. As a side
bonus, "standard" SVD routines written in C can be found in the literature.
I suggest looking at the book "Numerical Recipes in C" (second edition is
still current, I believe).
If you can't find what you need, I shall be happy to provide you with my
SVD routines in C (which are based on the NRC text mentioned above). I have
routines for computing the SVD, as well as a SVD-based, general-purpose,
linear least-squares curve fit algorithm (which, as one of the prominent
uses of SVD, may satisfy your true need!).
If you wish to pursue this further, let's take it out of the news group.
Feel free to contact me at "reibert@asu.edu". (I know this doesn't match my
signature, but for this topic I'd rather take it up via the academic world
where nobody cares if things are given away!)
MSR
-----------------------------
Mark S. Reibert, Ph.D.
Mystech Associates, Inc.
3233 East Brookwood Court
Phoenix, Arizona 85044
Tel: (602) 732-3752
Fax: (602) 706-5120
E-mail: reibert@mystech.com
-----------------------------
------------------------------
Date: Tue, 23 Dec 1997 22:43:05 +0800
From: Brian Baquiran <brianbaquiran@usa.net>
To: Oliver Much <uzs7ci@ibm.rhrz.uni-bonn.de>
Subject: Re: Teaching programing
Message-Id: <349FCDF9.E76F7FDC@usa.net>
Oliver Much wrote:
>
> Janos Blazi <jblazi@wuerzburg.netsurf.de> wrote:
>
> JB>I have to teach programing to 15-years old pupils. Is PERL a good language
> JB>to start with? Our "authorities" seem to prefer PASCAL, but PASCAL seems to
> JB>be absolutely dead and the first steps in PERL are perhaps easier than the
> JB>first steps in C. Or should I take BASIC (oh horror!)?
It would have to depend on what you want to emphasize. The
traditional structured languages like Lisp and Pascal are plenty
powerful
and good for teaching them important concepts (i.e. recursion) and how
to think like a programmer. Object oriented stuff (Smalltalk, Eiffel)
can come later. Perl is a great language for just getting things done.
It's a great second or third language.
I would postpone C/C++ for when they actually need the low-level access.
They are probably the most useful in real life programming.
> You shouldn't use perl for the first steps in programming as it is not that
> 'talky' as PASCAL or BASIC. Perl programs look a little weird for someone
> who has never seen C.
They look weird for C programmers too. Perl is weird, and that's a fact.
Brian
>
> --
> ---
> Oliver Much|@home: UZS7CI@ibm.rhrz.uni-bonn.de | Sei P ein Punkt Q wir
> |@work: oliverm@addi.finasto.uni-bonn.de| wollen ihn Z nennen.
------------------------------
Date: 23 Dec 1997 14:12:38 -0500
From: k96rk01@cc.kzoo.edu (Robert J. Kent)
Subject: Re: Which language pays most 17457 -- C++ vs. Java?
Message-Id: <67p2f6$fgr$1@henson.cc.kzoo.edu>
In article <0nv476.vh4.ln@localhost>, Tad McClellan <tadmc@metronet.com> wrote:
>: While he's probably joking, let me be the first to point out that knowing
>: *any* second or third natural language will help you program effectively.
>
>Yeah.
>
>I think I have heard of some guy with linguistic experience creating
>some programming language or other (note followups).
i have, too. they call him... um... larry wall, or something. now maybe we
can stop cross-posting this to comp.lang.java.* ??
--
___________________________________________________________________________
rob kent | k96rk01 @ kzoo.edu | http://cc.kzoo.edu/~k96rk01/
------------------------------
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 1529
**************************************