From 5b9038d290ea706211e0cf406840758584532ad0 Mon Sep 17 00:00:00 2001 From: dbs Date: Tue, 1 Mar 2011 22:27:03 +0000 Subject: [PATCH] Remove dead code: OpenILS::WWW::Web and OpenILS::WWW::Method modules git-svn-id: svn://svn.open-ils.org/ILS/trunk@19554 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/MANIFEST | 2 - .../src/perlmods/lib/OpenILS/WWW/Method.pm.in | 161 ------------------ .../src/perlmods/lib/OpenILS/WWW/Web.pm.in | 102 ----------- Open-ILS/src/perlmods/t/15-OpenILS-WWW.t | 4 +- configure.ac | 2 - 5 files changed, 1 insertion(+), 270 deletions(-) delete mode 100644 Open-ILS/src/perlmods/lib/OpenILS/WWW/Method.pm.in delete mode 100644 Open-ILS/src/perlmods/lib/OpenILS/WWW/Web.pm.in diff --git a/Open-ILS/src/perlmods/MANIFEST b/Open-ILS/src/perlmods/MANIFEST index fc0ec787e8..3641b6fb71 100644 --- a/Open-ILS/src/perlmods/MANIFEST +++ b/Open-ILS/src/perlmods/MANIFEST @@ -162,7 +162,6 @@ lib/OpenILS/WWW/BadDebt.pm lib/OpenILS/WWW/EGWeb.pm lib/OpenILS/WWW/Exporter.pm lib/OpenILS/WWW/IDL2js.pm -lib/OpenILS/WWW/Method.pm lib/OpenILS/WWW/PasswordReset.pm lib/OpenILS/WWW/Proxy.pm lib/OpenILS/WWW/Redirect.pm @@ -172,6 +171,5 @@ lib/OpenILS/WWW/SuperCat.pm lib/OpenILS/WWW/SuperCat/Feed.pm lib/OpenILS/WWW/TemplateBatchBibUpdate.pm lib/OpenILS/WWW/Vandelay.pm -lib/OpenILS/WWW/Web.pm lib/OpenILS/WWW/XMLRPCGateway.pm MANIFEST This list of files diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Method.pm.in b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Method.pm.in deleted file mode 100644 index 3bec97c5d1..0000000000 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Method.pm.in +++ /dev/null @@ -1,161 +0,0 @@ -package OpenILS::WWW::Method; -use strict; use warnings; - -use Apache2::Log; -use Apache2::Const -compile => qw(OK REDIRECT :log); -use APR::Const -compile => qw(:error SUCCESS); -use Apache2::RequestRec (); -use Apache2::RequestIO (); -use Apache2::RequestUtil; - -use OpenSRF::Utils::JSON; - -use CGI (); - -use OpenSRF::EX qw(:try); -use OpenSRF::System; - -my %session_hash; - -use constant MAX_SESSION_REQUESTS => 20; - -sub handler { - - use Data::Dumper; - - - my $apache = shift; - my $cgi = CGI->new( $apache ); - - print "Content-type: text/plain; charset=utf-8\n\n"; - #print $cgi->header; - - my @p = $cgi->param(); - warn "Params: " . Dumper(\@p); - - my $method = $cgi->param("method"); - my $service = $cgi->param("service"); - - my $err = undef; - - if( ! $service || ! $method ) { - $err = { - is_err => 1, - err_msg => "Service name and method name required to fulfill request", - }; - } - - if($err) { - print OpenSRF::Utils::JSON->perl2JSON($err); - return Apache2::Const::OK; - } - - my @param_array; - my %param_hash; - - warn "here\n"; - - if(defined($cgi->param("param"))) { - for my $param ( $cgi->param("param")) { - push( @param_array, OpenSRF::Utils::JSON->JSON2perl( $param )); - } - } else { - for my $param ($cgi->param()) { - $param_hash{$param} = OpenSRF::Utils::JSON->JSON2perl($cgi->param($param)) - unless( $param eq "method" or $param eq "service" ); - } - } - - - if( @param_array ) { - perform_method($service, $method, @param_array); - } else { - perform_method($service, $method, %param_hash); - } - - return Apache2::Const::OK; -} - -sub child_init_handler { - OpenSRF::System->bootstrap_client( - config_file => "@sysconfdir@/opensrf_core.xml" ); -} - - -sub perform_method { - - my ($service, $method, @params) = @_; - - warn "performing method $method for service $service with params @params\n"; - - my $session; - - if($session_hash{$service} ) { - - $session = $session_hash{$service}; - $session->{web_count} += 1; - - if( $session->{web_count} > MAX_SESSION_REQUESTS) { - $session->disconnect(); - $session->{web_count} = 1; - } - - } else { - - $session = OpenSRF::AppSession->create($service); - $session_hash{$service} = $session; - $session->{web_count} = 1; - - } - - my $request = $session->request( $method, @params ); - - my @results; - while( my $response = $request->recv(20) ) { - - if( UNIVERSAL::isa( $response, "Error" )) { - warn "Received exception: " . $response->stringify . "\n"; - my $err = { - is_err => 1, - err_msg => "Error Completing Request:\n " . - "Service: $service \nMethod: $method \nParams: @params \n" . - $response->stringify() . "\n", - }; - print OpenSRF::Utils::JSON->perl2JSON($err); - $request->finish(); - return 0; - } - - my $content = $response->content; - push @results, $content; - } - - - if(!$request->complete) { - warn "ERROR Completing Request"; - my $err = { - is_err => 1, - err_msg => "Error Completing Request:\n ". - "Service: $service \nMethod: $method \nParams: @params \n" . - "request->complete test failed in OpenILS::Web::Method\n" - }; - print OpenSRF::Utils::JSON->perl2JSON($err); - $request->finish(); - return 0; - } - - $request->finish(); - $session->finish(); - - warn "Results: \n"; - warn Dumper \@results; - - print OpenSRF::Utils::JSON->perl2JSON( \@results ); - - return 1; -} - -# This module appears unfinshed and/or obsolete with many unconditional warns/dumps. -# File is not referenced elsewhere in the codebase. Candidate for deletion. - -1; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Web.pm.in b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Web.pm.in deleted file mode 100644 index 4087b09b79..0000000000 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Web.pm.in +++ /dev/null @@ -1,102 +0,0 @@ -package OpenILS::WWW::Web; -use strict; -use warnings; - -use Apache2::Log; -use Apache2::Const -compile => qw(OK REDIRECT :log); -use APR::Const -compile => qw(:error SUCCESS); -use Apache2::RequestRec (); -use Apache2::RequestIO (); -use Apache2::RequestUtil; - -#use CGI (); -use Template; - -use OpenSRF::EX qw(:try); -use OpenSRF::System; - -my $main_ttk = "opac/logic/page_router.ttk"; -my $error_ttk = "opac/pages/error.ttk"; -my $init_ttk = "opac/logic/page_init.ttk"; -my $bootstrap = "@sysconfdir@/opensrf_core.xml"; -my $child_init_ttk = "opac/logic/child_init.ttk"; - -my $includes = []; # [ '/pines/cvs/ILS/Open-ILS/src/templates' ]; - -sub import { - my ( $self, $tdir ) = @_; - $includes = [$tdir]; -} - -my $plugin_base = 'OpenILS::Template::Plugin'; - -sub handler { - - my $apache = shift; - print "Content-type: text/html; charset=utf-8\n\n"; - - _process_template( - apache => $apache, - template => $main_ttk, - pre_process => $init_ttk - ); - - return Apache2::Const::OK; -} - -sub child_init_handler { - _process_template( template => $child_init_ttk ); -} - -sub _process_template { - - my %params = @_; - my $ttk = $params{template} || return undef; - my $apache = $params{apache} || undef; - my $pre_process = $params{pre_process} || undef; - my $param_hash = $params{params} || {}; - - my $template; - - $template = Template->new( - { - OUTPUT => $apache, - ABSOLUTE => 1, - RELATIVE => 1, - PLUGIN_BASE => $plugin_base, - PRE_PROCESS => $pre_process, - INCLUDE_PATH => $includes, - PRE_CHOMP => 1, - POST_CHOMP => 1, - } - ); - - try { - - if ( !$template->process( $ttk, $param_hash ) ) { - warn "Error Occured: " . $template->error(); - my $err = $template->error(); - $err =~ s/\n/\/g; - warn "Error processing template $ttk\n"; - my $string = - "
Unable to process template:

