Hi,

It isn't compulsory to 'use' Cava either.

So, if you have no 'use' statement

if ( $Cava::Packager::VERSION ) {
        my $found = Cava::Packager::GetResource( $file );
        return $found if -f $found;
   }

You can also include a 'use' statement if you wish. The Cava modules that mimic the runtime environment are Artistic License - so it doesn't matter if they get wrapped in some other packager - it just matters for your code that they don't get used functionally

use Cava::Packager qw( CRF );

...
...

if ( Cava::Packager::IsPackaged ) {
        my $found = CRF( $file );
        return $found if -f $found;
   }

It is all fairly equivalent.

I think for your usage as described in the past, any of the three packagers will suit your needs functionally with more or less effort from yourself. You can't really tell which you prefer and how much effort is involved for your particular situation until you've tried each.

Best Regards

Mark

On 15/02/2011 09:43, Johan Vromans wrote:
Mark Dootson<mark.doot...@znix.com>  writes:

It just means you don't have to keep coding ..

If (somepackager::is_packed) {
  do this;
} else {
  do that;
}

With PerlApp and PAR, I can write:

     # If we're a PerlApp, try if it's a bound file.
     if ( $PerlApp::VERSION ) {
        my $found = PerlApp::extract_bound_file($file);
        return $found if -f $found;
     }

     # If we're a PAR, try if it's an included file.
     if ( $PAR::VERSION ) {
        my $found = "$ENV{PAR_TEMP}/inc/$file";
        return $found if -f $found;
     }

Note that this does not require 'use' of any PerlApp/PAR-specific
module and that the code for PerlApp and PAR can happily co-exist.

What would be the Cava equivalent?

-- Johan

Reply via email to