Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: Need help to build a framework

by einhverfr (Pilgrim)
on Feb 25, 2014 at 08:29 UTC ( #1076106=note: print w/ replies, xml ) Need Help??


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

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.


Comment on Re^3: Need help to build a framework
Download Code
Re^4: Need help to build a framework
by sriram83.life (Acolyte) on Feb 25, 2014 at 19:06 UTC

    Thanks einhverfr

    My requirement has changed a bit.Now,the input to the framework is:

    1.an extracted location of a tar file.

    2.type of Installer technology using which script will crack the binaries and extract the evidences.The evidence can be a filename like (Websphere_Application_Server.swtag) or an installer evidence(i.e the content of a file which tells that Websphere is installed in my machine).

    output of the framework should be an xml file: that reports the file evidences the script finds and the installer evidences the script finds.

    example xml section of a string (Websphere in this case) if found,this is installer evidence using Install Anywhere technology(IA):

    <package name="Websphere Application Server" Evidence="IA" Version="6.0">

    <property publisher="ibm" </property>

    </package>

    File evidence should be something like this:

    <content>

    <property Filename="Websphere_Application_server.swtag" size=50 </property>

    </content>

      The same basic plugin approach works. You could even use dispatch tables if you needed to but I think that complicates things while defined interfaces and registered plugins works better.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1076106]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2014-11-23 17:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (134 votes), past polls