The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

autodynaload - Dynamically locate shared objects on your system

SYNOPSIS

  use autodynaload sub {
    my ($this, $f) = @_ ;
    if ($f eq 'some_object'){
      return "/path/to/some_object.so" ;
    }
    return undef ;
  } ;

DESCRIPTION

autodynaload allows you to specify the location of a shared object at runtime. It does so by overriding the proper DynaLoader methods and allowing for handlers to be registered.

The subroutine argument can be either a coderef or scalar value, in which case it will be used as a symbolic reference. Note: no error will be generated if the symbolic reference does not resolve. This allows a handler to "kick in" at later time when the subroutine in question is actually defined.

The subroutine must return the absolute path to the shared object. A return value of undef will pass control to the next handler (either a previous autodynaload handler or DynaLoader's default mechanism).

CONSTRUCTOR

new ( HANDLER )

Creates a new autodynaload object that will call HANDLER when invoked. For it to be of any use you must place the object in the proper array (in this case the @autodynaload::INC array) using the insert method.

METHODS

Note: autodynaload extends autorequire. See autorequire for methods not documented here.

$ar->insert( POS )

See "insert" in autorequire. In this case the array will be @autodynaload::INC.

$ar->delete ()

See "delete" in autorequire. In this case the array will be @autodynaload::INC.

autodynaload->is_loaded( FILENAME )

Convenience method that returns the absolute path of FILENAME if the shared object FILENAME is found in the @DynaLoader::dl_shared_objects array. Returns undef is the shared object is not loaded.

autodynaload->is_installed( FILENAME )

Convenience method that returns the absolute path of FILENAME if the shared object FILENAME is installed on the system. It does this using the ExtUtils::Installed module. Please that this method is somewhat slow.

SEE ALSO

DynaLoader, autorequire.

AUTHOR

Patrick LeBoutillier, <patl@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2005 by Patrick LeBoutillier

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.