Leo Charre > FileArchiveIndexer-1.29 > FileArchiveIndexer::WUI::Base

Download:
FileArchiveIndexer-1.29.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 1.03   Source  

SYNOPSIS ^

   use FileArchiveIndexer::WUI::Base;

NOT METHODS ^

_tmpl_default_fai_status()

returns default template code

_tmpl_default_fai_search()

_tmpl_default_fai_search_results()

METHODS ^

_set_vars_fai_status()

set variables to later inject See CGI::Application::Plugin::TmplInnerOuter

fai()

returns FileArchiveIndexer api object

_fai_search_results_text()

optional argument is param name to look inside default param name is 'search_text' returns undef if none.

See "Building A Search Results Runmode"

Building A Search Results Runmode

   sub fai_search_results : Runmode {
      my $self = shift; 
      
      $self->_fai_search_results_text('search_text') or die('user did not enter search text'); # search_text is the default
      # or
      $self->_fai_search_results_text() or die('user did not enter search text');

      $self->fai->execute($search_text);

      $self->fai->results_count;

      $self->fai->results_files;

      foreach my $abs_found ( $self->fai->results_files ){
         
         my $matches = $self->fai->result($abs_found);

         # "You found $abs_found";
         # "inside that file are the following matches to your search for $search_text;
         
         for (@$matches){
            my($page_number, $line_number, $content_matched ) = @$_;
            # "page num : $page_number, line num : $line_number, content: $content_matched"
         }
   
      }

_get_result_hits_loop()

argument is abs path of the file found, returns array ref suitable as an HTML::Template loop.

   my @RESULTS;
   
   foreach my $abs_found ( $self->fai->results_files ){
      
      my resultloop = $self->_get_result_hits_loop( $abs_found );

      push @RESULTS, {
         RESULT_ABS_FOUND => $abs_found,
         RESULT_HITS => $resultloop,
      };      
   }

   $tmpl->param( RESULTS => \@RESULTS );

This would be suitable for:

      <ul>
           <TMPL_LOOP RESULTS>
            <li>
               <b><TMPL_VAR  RESULT_ABS_FOUND></b>
              <ul>
             <TMPL_LOOP RESULT_HITS><li><small>page <TMPL_VAR PAGE_NUMBER>, line <TMPL_VAR LINE_NUMBER>, content </small><br><code><TMPL_VAR CONTENT></code></li></TMPL_LOOP>
         </ul>
            </li>
           </TMPL_LOOP>
           </ul>        

_set_vars_fai_search_results()

sets vars :

   FAI_SEARCH_RESULTS_COUNT
   FAI_SEARCH_RESULTS_TEXT