summaryrefslogtreecommitdiff
path: root/os2
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>2001-06-25 01:04:32 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2001-06-25 13:47:46 +0000
commita748068be2c38e44d50f5be3887c9245f054c10b (patch)
treecdaee1c74a305af472ab5e03a6b92a5b244efd41 /os2
parent9fed8b87f0e66c26a1acaf42431d99e8f98aed9b (diff)
downloadperl-a748068be2c38e44d50f5be3887c9245f054c10b.tar.gz
Re: [PATCH 5.6.1] OS2::DLL
Message-ID: <20010625050432.A24128@math.ohio-state.edu> p4raw-id: //depot/perl@10918
Diffstat (limited to 'os2')
-rw-r--r--os2/OS2/REXX/DLL/DLL.pm21
1 files changed, 20 insertions, 1 deletions
diff --git a/os2/OS2/REXX/DLL/DLL.pm b/os2/OS2/REXX/DLL/DLL.pm
index 7e54371973..b1503a6992 100644
--- a/os2/OS2/REXX/DLL/DLL.pm
+++ b/os2/OS2/REXX/DLL/DLL.pm
@@ -22,6 +22,17 @@ sub AUTOLOAD {
# Cannot autoload, the autoloader is used for the REXX functions.
+sub new {
+ confess 'Usage: OS2::DLL->new( <file> [<dirs>] )' unless @_ >= 2;
+ my ($class, $file) = (shift, shift);
+ my $handle;
+ $handle = $class->load($file, @_) and return $handle;
+ my $path = @_ ? " from '@_'" : '';
+ my $err = DynaLoader::dl_error();
+ $err =~ s/\s+at\s+\S+\s+line\s+\S+\s*\z//;
+ croak "Can't load '$file'$path: $err";
+}
+
sub load
{
confess 'Usage: load OS2::DLL <file> [<dirs>]' unless $#_ >= 1;
@@ -108,7 +119,15 @@ is performed in default DLL path (without adding paths and extensions).
The DLL is not unloaded when the variable dies.
-Returns DLL object reference, or undef on failure.
+Returns DLL object reference, or undef on failure (in this case one can
+get the reason via C<DynaLoader::dl_error()>).
+
+=head2 Create a REXX DLL handle
+
+ $dll = OS2::DLL->new( NAME [, WHERE] );
+
+Same as L<C<load>|Load REXX DLL>, but croaks with a meaningful message on
+failure.
=head2 Check for functions (optional):