Ignore:
Timestamp:
2006-04-21T15:19:32+12:00 (18 years ago)
Author:
kjdon
Message:

changed how it loads secondary plugins - now uses eval. did this cos otherwise you get a syntax error when running pluginfo.pl -describeall

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugins/ConvertToPlug.pm

    r11090 r11680  
    4141use strict;
    4242no strict 'refs'; # allow filehandles to be variables and viceversa
    43 
     43no strict 'subs';
    4444sub BEGIN {
    4545    @ConvertToPlug::ISA = ('BasPlug');
     
    100100    my @convert_to_list = split(",",$self->{'convert_to'});
    101101    my $secondary_plugins = {};
     102    # find the plugin
    102103
    103104    foreach my $convert_to (@convert_to_list) {
     
    106107    my $plugin_package = $plugin_class.".pm";
    107108
    108     require $plugin_package;
     109    my $colplugname = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},
     110                          "perllib/plugins",
     111                          $plugin_package);
     112    my $mainplugname = &util::filename_cat($ENV{'GSDLHOME'},
     113                           "perllib/plugins",
     114                           $plugin_package);
     115
     116    if (-e $colplugname) {require $colplugname;}
     117    elsif (-e $mainplugname) { require $mainplugname; }
     118    else {
     119        &gsprintf(STDERR, "{plugin.could_not_find_plugin}\n",
     120              $plugin_class);
     121        die "\n";
     122    }
    109123
    110124    # call its constructor with extra options that we've worked out!
    111125    my $arglist = $input_args->{$plugin_class};
    112 #   my $secondary_plugin = new $plugin_class([],$arglist, $hashArgOptLists);
    113     # secondary plugins don';t need to know their calling plugin's options
    114     my $secondary_plugin = new $plugin_class([],$arglist);
     126
     127    my ($secondary_plugin);
     128    eval("\$secondary_plugin = new $plugin_class([],\$arglist)");
     129    die "$@" if $@;
    115130    $secondary_plugins->{$plugin_class} = $secondary_plugin;
    116131    }
     
    128143    my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
    129144   
     145    if ($self->{'info_only'}) {
     146    # don't worry about any options etc
     147    return bless $self, $class;
     148    }
     149
    130150    my $convert_to_type = $self->{'convert_to'};
    131151    if (!defined $convert_to_type || $convert_to_type eq "") {
Note: See TracChangeset for help on using the changeset viewer.