Data::ResultsHelper

Perl module to helps sort, paginate and display results sets
Download

Data::ResultsHelper Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Earl Cahill
  • Publisher web site:
  • http://search.cpan.org/~earl/

Data::ResultsHelper Tags


Data::ResultsHelper Description

Perl module to helps sort, paginate and display results sets Data::ResultsHelper is a Perl module written to help display results that can be thought of as an array of arrays.Developer commentsI call the structure results. Examples abound, and the more I work with it, the more I see examples. Search results, stock ticker quotes, email message summaries, a directory listing, sql query results, this and so much more! Data::ResultsHelper takes the results and changes them into a nicely organized hash ref, which can then be outputted using Template::Toolkit or the like.EXAMPLE In the below example, I sub-class the Data::ResultsHelper::HTML. Data::ResultsHelper is general enough that results could be outputted in any number of ways: a csv file, XML, etc. Please consult the Data::ResultsHelper::HTML perldoc for more information. I simply write a generate_results method which sets $self->{results}. If $self->{set_cookie} is true, I attempt to cache result sets. In that case, generate_results would only be called to generate fresh results. #!/usr/bin/perl -w use strict; { my $self = Helper->new({ results_dir => '/tmp/stuff', }); print "Content-type: text/html\n\n"; print $self->results2html; } package Helper; use strict; use Data::ResultsHelper::HTML; use base qw(Data::ResultsHelper::HTML); sub generate_results { my $self = shift; my $dir = shift || $self->{results_dir}; my $results = , ]; require File::Find; File::Find::find(sub { my $fullpath = $File::Find::name = $File::Find::name; my $dir = $File::Find::dir; my @stat = stat $fullpath; return if($fullpath =~ /^\.\.?$/); return if(-d _); push @{$results}, , $stat]; }, $dir); $self->{results} = $results; } Requirements: · Perl


Data::ResultsHelper Related Software