S
sopan.shewale
I need help to make following code better, the current one looks
little odd...
-----------
my $query = new App::Request(); ##similar to Catalyst::Request
my @uploads_objs = ();
my @filenames = ();
for ( 0 .. 9 ) {
if ( $_ == 0 ) {
if ( defined $query->{uploads}{ $query-
$query->{uploads}{ $query->param('filepath') };
push @filenames, $query->param('filepath');
}
}
else {
if ( defined $query->{uploads}{ $query-
push @upload_objs,
$query->{uploads}{ $query->param( 'filepath' .
$_ ) };
push @filenames, $query->param( 'filepath' . $_ );
}
}
}
-----------
do you think i should define local variables to reduce number of lines/
chars in above code?
Thanks,
little odd...
-----------
my $query = new App::Request(); ##similar to Catalyst::Request
my @uploads_objs = ();
my @filenames = ();
for ( 0 .. 9 ) {
if ( $_ == 0 ) {
if ( defined $query->{uploads}{ $query-
push @upload_objs,param('filepath') } ) {
$query->{uploads}{ $query->param('filepath') };
push @filenames, $query->param('filepath');
}
}
else {
if ( defined $query->{uploads}{ $query-
{param( 'filepath' . $_ ) } )
push @upload_objs,
$query->{uploads}{ $query->param( 'filepath' .
$_ ) };
push @filenames, $query->param( 'filepath' . $_ );
}
}
}
-----------
do you think i should define local variables to reduce number of lines/
chars in above code?
Thanks,