diff options
Diffstat (limited to 'perl-install/c.pm')
| -rw-r--r-- | perl-install/c.pm | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/perl-install/c.pm b/perl-install/c.pm index 0683c0ef8..8312c0d79 100644 --- a/perl-install/c.pm +++ b/perl-install/c.pm @@ -1,12 +1,48 @@ -package c; # $Id$ +package c; use vars qw($AUTOLOAD); use c::stuff; +use MDK::Common; -sub AUTOLOAD { - $AUTOLOAD =~ /::(.*)/; - goto &{$c::stuff::{$1}}; +sub AUTOLOAD() { + $AUTOLOAD =~ /::(.*)/ or return; + my $fct = $1; + my @l = eval { &{$c::stuff::{$fct}} }; + if (my $err = $@) { + $err =~ /Undefined subroutine &main::/ ? + die("cannot find function $AUTOLOAD\n" . backtrace()) : + die("$fct: " . $err); + } + wantarray() ? @l : $l[0]; } 1; + + +=head1 SYNOPSYS + +The C module is glue code between the Perl & the C worlds that enable drakx to: + +=over + +=item * + +access various C libraries, mainly libldetect + +=item * + +bind some C functions (eg: syslog(), ...) + +=item * + +implement in C some helper functions + +=back + +It is autogenerated from perl-install/c/stuff.xs.pl. +One needs to run "perl Makefile.PL" + +It's used quite a lot by L<detect_devices>. + +=cut |
