[11064] in Perl-Users-Digest
Perl-Users Digest, Issue: 4664 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 15 21:03:53 1999
Date: Fri, 15 Jan 99 18:00:13 -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 Fri, 15 Jan 1999 Volume: 8 Number: 4664
Today's topics:
Re: cat filename | wc -l perl equivalent <sternji@mail.northgrum.com>
Re: CONCLUSIVE PROOF: The Beatles are bigger than Jesus <joemama@roundtrip.net>
Re: CONCLUSIVE PROOF: The Beatles are bigger than Jesus <joemama@roundtrip.net>
filter href-links from web-page ? bluepuma@mailexcite.com
Re: Is perl the right choise for the following job? <cabrera@wrc.xerox.com>
New to Perl -- Frames Question <mkh@mail.utexas.edu>
Re: newbie installation problems <eugene@snailgem.org>
Please Help! <icegod@icehouse.net>
Re: Project Assistance <mlabor@sprintmail.com>
Re: Regex challenge (Ilya Zakharevich)
Re: Removing spaces from arrays... <paladin@uvic.ca>
Re: Removing spaces from arrays... <allan@due.net>
Re: Removing spaces from arrays... <allan@due.net>
RFC: Stepper - stepping engine, used for process automa <tbc@col.hp.com>
Re: what does this error mean? <eugene@snailgem.org>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 15 Jan 1999 23:37:16 GMT
From: "James M. Stern" <sternji@mail.northgrum.com>
Subject: Re: cat filename | wc -l perl equivalent
Message-Id: <369FD12C.F87D5F93@mail.northgrum.com>
Ala Qumsieh wrote:
>
> abigail@fnx.com (Abigail) writes:
>
> >
> > perl -wlpe '}$_=$.;{' filename
> >
>
> excuse me? but that works!
>
> could some kind soul consider elaborating more on this please?
perldoc perlrun and read about -p. It says Perl "assumes the following
loop around your script." Replace the "..." in that loop with the -e
script above.
>
> Just when I thought Perl wouldn't surprise me anymore!!!
Perl contains infinite surprises. :-)
--
James M. Stern Northrop Grumman Corp. Hawthorne, CA
Opinions expressed above are not necessarily my employer's.
------------------------------
Date: Fri, 15 Jan 1999 16:28:17 -0800
From: Joe Mama <joemama@roundtrip.net>
Subject: Re: CONCLUSIVE PROOF: The Beatles are bigger than Jesus!
Message-Id: <369FDD21.163D@roundtrip.net>
JLenn wrote:
> Yeah.......I'm sure Jesus would have aproved of a fanatical Christian
> (MC) shooting John Lennon for saying he was bigger than Jesus.
I really doubt this, since Yeshua taught a message of love, patience,
understanding and tolerance toward all mankind, including one's enemies.
> No....MC will rot in HELL for what he did....and John Lennon will be
> singing in Heaven for all of the good things he did for humanity. If
> there even are such places (Heaven and Hell).
And just what of any consequence did John Lennon do for humanity, write
and sing the song "Imagine," which depicted the godless totaliarian
global dictatorship of the pending one-world government that the United
Nations will spring on us soon after the so-called "New Millenium?"
Verses of "Imagine." Parallel teachings of Marx/Illuminism
"Imagine there's no heaven The attack on and abolition of all
It's easy if you try forms of organised religion
No hell below us
Above us only sky
"Imagine all the people The "do your own thing" today
Living for today philosophy: do not worry about tomorrow
"Imagine there's no countries The attack on and forced abolition
of nationalism and sovereignty of
nations
"It isn't hard to do The attack on and abolition of all forms
Nothing to kill or die for of organised religion
and no religion too
"Imagine all the people Under the authority of the masters who
Living life in peace claim the appointment by Providence
to the absolute oversight of mankind,
and
right to choose who is worthy to exist
"Imagine no possessions The confiscation and abolition of
privately owned property
"I wonder if you can The establishment of a
No need for greed or hunger "new international order"
A brotherhood of man
Imagine all the people
Sharing all the world
"You man say I'm a dreamer A one world government aka
But I'm not the only one The "New World Order"
I hope someday you'll join us
And the world well be as one"
> WWS wrote in message <369C977C.25D4A95B@tyler.net>...
> >
> >eric wrote:
> >>
> >> John Lennon said so, so there!
> >
> >BANG, BANG, BANG, BANG! That's what he gets for saying he's
> >bigger than Jesus. Although the holes were rather small,
> >they had to count them all. - Deacon
> >
> >peep
--
-jm
---
To reply no spam, change "roundtrip" to "rarebird"
cuz for the spam it's gonna be a literal round trip..
------------------------------
Date: Fri, 15 Jan 1999 16:34:16 -0800
From: Joe Mama <joemama@roundtrip.net>
Subject: Re: CONCLUSIVE PROOF: The Beatles are bigger than Jesus!
Message-Id: <369FDE88.3E75@roundtrip.net>
-BEN wrote:
> JLenn wrote:
>> No....MC will rot in HELL for what he did....and John Lennon will be
>> singing in Heaven for all of the good things he did for humanity. If
>> there even are such places (Heaven and Hell).
> Which there aren't, so it's all pointless discussion anyway.
> If you beileve the bible John would be rotting in hell right now. He
> didn't worship God & Jesus like a monk so he wouldn't be let in to
> heaven. Not that it exists, but theoretically speaking.
Theosphically speaking, the Scriptures do not even teach that there is a
fiery-burning hell at all, but is a teaching from pagan religions which
crept in through the Western Church of Rome during their campaign to
"christianise" the masses by compromising their festivals and doctrines
and merging them into the teachings of the church. I believe that many
of these were mandated by the Nicaen Councils, particularly the Third..
Food for thought..
--
-jm
---
To reply no spam, change "roundtrip" to "rarebird"
cuz for the spam it's gonna be a literal round trip..
------------------------------
Date: Fri, 15 Jan 1999 23:59:45 GMT
From: bluepuma@mailexcite.com
Subject: filter href-links from web-page ?
Message-Id: <77okpc$7q6$1@nnrp1.dejanews.com>
Hi there,
could someone explain me how to filter href-links from a web-page ?
I know how to check if there is a href-link, but how do I assign
a variable to the link ? And how do I adjust the path correctly ?
example:
in
/home/WorldCup/content/english/competition/draw_videos.htm
we got the line
<a href="../../images/footix.mov" target>
so how do I get to $link="/home/WorldCup/content/images/footix.mo"; ???
And what if there is more than 1 link in 1 line ? Can I just get an
array of links from the html-file ? Need some help...
regards Michael
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 15 Jan 1999 18:44:52 GMT
From: "Jose I. Cabrera" <cabrera@wrc.xerox.com>
Subject: Re: Is perl the right choise for the following job?
Message-Id: <1999Jan15.184123.896@news.wrc.xerox.com>
Yes! Very.
Joeri Belis wrote in message <77nv75$ejs$1@nickel.uunet.be>...
>Is perl the right choise for the following job?
>
>I want to connect to a certain site (asp pages)
>and need the extract some info from that page.
>reformat it and right it to an ascii file.
>
>Can perl do that easy?
>
>--
>******************************************************
>http://www.experts-exchange.com
>******************************************************
>
>
------------------------------
Date: Fri, 15 Jan 1999 19:21:48 -0600
From: "Matt Howell" <mkh@mail.utexas.edu>
Subject: New to Perl -- Frames Question
Message-Id: <77oplg$avm$1@geraldo.cc.utexas.edu>
I'm relatively new at programming in Perl, but it has been going well. I'm
getting what I need to do done, but I have had a snag, and I need some
advice.
Here's my situation.
I would like to know if there is a simple way of having a perl script post
information to two separate frames on a web page. For instance, if the user
inputs something into a form, I want that script to process the input, and
then generate two HTML documents: one to go in one frame on the page, and
one to go in another. Maybe this is an HTML question. Is there a simple
tag that I can put in the output that will direct the browser to one frame,
and then redirect it to another? This would be ideal.
If you have any suggestions or ideas, please let me know!
Thanks,
Matt Howell
------------------------------
Date: Fri, 15 Jan 1999 20:29:03 -0500
From: Eugene Sotirescu <eugene@snailgem.org>
To: Michael Hearn <byike@gate.net>
Subject: Re: newbie installation problems
Message-Id: <369FEB5F.99E49618@snailgem.org>
Try installing from RPM, might save you some trouble.
Michael Hearn wrote:
>
> I am trying to install perl 5.005-2 on a Red Hat Linux 5.1 486 machine.
>
> When I try to run the 'Configure' script using:
>
> sh ./Configure
>
> I get endless errors scrolling down the screen:
> : command not found
> : command not found
> : No such file or directory
>
> I assume that bash cannot interpret the shell script. I must be missing
> something simple. Any ideas?
>
> Thanks,
> Mike
--
Eugene
you: "I have a gun. Give me your money!"
Eliza: "Can you elaborate on that?"
(from a conversation with the chatbot Eliza, as reported by John Nolan)
------------------------------
Date: Fri, 15 Jan 1999 17:49:02 -0800
From: "Tom Rhodes" <icegod@icehouse.net>
Subject: Please Help!
Message-Id: <369ff176.0@news.icehouse.net>
Dear Reader,
I am new to cgi programming and my grandfather assigned me to make a
program that lets a customer configre what parts he/she wants in a personal
computer. Now this didn't seem like such a hard task to me but as I went
along I found out there were complications. First off my host offers a
shopping cart cgi in their service which is what we've been using, but it
only allows someone to add one item at a time to their cart (go to
http://www.lrco.net to see the cart). In order for a configurator to work it
needs to be able to submit everything the customer selected to the shopping
cart in one click. My idea on this was to write another "go-between" cgi
program that takes the information from the configurator form and then sends
each item the customer selected one at a time to the shopping cart cgi. Well
the idea seems sound to me but theres only one problem, I don't know how to
do this! :) If anyone knows how one could do this I would greatly appreciate
it if they could explain it to me. If I didn't explain my problem well
enough I'd be glad to explain it more, you can just email me at
icegod@icehouse.net.
Thanks in advance,
Tom Rhodes
------------------------------
Date: Fri, 15 Jan 1999 18:32:09 -0500
From: "Manual Labor" <mlabor@sprintmail.com>
Subject: Re: Project Assistance
Message-Id: <77oj59$gno$1@fir.prod.itd.earthlink.net>
use shockwave
Thomas Rock wrote in message <369E4DB3.3A7CB2CB@x-tekcorp.com>...
>Wow! Tough school. They *kill* you if you don't
>complete your senior project?! :-)
>
>
>
>
>juldex@yahoo.com wrote:
>>
>>It's a life and death situation. Thank you Dexter Winter
>>
>> -----------== Posted via Deja News, The Discussion Network ==----------
>> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>
>--
>Thomas Rock
>
>X-Tek Corporation
>www.x-tekcorp.com
------------------------------
Date: 16 Jan 1999 00:42:57 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Regex challenge
Message-Id: <77onah$a8b$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Eric Smith
<eric@nafex.com>],
who wrote in article <slrn79ueln.2m2.eric@eric.nafex.com>:
> Hi perl
>
> Double barrelled s/gun/question/ ;)
>
> 1) I want to match a word, say `table' but the character \& or ampersand
> can appear anywhere in table so all these are legal:
> \&table
> t\&able
> ta\&ble
> ... [snip] ...
> table\&
>
> any elegant solutions for my regex?
Not with the current pitiful state of the REx engine. But with the
proposed onion-rings syntax (see clp.moder) and it can be done as
(?<> ( (\&)? t (\&)? a (\&)? b (\&)? l (\&)? e (\&)? )
<> ( \A \w* \&? \w* \z)
)
Here I assume that in the "inner" onion ring \A and \z match at
boundaries of the outer onion ring.
Ilya
------------------------------
Date: Fri, 15 Jan 1999 16:31:17 -0800
From: Draco Paladin <paladin@uvic.ca>
To: Hawkwynd <hawkwynd@adelphia.net>
Subject: Re: Removing spaces from arrays...
Message-Id: <Pine.A41.4.05.9901151626230.60914-100000@unix4.UVic.CA>
On Fri, 15 Jan 1999, Hawkwynd wrote:
[explination snipped]
> (open (INF, "$file"))or die("Can't open $file");
>
> @ary = <INF>;
> close(INF);
> open (NEW,">$outfile") || die "Cannot open $outfile!";
>
> &header_print; #Set up the header page...
>
> foreach $line (@ary){
>
# Try this (untested, but should work)
# First splits the line on whitespace (empty regex in split)
# The joins the splitted array with a | between each entry and prints the
# line
print join('|', split(//,$line));
> }#end foreach
>
> close(NEW) || die "cannot close..";
> exit;
---------------------------------------------
Mother is the name for GOD on the lips and
hearts of all children. - Eric Draven
------------------------------
Date: 16 Jan 1999 00:54:59 GMT
From: "Allan M. Due" <allan@due.net>
Subject: Re: Removing spaces from arrays...
Message-Id: <77oo13$gtb$0@206.165.165.159>
Hawkwynd wrote in message <369fb52a.14895778@news.fwi.com>...
:I have a database file that has fields seperated by spaces, and would
:like to have each field assigned to it's own variable as it is read in
:from the file.
:An example of the data file :
:6606677 Y R SF00 01/13/99 07:48 40-006990 INFO
:
:6600151 Y R SF00 01/12/99 08:27 A359 ADIC
:
:6602719 Y R SF00 01/12/99 11:48 B603 ADIC
:
:6603118 Y R SF00 01/12/99 12:15 10-509610 ADAPTEC
: The problem here, is the spaces between lines, and between the
:variables.
:This is how I want the data to be outputted...
:6606677 | Y|R|SF00|01/13/99|07:48|40-006990|INFO
:6600151|Y|R|R|SF00|01/12/99|08:27|A359|ADIC
:For the life of me I've been unable to get the script to do this...
:Any suggestions?
How about something like:
#!/usr/local/bin/perl -w
use strict;
my @ary = ('6606677 Y R SF00 01/13/99 07:48 40-006990 INFO',
' ',
'6600151 Y R SF00 01/12/99 08:27 A359 ADIC',
' ');
my @foo = map {join "|",(split ' ')} grep {!/^\s*$/} @ary;
foreach (@foo) {
print "$_\n"
}
prints
6606677|Y|R|SF00|01/13/99|07:48|40-006990|INFO
6600151|Y|R|SF00|01/12/99|08:27|A359|ADIC
HTH
AmD
print
------------------------------
Date: 16 Jan 1999 01:40:59 GMT
From: "Allan M. Due" <allan@due.net>
Subject: Re: Removing spaces from arrays...
Message-Id: <77oqnb$mv6$0@206.165.165.159>
Draco Paladin wrote in message ...
:On Fri, 15 Jan 1999, Hawkwynd wrote:
:[explination snipped]
:> (open (INF, "$file"))or die("Can't open $file");
:> @ary = <INF>;
:> close(INF);
:> open (NEW,">$outfile") || die "Cannot open $outfile!";
:> &header_print; #Set up the header page...
:> foreach $line
ry){
:# Try this (untested, but should work)
:# First splits the line on whitespace (empty regex in split)
:# The joins the splitted array with a | between each entry and prints the
:# line
:
:print join('|', split(//,$line));
That splits on every character. Testing is a good thing <g>.
s{//}{' '};
or
s{//}{" "};
either will split on white space.
HTH
AmD
------------------------------
Date: Fri, 15 Jan 1999 18:13:13 -0700
From: "Tim Chambers" <tbc@col.hp.com>
Subject: RFC: Stepper - stepping engine, used for process automation
Message-Id: <77op3s$1gj$1@nonews.col.hp.com>
I'm wondering if anyone's doing anything related to this.
I'd also like to know what others think of the idea. I have
it running, but it isn't ready for submission to CPAN.
Tim Chambers || tbc@col.hp.com (e-mail)
Software Design Engineer || 719.590.5570 (Office phone)
Hewlett-Packard Company || 719.590.2251 (Fax)
Colorado Springs Division || Tools for Digital & Embedded Design
http://www.geocities.com/Athens/3680/ (Personal Web)
The opinions and URL recommendations stated here are my own
and do not necessarily represent those of Hewlett-Packard.
-----------------------------------------------------------------
NAME
Stepper - stepping engine, used for process automation
SYNOPSIS
$sobj = Stepper->new("Test", "test0", "0.001");
# first define the DAG
$sobj->initialStep(qw(step1 main::step1Func step2 step7));
# both step3a and step3b can run after step2
$sobj->anotherStep(qw(step2 main::step2Func step3a step3b));
# both step3a and step3b must complete before running step4
$sobj->anotherStep(qw(step3a main::step3aFunc step4));
$sobj->anotherStep(qw(step3b main::step3bFunc step4));
$sobj->anotherStep(qw(step4 main::step4Func step5a step5b));
$sobj->anotherStep(qw(step5a main::step5aFunc step6));
$sobj->anotherStep(qw(step5b main::step5bFunc step6));
$sobj->anotherStep(qw(step6 main::step6Func)); # a final step
$sobj->anotherStep(qw(step7 main::step7Func)); # a final step
$sobj>doAllSteps(1);
DESCRIPTION
Introduction
The Stepper package is a foundation for Perl scripts
that implement automated *processes*, where a *process*
is here defined according to the *American Heritage
Dictionary*: "a series of actions, changes, or functions
that bring about an end or result." In order to reduce
confusion between this definition of a process and the
UNIX term, "process," the latter will be called a "task"
by this package -- even "process IDs" will be called
"task IDs." Stepper uses a new UNIX task to execute each
step of your process.
There are two benefits to using separate tasks for each
step. The first is isolation. If a step fails you can
presumably find out why it failed, correct the problem,
and then re-run the step. The process can resume from
where it left off. The second benefit is that it makes
it natural for Stepper to support the parallelism
inherent in the process.
You do need to put some thought into the *granularity*
of your process. A classic example is the make process,
whose purpose is to build a piece of software. Compiling
a file is the obvious granularity for a step in such a
process. (In fact, applying Stepper to the software
build process is one of the first uses we intend to
try. -- tbc, 01/14/99) In general, the more parallelism
inherent in the process, the greater advantage you will
get from Stepper, and you can make the granularity of
the steps very fine.
Defining Relationships Among Steps
A process developer describes the relationships among
process steps to Stepper as a directed acyclic graph
(DAG). Nodes represent steps of the process, and edges
are relationships among steps. If step A must be done
before step B, then step B is said to be a *child* of
step A, and step A is the *parent* of step B. In the
simplest process, you do step A, then step B, then step
C, etc. See Figure 1.
A -> B -> C
initialStep(A, main::funcA, B);
anotherStep(B, main::funcB, C);
anotherStep(C, main::funcC);
Figure 1. A sequential process.
In a more parallel process, you might do both steps A
and B, then step C can run, then both steps D and
E. Stepper allows you to derive maximum benefit from
steps A and B running at the same time and from steps D
and E, even though they must both wait until step C
finishes before they can start. See Figure 2.
-> A -+ +-> D
|-> C -|
-> B -+ +-> E
initialStep(A, main::funcA, C);
initialStep(B, main::funcB, C);
anotherStep(C, main::funcC, D, E);
anotherStep(D, main::funcD);
anotherStep(E, main::funcE);
Figure 2. A process with some parallel steps.
From these two examples, you can see how easy it is to
describe a process to Stepper. Initial steps are
executed first. All other steps may or may not have
child steps. See the initialStep($name, $func, ...)
manpage and the anotherStep($name, $func, ...)
manpage. Each step is executed as soon as all of its
parents have completed. A step may have multiple
parents. The initial steps are executed in the
alphabetical order of their names, and so are children
of any given step (assuming the children don't have
dependencies to multiple parents).
NOTE: *do not* use newlines or leading or trailing
spaces in strings passed to this package's
methods. Other restrictions are noted with particular
methods as they apply.
The process-specific scripts can run through the
processes either one step at a time (the doNextStep(
$parallel;$name ) manpage) or fully automated (the
doAllSteps( $parallel ) manpage, the doAllNextSteps
manpage).
Defining Functions for Each Step
IMPORTANT: a design decision was made to *not* assume
functions are in the main:: namespace. Therefore, you
must fully qualify the name for the functions. For
instance, if func1 *is* in the main namespace, you
should tell Stepper that the function is 'main::func1'.
The first parameter passed to the functions associated
with each step is the ref to the Stepper object, and the
second parameter is the step name. The process developer
can store simple data in the $self variable (see the
section on "How Processes Use This Package"), and that
should suffice for most communication that one step must
make to subsequent steps.
All functions should return 0 for success and non-zero
on failure.
Each function is responsible for emitting its own
messages about what it is doing.
You can use a single function for all steps that behaves
differently depending on the name of the step.
Any function can opt to respond to the string "undo" as
the third parameter. If the abort manpage is called,
Stepper will run the process in reverse order from the
last step run, calling each function with "undo".
Logging Policy
When the steps are executed, standard I/O is redirected
to a separate log file for each step (see the
logfile4step( $name ) manpage and the FILES manpage).
After each step's function has completed, the contents
of the log file for that step is printed to stdout. Also
see the section on "CONFIGURATION OPTIONS" for a use of
$main::opt_silent.
How Processes Use This Package
By convention, a process called Something is implemented
as a script called doSomething. It might someday be
implemented as a class that inherits from Stepper, but
at present you can just declare an instance of a Stepper
object and store any scalar instance variables directly
in the Stepper instance's anonymous hash. Scalar data
will be saved and loaded (see the save manpage and the
load($type, $name) manpage), but anonymous hashes and
arrays are *not* supported.
Redefining a Process
Old instances may be used even if you change the process
later because the steps are defined at the point when
you create a new instance and are stored with the
instance. (You must avoid overloading the function
names, though -- create a new function name if you
change the process.)
METHODS
new($type, $name, $version)
Constructor for a new process with given type and
instance name (both strings).
IMPORTANT: if the storage for this type/instance already
exists, *it will be overwritten*. Also see the FILES
manpage.
Compare with the load($type, $name) manpage.
Dies if:
1. parameters are either blank or they contain blanks
2. storage directory cannot be made
3. old storage exists and cannot be removed
initialStep($name, $func, ...)
Defines an initial step with the given name. $func is
the name of the function that is to be called for this
step (see the section on "Defining Functions for Each
Step"). The rest of the parameters are names of steps
that depend on completion of $name before they can
execute (the "children" of $name).
Duplicate children are harmlessly ignored.
Will die if:
1. you try to make it its own child
2. the process is running (you should define the entire
process once, then run it)
3. there is already a step with the same name
anotherStep($name, $func, ...)
Defines non-initial steps. Operation is the same as the
initialStep($name, $func, ...) manpage except the step
is flagged as not being an initial step.
setText($name, $oneliner, ...)
The first parameter is the name of the step, the second
is its one-line description, and the rest of the
parameters are a list of lines of text comprising the
full description of the named step. Steps aren't
required to have text associated with them, but it's
highly recommended that you document each step.
getText($name)
Returns an array for the given step name. The first
entry is its one- line description, and the rest of the
array is a list of lines of text comprising the step's
full description.
doNextStep( $parallel;$name )
Requires exclusive access to the instance's state during
critical sections; will emit an error message if access
can't be obtained..
Executes the next step that is ready to run. If no steps
have run, this is the initial step whose name is
alphabetically first. If all steps have run, this is a
no-op. The step is run in a separate task using the
"perlfunc_fork_0" entry in the perlfunc manpage. This
allows us to recover if the step has a fatal problem. It
also allows parallel execution of independent steps.
If a step name is provided, that particular step will be
executed (if it's ready to run). Note that only one step
is executed per call -- additional steps will be
ignored.
If $parallel is non-zero, then the task is left to run
in the background; otherwise, we wait for the task to
complete.
Prints diagnostics via Msg(-err) if problems occur.
Returns nothing (null) if either no step was run or we
can't get exclusive access to state.
Returns the task ID (UNIX PID) that was forked if
$parallel is non-zero.
Returns the exit code of the step's function if both
$parallel is zero and the step ran.
getNextStep
Requires exclusive access to the instance's state; will
print an error message if access can't be obtained.
Returns the name of the next step that is ready to run.
Returns nothing (null) if all steps have run or if we
can't get exclusive access to state.
doAllNextSteps
Runs all steps that are ready to run via the doNextStep(
$parallel;$name ) manpage. The steps are always run in
parallel because they are, by definition, independent
(they're *all* next). If you only want to run one at a
time, call the doNextStep( $parallel;$name ) manpage
instead. This method does wait for all steps to
complete before it returns, though.
IMPORTANT: if the independent steps themselves have
children, you may be asking to do more work than you
meant to. Maybe you want to do this instead:
# $myProcess is your Stepper object
for ($myProcess->getAllNextSteps) {
$myProcess->doNextStep($_);
}
Also see the getCompletedSteps manpage for how to check
results.
Returns the number of steps that ran.
getAllNextSteps
Requires exclusive access to the queue of steps during
critical sections; will emit an error message if access
can't be obtained.
Returns a list of all steps that are ready to run.
Returns nothing (null) if all steps have run or if we
can't get exclusive access to state.
doAllSteps( $parallel )
Requires exclusive access to the instance state during
critical sections; will emit an error message if access
can't be obtained. Unless it was already been done on
this instance, calls the validate manpage first just to
check for errors. If there are errors, they are printed
to stderr; otherwise, all steps are executed, starting
with the initial steps.
The output of each step is printed on STDOUT in the
order it would run if running sequential. If $parallel
is non-zero, all output is reserved until the end. While
running in parallel, you can query results using the
getCompletedSteps manpage. Then use the logfile4step(
$name ) manpage and read it for yourself.
If $parallel is non-zero, then steps are executed in
parallel.
If $parallel is zero, then all steps are executed in
sequence, the next one starting after the last one
completes. This defeats the key contribution of this
package, but it's here for testing and for anyone else
who has a need.
Also see the getCompletedSteps manpage for how to check
results.
Presently, if $parallel is zero, execution is halted
when the first step returns with non-zero status. If
$parallel is non-zero, all independent steps are
executed, but any failing step will deny the steps that
depend on it the ability to run. In the future, error
recovery will be implemented, but I want to get some
experience with this before choosing a solution to that
problem.
Returns the number of steps that ran successfully.
Returns nothing (null) if the process has definition
errors or if we can't get exclusive access to state.
getCompletedSteps
Returns an array of step names that have been run to
completion.
abort
Aborts execution of the process. The function of each
step that has run is called with "undo" as the second
parameter. The steps are called in the reverse order
that they were executed, effectively "unwinding" the
process from the last step to the first.
save
The instance is saved in
$Stepper::dataDir/type/name.ini, for the given instance
name of the given type. The five last copies are kept as
a precaution (for debugging) in .ini.sav files. Also see
the load($type, $name) manpage and the COMPATIBILITY
manpage.
load($type, $name)
This is an alternate constructor. It will attempt to
load the instance saved by the save manpage. If the
instance isn't found, it emits appropriate error
messages and returns an undefined value. Compare with
the new($type, $name, $version) manpage. Also see the
COMPATIBILITY manpage.
validate
Validates the instance and, as a by-product, returns a
human-readable representation as a list of text lines.
Modifies the instance so that it is ready to run from
the beginning.
Returns a list whose first element is the number of
errors encountered. Errors are listed next. Finally,
the description is listed.
Here's an example of how you might use it:
@retAr = $sobj->validate;
Msg(-inf, "The process specification has errors") if (@retAr[0]);
# dump errors
my $errs = shift @retAr;
for (my $idx = $errs;$idx;$idx--) {
$errLine = shift @retAr;
Msg(-err, $errLine);
}
if ($errs) {
Array2Fdesc(STDOUT, \@retAr);
FatalMsg("Aborting");
}
logfile4step( $name )
Returns the pathname of the logfile for the given
step. A dumb function -- doesn't check whether the name
is a valid step.
catAllLogs
Returns an array that is a concatenation of all logs (in
order of step's sequential execution) for all steps that
have run. May be empty if nothing has run.
type
Returns the type (a string) of the instance.
version
Returns the version (a string) of the instance.
enableUnitTest
Like it says.
COMPATIBILITY
Do not use this class in a multi-threaded
environment. It uses global variables in the Stepper::
namespace for saving and loading. (See the save manpage
and the load($type, $name) manpage.)
EXAMPLES
*TBD (tbc, 12/03/98)*
CONFIGURATION OPTIONS
$Stepper::dataDir
The root of the storage directory for persistent
data. See the FILES manpage for details.
$Stepper::mkdirPerms
Permissions used to create storage directories. See
the FILES manpage for details.
$Stepper::traceCalls
Used when debugging, FWIW.
OTHER USEFUL VARIABLES
$main::opt_silent
No output is echoed while steps are executed, but
the log files are still written.
$main::opt_verbose
Information to help you trace the execution of your
process is emitted on STDERR. All verbose messages
have the same format. The first field is the time in
HH:MM:SS format. The second is the task ID (Perl
$$). The rest of the line is a description of what's
going on at that moment.
IMPLEMENTATION OF PARALLEL EXECUTION
In order to run steps in parallel, we have to maintain
the state of the instance across task boundaries. This
is accomplished by sharing a state file (not the entire
instance) among tasks. The file is locked during
critical pieces of code and is re-read at specific
junctures to ensure synchronization. It contains the
queue of steps and the PID for each step that is being
executed.
Standard I/O is redirected to a separate log file for
each parallel task (Also see the Introduction manpage,
the section on "Logging Policy", the logfile4step( $name
) manpage, and the FILES manpage).
FILES
Objects are stored in subdirectories named after the
process types and names under $Stepper::dataDir (. by
default). For instance, object test0 of type Test is
stored in ./Test/test0/. The subdirectories are created
with permissions set by $Stepper::mkdirPerms (0775 by
default). The main data, which doesn't change during
execution, is stored in main.ini, e.g.
./test0/state.ini. In the same directory, state is
stored in state.ini. The state file serves as the
semaphore to control exclusive access. That is, only one
task has access to the state at any given time. This is
implemented using a locking scheme suggested by the
*Perl Cookbook*, pp. 264-266.
In this same sample process, the log file for a step
named *N* is stored in ./Test/test0/N.log. (Also see the
logfile4step( $name ) manpage).
SEE ALSO
N/A
AUTHOR
Tim Chambers - Hewlett-Packard Colorado Springs
Division ( mailto:tbc@col.hp.com )
Copyright (c) 1998, Hewlett-Packard, Co.
------------------------------
Date: Fri, 15 Jan 1999 20:52:56 -0500
From: Eugene Sotirescu <eugene@snailgem.org>
To: vivekvp@hotmail.com
Subject: Re: what does this error mean?
Message-Id: <369FF0F8.5463066D@snailgem.org>
Am I correct to assume that this is a script you found somewhere (one of
Matt's famous scripts?) and are trying to use it while having no clue
how it works?
Here are some pointers. (You'll have to get a Perl book if you don't
know what I'm talking about).
vivekvp@hotmail.com wrote:
>
> hi. i have a perl script that it not working. using perl -d <filename>, i
> get this error:
>
> Name "main::monitor" used only once: possible typo at menutest.cgi line 45.
> there is not incidence of the work "main" at all in the script, and "monitor"
> is only used 3x - here is the code:
>
> #add extra price for monitors over 14"
> $monitor = $input{'monitor'};
> $price += $price_list{$input{'monitor'}};
$main::monitor is the full name of the $monitor variable: $monitor is
just a handy abbreviation. ('main' is the package name, if you really
want to know).
What you see is a warning that you're using it only once, on the left
side of the
$monitor = $input{'monitor'};
assignment.
Your other uses of the word monitor have nothing to do with the variable
$monitor, they just refer to a key in the %input hash.
Moreover, since this is just a warning, it doesn't keep your script from
working, if everything else is well.
Since your script can't find cgi-lib.pl, and since it probably is
cgi-lib.pl that creates the %input hash, nothing in your(?) script is
gonna work.
> using perl -w <filename>
>
> i get this one too:
>
> Can't locate cgi-lib.pl in @INC at menutest.cgi line 6
>
> the lines of codes at line 6 are :
>
> push(@INC,"/cgi-bin");
> require("cgi-lib.pl");
I don't know why the script can't find cgi-lib.pl.
Try this:
#push(@INC,"/cgi-bin"); comment out this line, which slows you down
anyway
#locate and use full path to cgi-lib.pl
require "/full/path/to/cgi-lib.pl";
Eugene
you: "I have a gun. Give me your money!"
Eliza: "Can you elaborate on that?"
(from a conversation with the chatbot Eliza, as reported by John Nolan)
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 4664
**************************************