in reply to Re^3: Bundling a module with a distribution
in thread Bundling a module with a distribution (cross-platform)

Devel::UseAnyFunc, which Clone::Any depends on, uses eval { require $pm } to check for available modules. It does not check whether the call of the clone function succeeds.

Yup; I basically assumed that if the module is installed, it will work.

The code for Devel::UseAnyFunc is fairly simple, so you could build your own version of it that also did this extra check before deciding which function to import.

  • Comment on Re^4: Bundling a module with a distribution

Replies are listed 'Best First'.
Re^5: Bundling a module with a distribution
by anjoschu (Sexton) on Jan 03, 2005 at 09:29 UTC

    The code snippet you sent me does exactly what I wanted. Assuming your permission, I'm posting it here for all to see.

    if ( eval { require Clone; Clone::clone( "testdata" ); 1 } ) { eval "use Clone qw( clone );" } else { eval "use Clone::PP qw( clone );" }

    Thanks to all and particularly to simonm for their help! This has indeed been a warm welcome to perlmonks.