[1] | 1 | package Mindi::DiskSize;
|
---|
| 2 |
|
---|
| 3 | use 5.006;
|
---|
| 4 | use strict;
|
---|
| 5 | use warnings;
|
---|
| 6 | use Carp;
|
---|
| 7 |
|
---|
| 8 | require Exporter;
|
---|
| 9 | require DynaLoader;
|
---|
| 10 | use AutoLoader;
|
---|
| 11 |
|
---|
| 12 | our @ISA = qw(Exporter DynaLoader);
|
---|
| 13 |
|
---|
| 14 | # Items to export into callers namespace by default. Note: do not export
|
---|
| 15 | # names by default without a very good reason. Use EXPORT_OK instead.
|
---|
| 16 | # Do not simply export all your public functions/methods/constants.
|
---|
| 17 |
|
---|
| 18 | # This allows declaration use Mindi::DiskSize ':all';
|
---|
| 19 | # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
|
---|
| 20 | # will save memory.
|
---|
| 21 | our %EXPORT_TAGS = ( 'all' => [ qw(
|
---|
| 22 | get_size_of_disk
|
---|
| 23 | ) ] );
|
---|
| 24 |
|
---|
| 25 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
|
---|
| 26 |
|
---|
| 27 | our @EXPORT = qw(
|
---|
| 28 |
|
---|
| 29 | );
|
---|
| 30 | our $VERSION = '1.00';
|
---|
| 31 |
|
---|
| 32 | sub AUTOLOAD {
|
---|
| 33 | # This AUTOLOAD is used to 'autoload' constants from the constant()
|
---|
| 34 | # XS function. If a constant is not found then control is passed
|
---|
| 35 | # to the AUTOLOAD in AutoLoader.
|
---|
| 36 |
|
---|
| 37 | my $constname;
|
---|
| 38 | our $AUTOLOAD;
|
---|
| 39 | ($constname = $AUTOLOAD) =~ s/.*:://;
|
---|
| 40 | croak "& not defined" if $constname eq 'constant';
|
---|
| 41 | my $val = constant($constname, @_ ? $_[0] : 0);
|
---|
| 42 | if ($! != 0) {
|
---|
| 43 | if ($! =~ /Invalid/ || $!{EINVAL}) {
|
---|
| 44 | $AutoLoader::AUTOLOAD = $AUTOLOAD;
|
---|
| 45 | goto &AutoLoader::AUTOLOAD;
|
---|
| 46 | }
|
---|
| 47 | else {
|
---|
| 48 | croak "Your vendor has not defined Mindi::DiskSize macro $constname";
|
---|
| 49 | }
|
---|
| 50 | }
|
---|
| 51 | {
|
---|
| 52 | no strict 'refs';
|
---|
| 53 | # Fixed between 5.005_53 and 5.005_61
|
---|
| 54 | if ($] >= 5.00561) {
|
---|
| 55 | *$AUTOLOAD = sub () { $val };
|
---|
| 56 | }
|
---|
| 57 | else {
|
---|
| 58 | *$AUTOLOAD = sub { $val };
|
---|
| 59 | }
|
---|
| 60 | }
|
---|
| 61 | goto &$AUTOLOAD;
|
---|
| 62 | }
|
---|
| 63 |
|
---|
| 64 | bootstrap Mindi::DiskSize $VERSION;
|
---|
| 65 |
|
---|
| 66 | # Preloaded methods go here.
|
---|
| 67 |
|
---|
| 68 | # Autoload methods go after =cut, and are processed by the autosplit program.
|
---|
| 69 |
|
---|
| 70 | 1;
|
---|
| 71 | __END__
|
---|
| 72 |
|
---|