Hello,
It may be e little bit a strange question, but I am trying to understand some code. The problem is that in this code two subs are calling each other. How is this possible, or am I interpreting things the wrong way.
In the following code the
my $retval = $self->{'timespan'}->init({%{$li}}) is calling sub init, but this sub init is calling sub process again.
Here is the necessary code to understand my question:
# for parse modules, sub init is sort of int.main() function
sub init
{
my ( $self, $input ) = @_ ;
$self->{'_input_'}->{'_type_'} = 'process';
my $li = $self->update_user_input( $input );
$self->process($li,$input)
}
# True process module, calls methods from Request::Request_Help.
sub process
{
# The incoming array is split into $self, $li and $input
my ($self, $li, $input) = @_ ;
# $li is a hash-reference where the keys preforid, order_by and order
+_sequence are designated
# the values 1, time and ASC respectively.
$li->{preforid} = 1;
$li->{order_by} = "time";
$li->{order_sequence} = "ASC";
my $retval = $self->{'timespan'}->init({%{$li}});
my %stanet;
if ($retval) {
foreach my $sta (@$retval)
{
# Check if sufficient data is already in database [bud_reader]; if
+not, process station.
$li->{station} = $sta->{sta};
$li->{starttime} = $sta->{starttime};
$li->{endtime} = $sta->{endtime};
my $is_data = $self->{'bud_reader'}->init($li);
Hope anyone knows?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.