$plugin = 'foo'; if ( -e $plugin . ".pm" ) { #load plugin, import it into main scope. my $fileContents = &readFile( $plugin . ".pm" ); eval( $fileContents ); if ( $@ ) { handlePluginLoadError($@); exit; } # The following three functions _MUST_ be defined # by the plugin which has been loaded. Could test # they are present via symbol table introspection # to be sure, I guess. &pluginInit( "foo" ); &pluginProcess( "bar" ); &pluginTerminae( "baz" ); # Unload those functions so that they may be # reloaded without duplication warnings undef( &pluginInit ); undef( &pluginProcess ); undef( &pluginTerminate ); }