package Cpanel::Easy::OptLib;

# cpanel10 - Cpanel/Easy/OptLib.pm            Copyright(c) 2005-2007 cPanel, Inc.
#                                                            All rights Reserved.
# copyright@cpanel.net                                          http://cpanel.net
# This code is subject to the cpanel license. Unauthorized copying is prohibited

use base 'Cpanel::Easy';

1;

__END__

Any where you have a Cpanel::Easy based object you can use its get_path_installed() method like this:

 my $xml2path = $easy->get_path_installed('Cpanel::Easy::OptLib::libxml2', @args); # scalar context log entry and return undef means a command failed, check logs
In array context:
  my($xml2, @text) = ...
  '/path', 'ok'
  0, @maketext 

... by simply assing it a name space that is 'get_path_installed()' aware (which all Cpanel::Easy::OptLib moduels are intended to be)

The idea is to ensure its installed and updated (installing or updating if necessary) 
and return the path for use in things like --libxml2-prefix

See 'Cpanel::Easy::OptLib::libxml2' for an example of how to do a 'get_path_installed' aware OptLib opt-module.

Note: your '@args' in the example above are passed to the opt lib's method as:

    sub path_installed {
        my ($easy_obj, @args) = @_;
        ...
        
Note: the 'command_list' array ref can contain system command array refs or coderefs that return ($boolean, @maketext_text). 

If the array ref's first item is the string ':optional:' then the commands are run but do not fail the build if they fail.

the coderef will get passed the easy object and args you passed to get_path_installed: my ($easy_obj, @args) = @_;

Note: the key 'working_path' is the tarball path relative to  $self->{'opt_mod_src_dir'}
