04-03-2009
checkboard $b $lnum
Within the subroutine "checkboard" the value of the parameters is $1 and $2 (not $b and $lnum).
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
we can call the subroutines using two ways ....
1) calling subroutine name preceeded by & symbol.
2)Another one is without &symbol....
what is the diff b/w these two....
############################
#usr/bin/perl
fun;
sub fun
{
print "hi this is from perl\n";
}... (1 Reply)
Discussion started by: sarwan
1 Replies
2. AIX
Okay, so in AIX, there are various subroutines that is built in to the OS. The subroutine is I want to use is passwdpolicy(). So I want to construct a C program that will be able to pass credentials into the program and thusly into the subroutine.
I'm not asking for homework, or for someone to... (0 Replies)
Discussion started by: syndex
0 Replies
3. Programming
Hi friends
I am Administrator for a system works with uinx OS but, many times I get messages from server console inform me about Subroutine is Hanging
so what can I do to reset this Subroutine?
Note: always when I got that I restart the server but I think that is not professional solution. (3 Replies)
Discussion started by: bintaleb
3 Replies
4. Shell Programming and Scripting
All,
Is it possible to call a subroutine from the perl expect module after logging to a system that is within the same program. My situation is I need to run a logic inside a machine that I'm logging in using the expect module, the logic is also available in the same expect program.
Thanks,... (5 Replies)
Discussion started by: arun_maffy
5 Replies
5. Programming
Hello,
My problem is with compiling a program modelling shallow water.
In it there is a subroutine called stat with 9 parameters.
In the main program it is called with 9 parameters also
I'm running Ubuntu 11.04 with gfortran version 4.5.
Thanks.
---------- Post updated at 11:57 PM... (0 Replies)
Discussion started by: b_franz
0 Replies
6. UNIX for Dummies Questions & Answers
Okay I have a 1TB drive that is almost completely full with vids. I am in the process of converting them to mp4. I have two scripts right now. One is a shell script to convert them with Handbrake. The other is a script to get a sort of progress report. To make things easier to understand, I will... (0 Replies)
Discussion started by: Dalton63841
0 Replies
7. Shell Programming and Scripting
Hi,
ive a perl script, where it has a subroutine clear() in it, and i've one shell script which runs in background, from that shell script i wanted to call subroutine which is in perl script, that's perl script is not module, just simple script.
Eg:
perl script <test>
#!... (4 Replies)
Discussion started by: asarunkumar
4 Replies
8. Shell Programming and Scripting
I have a shell script like this:
#!/bin/sh
$PYTHON MetarDecoder.py < ../data/mtrs/arg1/arg2
And I'm calling it with this in perl:
my $output = `./metar_parse.sh --options`;
It's successful when I put in actual values for arg1 and arg2 in the shell script, but I'd like to pass arguments... (1 Reply)
Discussion started by: civilsurfer
1 Replies
9. Shell Programming and Scripting
I am trying to run a perl script which needs input arguments from a parent perl script, but doesn't seem to work. Appreciate your help in this regard.
From parent.pl
$input1=123;
$input2=abc;
I tried calling it with
system("/usr/bin/perl child.pl $input1 $input2");
and
`perl... (1 Reply)
Discussion started by: grajp002
1 Replies
10. Shell Programming and Scripting
Hello All,
I am in the process of learning perl.I have a perl script and based on the arguments passed it would the appropriate subroutine that is defined in the script.
Now, I need to check a value that is defined in the Environment variables and should call the subroutine only if the... (1 Reply)
Discussion started by: filter
1 Replies
LEARN ABOUT DEBIAN
data::stag::basegenerator
Data::Stag::BaseGenerator(3pm) User Contributed Perl Documentation Data::Stag::BaseGenerator(3pm)
NAME
Data::Stag::BaseGenerator - base class for parsers and other event generators
SYNOPSIS
# writing the parser
package MyParser;
use base qw(Data::Stag::BaseGenerator);
sub parse_fh {
my ($self, $fh) = shift;
my $lnum = 0;
$self->start_event('data');
while (<$fh>) {
++$lnum;
$self->line_no($lnum);
# do stuff
$self->start_event('foo');
# ...
$self->event(blah=>5);
#
if (/incorrect_line/) {
$self->parse_err('line not in correct format');
}
# ...
$self->end_event('foo');
}
$self->pop_stack_to_depth(0);
}
1;
# using the parser
my $p = MyParser->new;
my $h = MyHandler->new; # see Data::Stag::BaseHandler
my $eh = Data::Stag->makehandler;
$p->handler($h);
$p->errhandler($eh);
$p->parse($file);
# result tree
print $h->stag->xml;
# write parse errs on standard err
printf *STDERR $p->errhandler->stag->xml;
# using the parser from the command line
unix> stag-parse.pl -p MyParser -w xml -e err.xml > out.xml
# using the parser from the command line via intermediate handler
unix> stag-handle.pl -p MyParser -m MyHandler -w xml -e err.xml > out.xml
DESCRIPTION
This is the base class for all parsers and event generators
parsers/generators take some input (usually a filehandle, but a generator could be a socket listener, for example) and fire stag events
stag events are
start_event NODENAME
evbody DATA
end_event NODENAME {optional}
event NODENAME DATA
These events can be nested/hierarchical
If uncaught, these events are stacked into a stag tree, which can be written as xml or one of the other stag formats
specialised handlers can be written to catch the events your parser throws
For example, you may wish to write a pod parser that generates nested events like this:
<pod>
<section>
<type>head1</type>
<name>NAME</name>
<text>Data::Stag - Structured Tags datastructures</text>
</section>
...
</pod>
(see the source for Data::Stag::PodParser for details)
You can write handlers that take the pod-xml and generate something - for example HTML
parsers may encounter unexpected things along the way - they may throw an exception, and fall over - or they may choose to fire an error
event. by default, error event streams are diverted to STDERR. You can create your own error handlers
PUBLIC METHODS
new
Title: new
Args:
Return: L<Data::Stag::BaseGenerator>
Example:
CONSTRUCTOR
handler
Title: handler
Function: GET/SET ACCESSOR METHOD
Args: handler L<Data::Stag::BaseHandler> optional
Return: L<Data::Stag::BaseHandler>
Example: $p->handler(MyHandler->new);
each parser has a handler - all events generated are passed onto the handler; the default handler simply sits there collecting events
errhandler
Title: errhandler
Function: GET/SET ACCESSOR METHOD
Args: handler L<Data::Stag::BaseHandler> optional
Return: L<Data::Stag::BaseHandler>
Example: $p->errhandler(Data::Stag->makehandler);
each parser has an error handler - if the parser encounters things it does not expect, it can pass errors to the errorhandler
if no errorhandler is set, an XML event handler that writes to STDERR is used
cache_errors
Title: cache_errors
Args:
Return:
Example: $p->cache_errors
If this is called, all errors will be cached rather than written to STDERR
The error list can be accessed like this
$p->parse($fn);
@errs = $p->errhandler->stag->get_error;
parse
Example - $parser->parse($file1, $file2);
Returns -
Args - filenames str-LIST
parses a file
parse
Example - $parser->parse_fh($fh)
Returns -
Args - fh FILEHANDLE
parses an open filehandle
PROTECTED METHODS
These methods are only of interest if you are making your own parser/generator class
start_event NODENAME
evbody DATA
end_event NODENAME {optional}
event NODENAME DATA
SEE ALSO
Data::Stag Data::Stag::BaseHandler
perl v5.10.0 2008-06-03 Data::Stag::BaseGenerator(3pm)