" - . $err - . "!!!
"; - $template->process( $error_ttk, { error => $string } ); - } - - } - catch Error with { - my $e = shift; - warn "Error processing template $ttk: $e - $@ \n"; - print "


Error

$e

$@

"; - return; - }; - -} - -# This module appears obsolete (probably superceded by EGWeb.pm -# The template files it references do not exist in the codebase. -# File is not referenced elsewhere in the codebase. Candidate for deletion. - -1; diff --git a/Open-ILS/src/perlmods/t/15-OpenILS-WWW.t b/Open-ILS/src/perlmods/t/15-OpenILS-WWW.t index d22c3b0b4d..355449b9e8 100644 --- a/Open-ILS/src/perlmods/t/15-OpenILS-WWW.t +++ b/Open-ILS/src/perlmods/t/15-OpenILS-WWW.t @@ -1,16 +1,14 @@ #!perl -T -use Test::More tests => 12; +use Test::More tests => 10; use_ok( 'OpenILS::WWW::BadDebt' ); use_ok( 'OpenILS::WWW::EGWeb' ); use_ok( 'OpenILS::WWW::Exporter' ); use_ok( 'OpenILS::WWW::IDL2js' ); -use_ok( 'OpenILS::WWW::Method' ); use_ok( 'OpenILS::WWW::PasswordReset' ); use_ok( 'OpenILS::WWW::Proxy' ); use_ok( 'OpenILS::WWW::Redirect' ); use_ok( 'OpenILS::WWW::TemplateBatchBibUpdate' ); use_ok( 'OpenILS::WWW::Vandelay' ); -use_ok( 'OpenILS::WWW::Web' ); use_ok( 'OpenILS::WWW::XMLRPCGateway' ); diff --git a/configure.ac b/configure.ac index 329203ee54..88a84dceeb 100644 --- a/configure.ac +++ b/configure.ac @@ -375,8 +375,6 @@ AC_CONFIG_FILES([Makefile Open-ILS/src/extras/eg_config Open-ILS/src/extras/fast-extract Open-ILS/src/perlmods/Makefile - Open-ILS/src/perlmods/lib/OpenILS/WWW/Method.pm - Open-ILS/src/perlmods/lib/OpenILS/WWW/Web.pm Open-ILS/src/perlmods/lib/OpenILS/Utils/Cronscript.pm], [ if test -e "./Open-ILS/src/extras/eg_config"; then chmod 755 Open-ILS/src/extras/eg_config; fi; -- 2.43.2