OK well, I figured out a solution that is congruent with HTML template side of things, but I'm still unable to access the search array of @files. It's almost as it's unable to search via the CGI request ...
Oh well, here's the updated code

sub _update_realtime_radial_file_list { my $self = shift; my $stations = shift; # deconstruct $stations and rebuild into arrays my (@ids,@codenames); foreach my $station (@{$stations}) { push @ids, $station->{id}; push @codenames, $station->{codename}; } # remote host my $hostname = 'xxx.xxx.xxx.xxx'; my $username = 'xxxxx'; my $password = 'xxxxxxxxxxx'; my $Dbase = '/data/archive/real-time/staging/radial'; # time my ($sc,$mn,$hr,$md,$mo,$yr,$wd,$yd,$id) = localtime(time); $yr += + 1900; $mo += 1; my $now = sprintf('%4d-%02d-%02d %02d:%02d:%02d',$yr,$mo,$md,$hr,$ +mn,$sc); # connect use Net::SFTP::Foreign; my $sftp = Net::SFTP::Foreign->new( $hostname , user => $username +, password => $password ) or fatal_error($!); # search my @latestfiles = (); my $flatest; foreach my $station ( @{$stations} ) { my $Dsearch = $Dbase.'/'. $station->{codename}.'/'.$yr; my @files = $sftp->find( $Dsearch , wanted => sub{ use Fcntl qw(S_ISREG); my $now = time(); my $yesterday = $now-(24*3 +600); my (undef, $entry) = @_; ( ($entry->{a}->mtime < $now) a +nd ($entry->{a}->mtime > $yesterday) and S_ISREG($entry->{a}->perm) ) } ); $flatest = $_->{filename} for $files[-1]; push @latestfiles, $flatest; } # create table output my @table_data = (); while ( @ids and @codenames and @latestfiles ) { my %row_data; $row_data{id} = shift @ids; $row_data{codename} = shift @codenames; $row_data{flatest} = shift @latestfiles; push @table_data, \%row_data; } # TEMPLIFY! my $template = $self->load_tmpl('show_radial_file_status.tmpl'); $template->param( title => "Latest Files on ACORN Server", now => $now, hostname => $hostname, table => \@table_data, ); $sftp->disconnect; return $template->output(); }

which results in:
There has been an error: Modification of non-creatable array value attempted, subscript -1 at /users/dpath2o/sites/simple_secure/simple_realtime/simple_realtime.pm line 172.


In reply to Re^2: CGI Dynamic Query by dpath2o
in thread CGI Dynamic Query by dpath2o

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.