Haven't seen much info on this. Basically I am nested several functions that will return a final result. Any consequences of doing it this way? Performance?
I have not see any examples like so. I understand perl is flexible. But in many cases 'flexible' doesn't mean correct.
Example:
my $ord = "asc"
my $col = "name";
my ( $pages, $links, $new_data ) = generate_results( sort_data( $ord, $col, get_db_data($id) ) );
sub get_db_data {
my $id = shift;
my $data;
....... query data ......
return $data;
}
sub sort_data {
my ( $ord, $col, $data ) = @_;
....... sort action ......
return $data;
}
sub generate_results {
my $data = shift;
my ( $pages, $links, $new_data );
....... generate per page info ......
return ( $pages, $links, $new_data );
}
I have not see any examples like so. I understand perl is flexible. But in many cases 'flexible' doesn't mean correct.
Example:
my $ord = "asc"
my $col = "name";
my ( $pages, $links, $new_data ) = generate_results( sort_data( $ord, $col, get_db_data($id) ) );
sub get_db_data {
my $id = shift;
my $data;
....... query data ......
return $data;
}
sub sort_data {
my ( $ord, $col, $data ) = @_;
....... sort action ......
return $data;
}
sub generate_results {
my $data = shift;
my ( $pages, $links, $new_data );
....... generate per page info ......
return ( $pages, $links, $new_data );
}