From: Chris W. <la...@us...> - 2005-10-31 02:33:17
|
Update of /cvsroot/openinteract/OpenInteract2/pkg/system_doc/OpenInteract2/Action In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24747/OpenInteract2/Action Modified Files: SystemDoc.pm Log Message: ensure that we're able to find all pod (even if it's not in a PM); also don't use command-line perldoc Index: SystemDoc.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/pkg/system_doc/OpenInteract2/Action/SystemDoc.pm,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** SystemDoc.pm 23 Sep 2005 05:00:55 -0000 1.16 --- SystemDoc.pm 31 Oct 2005 02:33:07 -0000 1.17 *************** *** 72,92 **** sub display { my ( $self ) = @_; $log ||= get_logger( LOG_APP ); - unless ( keys %POD_CACHE ) { - $self->_read_classpath(); - } my $module = $self->param( 'module' ) || CTX->request->param( 'module' ); ! my $pod_file = $POD_CACHE{ $module }; ! # Yuck -- running perldoc like this stinks: don't use it unless we ! # have to... ! # unless ( $pod_file ) { ! # $pod_file = `perldoc -l $module`; ! # chomp $pod_file; ! # } my ( $content ); --- 72,107 ---- + my $DISPLAY_INITIALIZED = 0; + sub display { my ( $self ) = @_; $log ||= get_logger( LOG_APP ); my $module = $self->param( 'module' ) || CTX->request->param( 'module' ); ! unless ( $DISPLAY_INITIALIZED ) { ! eval "require Pod::Perldoc"; ! if ( $@ ) { ! return "Sorry, cannot display module without Pod::Perldoc " . ! "installed."; ! } ! unless ( Pod::Perldoc->can( 'grand_search_init' ) ) { ! return "Sorry, cannot display module without a recent " . ! "version of Pod::Perldoc. (Where 'recent' means " . ! "'since 2002'."; ! } ! $DISPLAY_INITIALIZED++; ! } ! # NOTE: This is an undocumented use found by reading the ! # Pod::Perldoc source; if you just call $pod->process() it'll ! # print to STDOUT the file you're interested in rather than ! # returning it... ! ! ! my $pod = Pod::Perldoc->new(); ! my ( $pod_file ) = $pod->grand_search_init( [ $module ] ); ! $log->is_info && ! $log->info( "Found POD file '$pod_file' for module '$module'" ); my ( $content ); *************** *** 102,106 **** my $title = $self->_msg( 'sys_doc.module.doc_title', $module ); return $self->generate_content({ ! content => $content, title => $title }); } --- 117,121 ---- my $title = $self->_msg( 'sys_doc.module.doc_title', $module ); return $self->generate_content({ ! content => $content, title => $title, pod_file => $pod_file, }); } *************** *** 254,257 **** --- 269,277 ---- display title and other information on the listing page. + =head1 SEE ALSO + + L<Pod::Perldoc> - We use an undocumented method of this to find the + location of the requested POD. + =head1 COPYRIGHT |