From a5905f1c8212d1c0247406c147d7038df9654d21 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 8 Aug 2012 14:26:31 -0400 Subject: [PATCH] Move Fieldmapper API call to Application.pm Move export of opensrf.open-ils.system.fieldmapper API call from Fieldmapper.pm into Application.pm with the rest of the shared API calls. This allows us to remove the OpenSRF::Application base from Fieldmapper, which was causing some method name collisions. For example, if a Fieldmapper object had a field called "session", which, incidentally, is also a method of OpenSRF::Application, the version from OpenSRF::Application would get called instead of the Fieldmapper version, since Fieldmapper methods are defined during AUTOLOAD. Hilarity was guaranteed to ensue. Signed-off-by: Bill Erickson --- Open-ILS/src/perlmods/lib/OpenILS/Application.pm | 14 ++++++++++++++ Open-ILS/src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm | 14 -------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application.pm index cd4dbbf9c0..2888c93918 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application.pm @@ -2,6 +2,7 @@ package OpenILS::Application; use OpenSRF::Application; use UNIVERSAL::require; use base qw/OpenSRF::Application/; +use OpenILS::Utils::Fieldmapper; sub ils_version { # version format is "x-y-z", for example "2-0-0" for Evergreen 2.0.0 @@ -25,6 +26,19 @@ sub get_idl_file { return OpenSRF::Utils::SettingsClient->new->config_value('IDL'); } +sub publish_fieldmapper { + my ($self,$client,$class) = @_; + + return $Fieldmapper::fieldmap unless (defined $class); + return undef unless (exists($$Fieldmapper::fieldmap{$class})); + return {$class => $$Fieldmapper::fieldmap{$class}}; +} +__PACKAGE__->register_method( + api_name => 'opensrf.open-ils.system.fieldmapper', + api_level => 1, + method => 'publish_fieldmapper', +); + sub register_method { my $class = shift; my %args = @_; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm index 33050fd622..709ad5caff 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm @@ -1,7 +1,6 @@ package Fieldmapper; use OpenSRF::Utils::JSON; use Data::Dumper; -use base 'OpenSRF::Application'; use OpenSRF::Utils::Logger; use OpenSRF::Utils::SettingsClient; use OpenSRF::System; @@ -12,19 +11,6 @@ my $log = 'OpenSRF::Utils::Logger'; use vars qw/$fieldmap $VERSION/; -sub publish_fieldmapper { - my ($self,$client,$class) = @_; - - return $fieldmap unless (defined $class); - return undef unless (exists($$fieldmap{$class})); - return {$class => $$fieldmap{$class}}; -} -__PACKAGE__->register_method( - api_name => 'opensrf.open-ils.system.fieldmapper', - api_level => 1, - method => 'publish_fieldmapper', -); - # # To dump the Javascript version of the fieldmapper struct use the command: # -- 2.11.0