in reply to Re: Need help to build a framework
in thread Need help to build a framework

Hi Dave,

Thanks for the reply.I wrote the main script.But, i am stuck on how to call plugin scripts from the main script and collect the extracted data and logging information from plugin script and dump it in the main script log file.

Regards,

Sriram

Replies are listed 'Best First'.
Re^3: Need help to build a framework
by Laurent_R (Canon) on Feb 24, 2014 at 17:49 UTC
    Hmm, have you used modules before? Have you written some modules (including for your private use)?
      No Laurent. That is why,i am stuck how to write this framework. Recursively how can i extract .jar, .ear,.tar etc.. and find files that i need.I need to automatically extract jar and ears inside tars as well.

      sriram

        To start with you may want to have a thorough look to the documentation on modules, for example this: http://perldoc.perl.org/perlmod.html. Then you will need to go to the CPAN and look for existing modules that can take care of the various formats you need to handle.
Re^3: Need help to build a framework
by einhverfr (Friar) on Feb 25, 2014 at 08:29 UTC

    I did something like this back in 5.6 that required some really funky workarounds. Today I would recommend the following approach (what I did with PGObject's registered type system).

    1. You have a module private (lexically scoped) hash variable connecting an extension to a plugin class name.
    2. You specify an interface for that plugin. We could call it extract_files().
    3. You call it somehow like this:
      "$plugin_registry->{$extension}"->can('extract_files')->($path);

    This approach allows you to add whatever extensions you want and have them register themselves (through an API) which can check for the extract_files interface and add to the registry.

    A reply falls below the community's threshold of quality. You may see it by logging in.