[25442] in Perl-Users-Digest
Perl-Users Digest, Issue: 7687 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 24 21:05:37 2005
Date: Mon, 24 Jan 2005 18:05:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 24 Jan 2005 Volume: 10 Number: 7687
Today's topics:
Re: [perl-python] 20050124 classes & objects <matternc@comcast.net>
Re: [perl-python] 20050124 classes & objects <g.tagliarettiNO@SPAMparafernalia.org>
C struct equivalent <mfag@online.no>
Re: C struct equivalent xhoster@gmail.com
Re: C struct equivalent <tadmc@augustmail.com>
Re: C struct equivalent <matternc@comcast.net>
Re: C struct equivalent <mfag@online.no>
Re: counting perl src when have nested requires? (Anno Siegel)
Re: Email fate on server down ? (Peter Scott)
Re: Email fate on server down ? <tadmc@augustmail.com>
Re: File::Find gives me current dir (.)? <ben.rogers@gmail.com>
Re: globs, ref globs, and lexically scoped filehandles (Anno Siegel)
Re: How to include some files in the same project? francescomoi@europe.com
mysql results split on a number of pages asdfkajsdflkjsadlfkjoewqifoeiwjf@yahoo.com
Re: mysql results split on a number of pages <news@chaos-net.de>
Re: mysql results split on a number of pages xhoster@gmail.com
Re: Perl on Windows <matthew.garrish@sympatico.ca>
Re: Print question <joe@inwap.com>
Printing After A While Loop <blabla@hotmail.com>
Re: Printing After A While Loop <emschwar@pobox.com>
Re: Question? Alternative to loading modules!!! <cwilbur@mithril.chromatico.net>
Re: Question? Alternative to loading modules!!! xhoster@gmail.com
Re: Regex problem (Anno Siegel)
spawn and monitor multiple processes - report back when bayxarea-usenet@yahoo.com
Re: spawn and monitor multiple processes - report back <1usa@llenroc.ude.invalid>
Re: spawn and monitor multiple processes - report back (Anno Siegel)
trying to "use Sys::Syslog" but I get nothing ... <karen.wieprecht@jhuapl.edu>
Re: trying to "use Sys::Syslog" but I get nothing ... (Anno Siegel)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 24 Jan 2005 11:24:37 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: [perl-python] 20050124 classes & objects
Message-Id: <XcGdnUjww-TYvGjcRVn-iQ@comcast.com>
Xah Lee wrote:
> Perl does not support classes or
> objects in the so-called "Object
> Oriented" programing.
Boy, the ignorance never stops, does it?
> However, a
> complete set of emulations of OO
> style of programing have been done,
> resulting in modules and books and
> many documentations and tutorials.
>
It doesn't have OO, but it emulates in software!
Better go with python, which has hardware OO. :-)
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: Mon, 24 Jan 2005 19:45:32 +0100
From: Gian Mario Tagliaretti <g.tagliarettiNO@SPAMparafernalia.org>
Subject: Re: [perl-python] 20050124 classes & objects
Message-Id: <35kmq1F4natj7U1@individual.net>
Chris Mattern wrote:
>
> It doesn't have OO, but it emulates in software!
> Better go with python, which has hardware OO. :-)
Chris don't feed the troll
------------------------------
Date: Tue, 25 Jan 2005 00:06:28 +0100
From: "Martin Johansen" <mfag@online.no>
Subject: C struct equivalent
Message-Id: <ZbfJd.5887$IW4.121995@news2.e.nsc.no>
Hello
I need to use structure like:
struct{
int x;
array *a;
int z;
}s;
Can I access some structure in perl using e.g. s.a or similar
Thanks.
------------------------------
Date: 24 Jan 2005 23:11:16 GMT
From: xhoster@gmail.com
Subject: Re: C struct equivalent
Message-Id: <20050124181116.884$Q3@newsreader.com>
"Martin Johansen" <mfag@online.no> wrote:
> Hello
>
> I need to use structure like:
>
> struct{
> int x;
> array *a;
> int z;
> }s;
>
> Can I access some structure in perl using e.g. s.a or similar
perldoc -q struct
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Mon, 24 Jan 2005 18:03:46 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: C struct equivalent
Message-Id: <slrncvb372.2ap.tadmc@magna.augustmail.com>
Martin Johansen <mfag@online.no> wrote:
> Subject: C struct equivalent
perldoc -q struct
How can I make the Perl equivalent of a C structure/C++ class/hash or
array of hashes or arrays?
How do I declare/create a structure?
You are expected to check the Perl FAQ *before* posting to
the Perl newsgroup.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 24 Jan 2005 19:26:38 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: C struct equivalent
Message-Id: <kPadnd9mo6OiD2jcRVn-jQ@comcast.com>
Martin Johansen wrote:
> Hello
>
> I need to use structure like:
>
> struct{
> int x;
> array *a;
> int z;
> }s;
>
> Can I access some structure in perl using e.g. s.a or similar
>
> Thanks.
Normal way to do this is with a hash:
my %s = (
x => 0,
a => [],
z => 0
);
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: Tue, 25 Jan 2005 01:38:15 +0100
From: "Martin Johansen" <mfag@online.no>
Subject: Re: C struct equivalent
Message-Id: <1ygJd.5894$IW4.120994@news2.e.nsc.no>
Thanks
That solved the problem.
------------------------------
Date: 24 Jan 2005 17:18:15 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: counting perl src when have nested requires?
Message-Id: <ct3akn$e7i$1@mamenchi.zrz.TU-Berlin.DE>
Brian McCauley <nobull@mail.com> wrote in comp.lang.perl.misc:
> Anno Siegel wrote:
>
> > Sherm Pendley <spamtrap@dot-app.org> wrote in comp.lang.perl.misc:
> >
> >>
> >>So, in the simplest case, it could be as simple as this:
> >>
> >> system("wc -l " . join(' ', values(%INC)));
> >
> >
> > A solid approach, but it will report all modules loaded anywhere in the
> > program (up to the point where %INC is evaluated). The OP seems to be
> > interested in the modules loaded directly or indirectly by one specific
> > "use" statement.
> >
> > To make it selective that way (and to add a little magic) I propose
> > this:
> >
> > END {
> > my @report_these; # collect modules to report
> > sub report_loading {
> > push @report_these, $_[ 1];
> > return; # undef, so search continues
> > }
> > # Line counting left as an exercise
> > print "$_ => $INC{ $_}\n" for @report_these;
> > }
> >
> > use Some::Stuff;
> >
> > use lib \ &report_loading;
> > use Nested::Module;
> > no lib \ &report_loading;
>
> Er, why not simply compare %INC before and after?
Good idea, now you mention it :)
It's conceptually simpler than making use of the obscure behavior of
coderefs on @INC. It may take a little more code to implement.
Anno
------------------------------
Date: Mon, 24 Jan 2005 16:54:58 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: Email fate on server down ?
Message-Id: <CL9Jd.159380$6l.2090@pd7tw2no>
In article <1106533648.716533.151890@c13g2000cwb.googlegroups.com>,
"siliconmike" <siliconmike@yahoo.com> writes:
>(Apologies to post this question which is really not relevant to perl.
>Unfortunately I searched through google groups but could not find a
>relevant active group for this post.)]
I went to groups.google.com, typed in 'mail', and the first thing it said was
that there were 770+ groups related to 'mail'. Clicking on that number gave
a list ordered by topic, with 50 under 'Computers'. Clicking on that gave a
list of groups with descriptions, the 5th one being:
comp.mail.misc
Group description: General discussions about computer mail.
Category: Computers
Usenet, public
--
Peter Scott
http://www.perldebugged.com/
*** NEW *** http://www.perlmedic.com/
------------------------------
Date: Mon, 24 Jan 2005 17:05:50 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Email fate on server down ?
Message-Id: <slrncvavqe.273.tadmc@magna.augustmail.com>
Peter Scott <peter@PSDT.com> wrote:
> In article <1106533648.716533.151890@c13g2000cwb.googlegroups.com>,
> "siliconmike" <siliconmike@yahoo.com> writes:
>>(Apologies to post this question which is really not relevant to perl.
>>Unfortunately I searched through google groups but could not find a
>>relevant active group for this post.)]
>
> I went to groups.google.com, typed in 'mail', and the first thing it said was
> that there were 770+ groups related to 'mail'. Clicking on that number gave
> a list ordered by topic, with 50 under 'Computers'. Clicking on that gave a
> list of groups with descriptions,
I did that too.
Then I made a scorefile entry. :-(
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 24 Jan 2005 17:12:31 -0800
From: "ben.rogers@gmail.com" <ben.rogers@gmail.com>
Subject: Re: File::Find gives me current dir (.)?
Message-Id: <1106615551.223912.67830@f14g2000cwb.googlegroups.com>
I made a mistake in my original post and Tad managed to get through the
garbage to figure it out. Yes, I am writing a program-writing program.
The code example was originally in a HERE block and I did a poor job of
making it working code (instead of code-writing code) before asking for
help.
Anyway, it took the ($recursive) suggestion and switched to glob to
simplify non-recursive searching. I now have this (it works):
#!C:\\Perl -w
use File::Find;
$recursive = 0;
if ($recursive){
find (\&wanted, "C:/Adobe/mifaliscious/b4");
sub wanted(){
if ($File::Find::name =~ /(.fm)$/i && -f){
print STDOUT "FOUND: $File::Find::name\n";
push @files, $File::Find::name;
}
}
} else {
chdir "C:/Adobe/mifaliscious/b4";
@files = glob "*.fm";
foreach (@files) {print STDOUT "FOUND: $_\n";}
}
I can't see how to make it simpler or more elegant, but if there is a
way please let me know. Your responses made me analyze things more
carefully and I appreciate the help. Hope I got it right! works anyway.
b
------------------------------
Date: 24 Jan 2005 23:02:37 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: globs, ref globs, and lexically scoped filehandles
Message-Id: <ct3uqd$p6f$1@mamenchi.zrz.TU-Berlin.DE>
Alex Hart <alex_the_hart@yahoo.com> wrote in comp.lang.perl.misc:
> 2 questions, but somewhat related.
>
> What is the rule for when it's possible to use a glob, and when it's
> possible to use a ref glob.
The term is "globref", meaning a reference to a glob. "ref glob" doesn't
make sense.
> Can they always be used interchangably? The
> docs seem a little vague on this. Is this a property of the glob, or of
> the function being called?
No, they're not always interchangeable. For one, a globref could be blessed
into any class, and then the class determines its behavior.
Otherwise, the automatic de-referencing of globrefs happens where it is
convenient -- it's a function of the DWIM behavior of Perl. In fact,
even the interpretation of a bare glob as a file handle is a DWIM action.
It might as well be interpreted as something else, or not at all. Since
there is little use for globs in modern Perl, I/O functions take it for
granted that you mean the I/O slot.
> Also, concerning lexically scoped filehandles (which is really a ref
> glob, right?), can these be used anywhere a filehandle would be used
> (i.e. will they be auto-vivicated anywhere a file handle is expected?).
> I always see the example with open, but what about sysopen, or accept,
> or bind, or anything else. Can I always use a undefined scalar in these
> functions?
There is no such thing as lexically scoped filehandles. A lexical variable
can hold a *value* that is interpreted as a filehandle by I/O functions.
This doesn't give the variable special properties of a filehandle, nor
does it make the underlying filehandle "lexical".
As for autovivifivation, I'd expect all methods to open a file handle to
do it. The feature is indeed not described for "sysopen" the way it is for
"open".
Anno
------------------------------
Date: 24 Jan 2005 09:13:46 -0800
From: francescomoi@europe.com
Subject: Re: How to include some files in the same project?
Message-Id: <1106586826.623068.271080@f14g2000cwb.googlegroups.com>
Thank you very much!!!
------------------------------
Date: 24 Jan 2005 16:19:01 -0800
From: asdfkajsdflkjsadlfkjoewqifoeiwjf@yahoo.com
Subject: mysql results split on a number of pages
Message-Id: <1106612341.195076.243470@c13g2000cwb.googlegroups.com>
Hi
Does anyone have a swift solution on splitting up mysql results on a
number of pages given the results for the query exceeds a specific
number?
Example query: my $sth=$dbh->prepare("select CITY from MYDB where
COUNTRY='GB' desc");
If above would return more than X results I only display X with an
offset for page number (eg regukar search results solution).
Ive managed to do dodgy solutions where I first go through all results
to check total number, push them into an array and play with them.
Surely there must be a more efficient and server friendly way..
Thanks !
M
------------------------------
Date: 25 Jan 2005 00:41:34 GMT
From: Martin Kissner <news@chaos-net.de>
Subject: Re: mysql results split on a number of pages
Message-Id: <slrncvb5dt.ku6.news@maki.homeunix.net>
asdfkajsdflkjsadlfkjoewqifoeiwjf@yahoo.com wrote :
> Hi
>
> Does anyone have a swift solution on splitting up mysql results on a
> number of pages given the results for the query exceeds a specific
> number?
>
> Example query: my $sth=$dbh->prepare("select CITY from MYDB where
> COUNTRY='GB' desc");
>
> If above would return more than X results I only display X with an
> offset for page number (eg regukar search results solution).
>
> Ive managed to do dodgy solutions where I first go through all results
> to check total number, push them into an array and play with them.
> Surely there must be a more efficient and server friendly way..
I guess this is more a mysql related question.
Nevertheless I'll try give you what I can.
my ($start, $step) = (0, 5);
my $sth=$dbh->prepare("select CITY from MYDB where COUNTRY='GB' desc
LIMIT $start, $step");
Now you can play with $start (number of first record beeing displayed) and
$step (number of records beeing displayed) in you script.
You could for example produce links on the result page like this:
[ next 5 >> ]
or
[ 6-10 ] [ 11 - 15 ] [ 16 - 20] and so on.
HTH
Martin
--
Epur Si Muove (Gallileo Gallilei)
------------------------------
Date: 25 Jan 2005 01:09:32 GMT
From: xhoster@gmail.com
Subject: Re: mysql results split on a number of pages
Message-Id: <20050124200932.401$w5@newsreader.com>
asdfkajsdflkjsadlfkjoewqifoeiwjf@yahoo.com wrote:
> Hi
>
> Does anyone have a swift solution on splitting up mysql results on a
> number of pages given the results for the query exceeds a specific
> number?
Well, if you want a mysql solution, lookup the Mysql keyword "limit".
Be warned that this is method does not preserve integrity.
If you want a Perl solution, you will need to tell us more about the Perl
environment you are working in.
>
> Example query: my $sth=$dbh->prepare("select CITY from MYDB where
> COUNTRY='GB' desc");
>
> If above would return more than X results I only display X with an
> offset for page number (eg regukar search results solution).
>
> Ive managed to do dodgy solutions where I first go through all results
> to check total number, push them into an array and play with them.
> Surely there must be a more efficient and server friendly way..
What do you find unefficient or server-hostile about doing it that way?
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Mon, 24 Jan 2005 19:16:29 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Perl on Windows
Message-Id: <qdgJd.79$mA5.62343@news20.bellglobal.com>
"JRBTech" <jrbtech-at@gmail.com> wrote in message
news:W-WdnUkXep_KyG_cRVn-pQ@adelphia.com...
>
> Active Perl isnt free.
>
Really? Care to elaborate?
Matt
------------------------------
Date: Mon, 24 Jan 2005 12:30:15 -0800
From: Joe Smith <joe@inwap.com>
Subject: Re: Print question
Message-Id: <zYWdnX69M6JHx2jcRVn-tA@comcast.com>
edgrsprj wrote:
> It has been my experience that if you want to have an Internet server
> computer run a (CGI) program for you at a Web site you need to prepare your
> code using one of the languages that they will accept.
Correct.
> Different servers have different lists of languages which they allow to be used.
Correct.
> If I understand this correctly, the Perl "Scripting Language" is almost
> universally accepted.
Incorrect. The phrase "Perl scripting language" is fairly meaningless.
If you're talking about PHP you should say so. Anyway, some of the
more commonly supported webserver extensions are plain Perl, mod_perl
and mod_php. (The latter is _not_ Perl.)
> And it is to some extent different than the Perl PC language
> which is discussed in this Newsgroup.
You need to do some more research. There is the Perl language,
not the "Perl PC" language. What you call "perl scripting language"
is probably not what you think it is; you need to get more details.
-Joe
------------------------------
Date: Mon, 24 Jan 2005 19:11:39 -0500
From: Bla <blabla@hotmail.com>
Subject: Printing After A While Loop
Message-Id: <pf3bv0d50409oql4fd90tibtnj7v4ikvst@4ax.com>
Trying to print to a file after a while loop.....
while {
test
}
do this
can I put an else in here if the above is not true????
------------------------------
Date: Mon, 24 Jan 2005 17:35:34 -0700
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: Printing After A While Loop
Message-Id: <eto651mjqg9.fsf@wilson.emschwar>
Bla <blabla@hotmail.com> writes:
> Trying to print to a file after a while loop.....
>
>
> while {
> test
> }
>
> do this
>
> can I put an else in here if the above is not true????
I quoted you fully only because I cannot for the life of me figure out
what, in fact, you are trying to do. A while loop doesn't look like
that, it looks like this:
while (some_test()) {
do_something();
}
Can you please try this question again, with actual Perl?
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
------------------------------
Date: Mon, 24 Jan 2005 16:39:26 GMT
From: Charlton Wilbur <cwilbur@mithril.chromatico.net>
Subject: Re: Question? Alternative to loading modules!!!
Message-Id: <87ekga234g.fsf@mithril.chromatico.net>
>>>>> "xho" == xhoster <xhoster@gmail.com> writes:
xho> Charlton Wilbur <cwilbur@mithril.chromatico.net> wrote:
EB> So it's not really a tough sales job *if* you're making the
EB> sale to someone sufficiently high up in the client, but in
EB> many cases you don't have access to someone that high up.
>> If you aren't making the pitch directly to someone who can say
>> yes or no without consulting his boss -- and thus having to
>> pitch it to him second-hand -- you're wasting your time.
>> (Another basic principple of technical sales.)
xho> What if you are making a pitch to someone who can say "no"
xho> without consulting the boss, but can't say "yes" without
xho> consulting the boss?
xho> From where I sit, it seems like that is the most common
xho> scenario.
Then you should be pitching it to his boss.
The basic principle is that you don't want the real decisionmaker to
have to hear your pitch second- or third-hand. You want to pitch
directly to the person who can say yes. If you're trying to sell to
people who don't have the power to say yes, then the best they can do
is relay the pitch, and they won't have the same knowledge of what
you're offering as you do, let alone the same flexibility in
negotiation on rates and schedule that you can offer if you're there
in person.
This really sucks when the person who is the real decisionmaker is a
pointy-haired boss type who doesn't know Perl from Peru, but even then
you're still better off talking directly to him because you can
impress him with your conviction and charm rather than your technical
knowledge.
Charlton
--
cwilbur at chromatico dot net
cwilbur at mac dot com
------------------------------
Date: 24 Jan 2005 17:38:39 GMT
From: xhoster@gmail.com
Subject: Re: Question? Alternative to loading modules!!!
Message-Id: <20050124123839.165$tz@newsreader.com>
Charlton Wilbur <cwilbur@mithril.chromatico.net> wrote:
> xho> What if you are making a pitch to someone who can say "no"
> xho> without consulting the boss, but can't say "yes" without
> xho> consulting the boss?
>
> xho> From where I sit, it seems like that is the most common
> xho> scenario.
>
> Then you should be pitching it to his boss.
>
> The basic principle is that you don't want the real decisionmaker to
> have to hear your pitch second- or third-hand. You want to pitch
> directly to the person who can say yes. If you're trying to sell to
> people who don't have the power to say yes, then the best they can do
> is relay the pitch, and they won't have the same knowledge of what
> you're offering as you do,
Ah, but you won't have the same knowledge of what is needed as the
intermediate does.
> let alone the same flexibility in
> negotiation on rates and schedule that you can offer if you're there
> in person.
>
> This really sucks when the person who is the real decisionmaker is a
> pointy-haired boss type who doesn't know Perl from Peru, but even then
> you're still better off talking directly to him because you can
> impress him with your conviction and charm rather than your technical
> knowledge.
This is why I do the opposite of your advice at every turn.
As the pitcher, I have the technical knowledge but not the charm,
so I prefer to not to pitch to the person who can say "yes" but doesn't
know what he saying yes to, other than conviction and charm. As the Boss,
I want somehow who can take the time to see through the sales pitch and
tell me what I really need to know in a more or less objective manner,
which means someone from my organization who knows our needs and jargon
best and is not "on commission".
And as the Boss's delegate, the last thing I want is for you to have direct
access to the boss so you can charm him into making a bad decision. So
when someone says they want to talk directly to the decision maker, I tell
them that I am the decision maker and the decision is "no".
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 24 Jan 2005 20:16:04 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Regex problem
Message-Id: <ct3l24$jcq$1@mamenchi.zrz.TU-Berlin.DE>
Tore Aursand <toreau@gmail.com> wrote in comp.lang.perl.misc:
> Get rid of the newline(s) first;
>
> $html =~ s,\n,,g;
$html =~ tr,\n,,d;
Anno
------------------------------
Date: 24 Jan 2005 13:11:43 -0800
From: bayxarea-usenet@yahoo.com
Subject: spawn and monitor multiple processes - report back when all have completed
Message-Id: <1106601103.190966.22910@f14g2000cwb.googlegroups.com>
I want write a batch routine that will run multiple process - launch
them at the same time - but not return until they have all completed.
This is on Windows XP.
The process I want to call is a command line conversion utility that
will convert CGM files to HPGL files and it can take a while to execute
- currently I have the option to call system on each on in a loop - but
this is in series and means that each process will only start after the
previous one has finished.
I will be passing the batch script a filename of CGM files to convert
so there should be a new process for each CGM file found in the input
data file.
I was thinking of trying to get the process id or something like that
for each process and then monitor them and then return (or write
'FINISHED' to an output file when they all have actually completed
executing.
Is there a best way to handle this on Win32?
John
------------------------------
Date: 24 Jan 2005 21:35:58 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: spawn and monitor multiple processes - report back when all have completed
Message-Id: <Xns95E8A8E57D54Basu1cornelledu@132.236.56.8>
bayxarea-usenet@yahoo.com wrote in
news:1106601103.190966.22910@f14g2000cwb.googlegroups.com:
> I want write a batch routine that will run multiple process - launch
> them at the same time - but not return until they have all completed.
...
> I will be passing the batch script a filename of CGM files to convert
> so there should be a new process for each CGM file found in the input
> data file.
>
> I was thinking of trying to get the process id or something like that
> for each process and then monitor them and then return (or write
> 'FINISHED' to an output file when they all have actually completed
> executing.
>
> Is there a best way to handle this on Win32?
If you have Perl 5.8, see
perldoc -f fork
Sinan.
------------------------------
Date: 24 Jan 2005 22:33:20 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: spawn and monitor multiple processes - report back when all have completed
Message-Id: <ct3t3g$nto$1@mamenchi.zrz.TU-Berlin.DE>
<bayxarea-usenet@yahoo.com> wrote in comp.lang.perl.misc:
> I want write a batch routine that will run multiple process - launch
> them at the same time - but not return until they have all completed.
>
> This is on Windows XP.
>
> The process I want to call is a command line conversion utility that
> will convert CGM files to HPGL files and it can take a while to execute
> - currently I have the option to call system on each on in a loop - but
> this is in series and means that each process will only start after the
> previous one has finished.
That is graphic conversion, a cpu-intensive job. Unless you're running
on a multi-processor, you won't gain anything by running them in parallel.
Anno
------------------------------
Date: Mon, 24 Jan 2005 15:44:08 -0500
From: "Karen Wieprecht" <karen.wieprecht@jhuapl.edu>
Subject: trying to "use Sys::Syslog" but I get nothing ...
Message-Id: <ct3mmo$h5h$1@aplcore.jhuapl.edu>
I'm trying to get some data sent into the system log after processing it
with a perl program. the text processing works great, and if I send to
stdout, the messages come out as they are processed. However, I'm trying
to
send the messages to the system log with "use Sys::Syslog" and I am not
getting anything ...
1. I'm using perl 5.6
2. syslog.conf is configured to show *.notice
3. I have seen examples with different flavors of quotes ( " .vs. ') in
the setlogsock, openlog, and syslog commands. I tried both ways with no
effect.
Code snippit (not the full program):
use Sys::Syslog qw(:DEFAULT setlogsock);
setlogsock ("unix");
openlog ("audit", "ndelay,nowait", "local5");
while ( <> ) {
chomp;
$PRINT_STRING = $_;
syslog ("notice", " %s\n",$PRINT_STRING) ;
}
closelog ();
I never get a syntax error, but I don't get any of the messages into the
system log either . I can't get the syslog command to DO anything. the
syntax looks right compared to many samples of the code I've seen ... maybe
I'm missing something?
Any ideas? Help would be most appreciated.
Thanks,
Karen Wieprecht
------------------------------
Date: 24 Jan 2005 23:32:41 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: trying to "use Sys::Syslog" but I get nothing ...
Message-Id: <ct40ip$qcq$1@mamenchi.zrz.TU-Berlin.DE>
Karen Wieprecht <karen.wieprecht@jhuapl.edu> wrote in comp.lang.perl.misc:
> I'm trying to get some data sent into the system log after processing it
> with a perl program. the text processing works great, and if I send to
> stdout, the messages come out as they are processed. However, I'm trying
> to
> send the messages to the system log with "use Sys::Syslog" and I am not
> getting anything ...
>
> 1. I'm using perl 5.6
> 2. syslog.conf is configured to show *.notice
> 3. I have seen examples with different flavors of quotes ( " .vs. ') in
> the setlogsock, openlog, and syslog commands. I tried both ways with no
> effect.
>
> Code snippit (not the full program):
>
> use Sys::Syslog qw(:DEFAULT setlogsock);
> setlogsock ("unix");
> openlog ("audit", "ndelay,nowait", "local5");
>
> while ( <> ) {
> chomp;
> $PRINT_STRING = $_;
> syslog ("notice", " %s\n",$PRINT_STRING) ;
> }
> closelog ();
That code (or a close-enough variant) works for me as expected, so there's
no telling what is going wrong in your setup. At least two of the functions
you are using are documented as returning false on error, syslog() probably
does too. Check the return values and see what fails.
Anno
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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.
#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 V10 Issue 7687
***************************************