@@ -1,125 +0,0 @@
-# vim:ts=4:sw=4:tw=78
-# $Id$
-
-use 5.006;
-
-use strict;
-use Module::Build;
-use vars qw($build);
-use FindBin;
-use lib $FindBin::Bin . '/lib';
-
-$@ = undef;
-my @fs;
-eval {
- require Sys::Filesystem;
- my $fs = Sys::Filesystem->new();
- @fs = $fs->filesystems();
-};
-if ($@)
-{
- printf( STDERR "Can't be used ($@) - OS not supported or bad maintained?" );
- exit(0);
-}
-
-my %prereqs = (
- 'perl' => '5.008',
- 'Carp' => 0,
- 'FindBin' => 0,
- 'IO' => 0,
- 'IPC::Cmd' => '0.80',
- 'Module::Pluggable' => '4.5',
- 'Params::Util' => '1.00',
- ( $^O eq 'MSWin32' ? ( 'Win32::DriveInfo' => 0, ) : () ),
- );
-
-$build = Module::Build->new(
- module_name => 'Sys::Filesystem',
- license => 'apache',
- dist_author => 'Jens Rehsack <rehsack@cpan.org>',
- create_makefile_pl => 'passthrough',
- create_readme => 1,
- create_packlist => 1,
- sign => 0,
- configure_requires => {
- 'Module::Build' => '0.2800',
- %prereqs,
- },
- requires => \%prereqs,
- build_requires => { 'Test::More' => 0.90, },
- recommends => {
- 'perl' => '5.018001',
- 'Module::Pluggable' => '4.8',
- 'Test::Pod' => 0,
- 'Test::Pod::Coverage' => 0,
- },
- meta_merge => { resources => { repository => "https://github.com/rehsack/Sys-Filesystem", }, },
- test_files => join( ' ' => 't/*.t xt/*.t' ),
-);
-
-$build->create_build_script();
-
-# Send perl and module version information home if we've been given
-# permission to do so by a human being - default to not send for automated
-# testing environments, of if the user does not respond within 20 seconds.
-
-#my $url = $ENV{AUTOMATED_TESTING} ? undef : may_send_version_information();
-#if ($url) {
-# my @resp = ();
-# eval {
-# local $SIG{ALRM} = sub { die; };
-# alarm 10;
-# my $ua = LWP::UserAgent->new(
-# agent => 'Build.PL $Revision: 380 $',
-# timeout => 9,
-# max_size => 500,
-# );
-# $ua->env_proxy;
-# my $response = $ua->get($url);
-# if ($response->is_success()) {
-# for (split(/\s*\n+\s*/, $response->content())) {
-# push @resp, $_ if $_;
-# }
-# }
-# alarm 0;
-# };
-# print substr($resp[0],0,79) || "Thank you for sending this information.";
-# print "\n\n";
-#}
-#
-#sub may_send_version_information {
-# eval {
-# require Config;
-# require LWP::UserAgent;
-# };
-# return undef if $@;
-#
-# my $str = sprintf('%s?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s&%s=%s',
-# 'http://perlgirl.org.uk/lib/usage.cgi',
-# 'name', $build->dist_name(),
-# 'version', $build->dist_version(),
-# 'osname', $Config::Config{osname},
-# 'archname', $Config::Config{archname},
-# 'osver', $^O,
-# 'perlver', $]
-# );
-#
-# print "\nThank you for downloading ".$build->dist_name()."\n\n";
-# print "I would like to find out how many people are using this software,\n";
-# print "and on what operating systems and Perl versions. If you have an\n";
-# print "internet connection, may I transmit the following information:\n\n";
-# print "$str\n\n";
-#
-# my $send = 0;
-# eval {
-# local $SIG{ALRM} = sub { die; };
-# alarm 20;
-# $send = $build->y_n('Send this anonymous information?','n');
-# alarm 0;
-# };
-#
-# return $send ? $str : undef;
-#}
-
-1;
-
@@ -1,138 +1,175 @@
+Revision history for CPAN distribution Sys-Filesystem
+
+1.405 2013-10-28
+ - Fix Mswin32 mounted/unmounted support (thanks to Christian "Mithaldu"
+ Walde for remote testing support
+ - skip format test in case of unmounted device (unmounted devices might
+ or might not know in before the fstype)
+ - clean up basic tests and BAIL_OUT when unsupported environment
+ encountered
+
+1.404 2013-10-26
+ - move to Makefile.PL in favour of developer reqs
+ - change required perl version to 5.8.1
+ - rewrite core routines of Sys::Filesystem
+ - don't search for Darwin tools in path, rely on some
+ well known paths
+ - general, minor code cleanup
+
+1.403 2013-10-23
+ - Honor PATH_FSTAB in the environment on a NetBSD system if present
+ (Thanks to dholland@NetBSD.org)
+ - try improve error handling on Darwin to avoid smoke errors
+ - be noisy about where we're running on during tests
+ - remove runtime recommends for author tests
+ - bump required version of Module::Pluggable to avoid blead whining
+ - include p5-toolchain gang recommended way to declare developer
+ dependencies
+ - use proper indenting for Changes
+
+1.402 2013-09-24
+ - remove Makefile.PL passthrough
+ - don't prove whether Win32 is supported - we know it (should fix
+ RT#88901 - thanks Michiel Beijen)
+ - try to improve supported control
+ - put Win32::DriveInfo into feature "Win32" (I'd like to get feedback
+ whether it helps)
+
1.401 2013-09-08
- - Fix MacOS X / Darwin without diskutil
- - Changes reformatted as per CPAN::Changes::Spec
+ - Fix MacOS X / Darwin without diskutil
+ - Changes reformatted as per CPAN::Changes::Spec
1.400 2013-09-03
- - Moving to GitHub for easier contributing
- - Pod typo / encoding fixes (rt#85898, rt#77699), thanks to Slaven Rezić,
- Andreas J. König and Gregor Herrmann
- - Fix MacOS X 10.8 (diskutil vs. disktool)
- - Update requirements / recommendations
- - Fix AIX (rt#79188) - thanks to David Lee
- - Fix Solaris debug leftover (rt#72717) - thanks to Kenneth Ölwing
- - Fix Tests (rt#62248) - thanks to Daphne Pfister
- - Fix configure_requires (rt#62249) - thanks to Daphne Pfister
+ - Moving to GitHub for easier contributing
+ - Pod typo / encoding fixes (rt#85898, rt#77699), thanks to Slaven
+ Rezić, Andreas J. König and Gregor Herrmann
+ - Fix MacOS X 10.8 (diskutil vs. disktool)
+ - Update requirements / recommendations
+ - Fix AIX (rt#79188) - thanks to David Lee
+ - Fix Solaris debug leftover (rt#72717) - thanks to Kenneth Ölwing
+ - Fix Tests (rt#62248) - thanks to Daphne Pfister
+ - Fix configure_requires (rt#62249) - thanks to Daphne Pfister
1.30 2010-07-15
- - Fixing MSWin32
+ - Fixing MSWin32
1.29 2010-07-02
- - Fixing MacOS X
+ - Fixing MacOS X
1.28 2010-05-14
- - Adding more special file systems for Linux (looks in Linux soon
- everything is a file system), Fixes RT#55059 (Thanks to Reed Loden)
- - Improving documentation about selections in filesystems method,
- - Fixes RT#55058 (Thanks to Reed Loden)
- - Fixes RT#65504 (Thanks to Brett Gersekowski)
- - Improve MSWin32 support
+ - Adding more special file systems for Linux (looks in Linux soon
+ everything is a file system), Fixes RT#55059 (Thanks to Reed Loden)
+ - Improving documentation about selections in filesystems method,
+ - Fixes RT#55058 (Thanks to Reed Loden)
+ - Fixes RT#65504 (Thanks to Brett Gersekowski)
+ - Improve MSWin32 support
1.27 2010-02-20
- - Fixing RT#54406 (patch from Robert Bohne with some modifications)
- - Fixing RT#54599 (patch from Jonathan Yu)
- - Fixing wrong dependencies detection on Windows
- - Fixing generic fstab/mnttab reading
+ - Fixing RT#54406 (patch from Robert Bohne with some modifications)
+ - Fixing RT#54599 (patch from Jonathan Yu)
+ - Fixing wrong dependencies detection on Windows
+ - Fixing generic fstab/mnttab reading
1.26 2010-02-12
- - Adding more special file systems for Linux
- - Prefer /proc/self/mounts over /etc/mtab (when available), fixes RT
- #51151 (Thanks Tyler MacDonald)
- - Fix some tests to skip when no regular file systems could be found
- - Some Win32 fixes
- - Switch to Module::Pluggable to load OS-plugins
+ - Adding more special file systems for Linux
+ - Prefer /proc/self/mounts over /etc/mtab (when available), fixes RT
+ #51151 (Thanks Tyler MacDonald)
+ - Fix some tests to skip when no regular file systems could be found
+ - Some Win32 fixes
+ - Switch to Module::Pluggable to load OS-plugins
1.25 2009-10-30
- - Fixed support for FreeBSD and generalize BSD support
- - Fixed support for AIX
- - Fixed aliased attribute support for Sys::Filesystem->filesystems
- - Fix "Sys::Filesystem->filesystems ()" and "Sys::Filesystem::filesystems"
- (reported by H.Merijn Brand) by using Params::Util
- - Add keyword "Id" to be used/expanded by svn
- - Explain how restrictions on method filesystem works in Sys::Filesystem
- - Add a version method to all fs plugins
- - Update documentation
- - Correct t/03test.t to use format instead of type (recommended)
+ - Fixed support for FreeBSD and generalize BSD support
+ - Fixed support for AIX
+ - Fixed aliased attribute support for Sys::Filesystem->filesystems
+ - Fix "Sys::Filesystem->filesystems ()" and "Sys::Filesystem::filesystems"
+ (reported by H.Merijn Brand) by using Params::Util
+ - Add keyword "Id" to be used/expanded by svn
+ - Explain how restrictions on method filesystem works in Sys::Filesystem
+ - Add a version method to all fs plugins
+ - Update documentation
+ - Correct t/03test.t to use format instead of type (recommended)
1.24 2009-10-17
- - Added support for NetBSD (Jens Rehsack)
- - Added support for HP-UX (H.Merijn Brand)
- - Fixed POD a little
- - Add a simple test to see whether it's working or not - Increased
- required perl version (suggested by H.Merijn Brand)
+ - Added support for NetBSD (Jens Rehsack)
+ - Added support for HP-UX (H.Merijn Brand)
+ - Fixed POD a little
+ - Add a simple test to see whether it's working or not - Increased
+ required perl version (suggested by H.Merijn Brand)
1.23 2009-05-10
- - Fixed Aix.pm (RT #34577), patches from LEMBARK, REHSACK
- - Fixed failing on OS X (RT #7958, RT #43681), patch from Dirk Langer
- - Taking Co-Maintainership (Jens Rehsack, CPAN Id: REHSACK)
- - Changing debug environment flag from DEBUG to SYS_FILESYSTEM_DEBUG
+ - Fixed Aix.pm (RT #34577), patches from LEMBARK, REHSACK
+ - Fixed failing on OS X (RT #7958, RT #43681), patch from Dirk Langer
+ - Taking Co-Maintainership (Jens Rehsack, CPAN Id: REHSACK)
+ - Changing debug environment flag from DEBUG to SYS_FILESYSTEM_DEBUG
1.22 2006-06-01
- - Added CREDITS.
- - Fixed logic in Filesystem.pm:filesystems() where the inversion of the
- 'regaular' and 'special' paramaters was not being handled correctly,
- causing an incorrect selection of filesystems to be returned sometimes.
- - Added fd ctfs devfs objfs and procfs as special filesystem types in
- Solaris.pm.
- - Added procfs as a special filesyetem type to Aix.pm.
- - Changed Aix.pm to extract the filesystem type from the vfs field in
- /etc/filesystems.
- - Added note in main POD warning people not to confuse "type" and "vfs"
- when querying values under AIX.
- - Altered unit tests to be more reliable over different setups.
+ - Added CREDITS.
+ - Fixed logic in Filesystem.pm:filesystems() where the inversion of the
+ 'regaular' and 'special' paramaters was not being handled correctly,
+ causing an incorrect selection of filesystems to be returned sometimes.
+ - Added fd ctfs devfs objfs and procfs as special filesystem types in
+ Solaris.pm.
+ - Added procfs as a special filesyetem type to Aix.pm.
+ - Changed Aix.pm to extract the filesystem type from the vfs field in
+ /etc/filesystems.
+ - Added note in main POD warning people not to confuse "type" and "vfs"
+ when querying values under AIX.
+ - Altered unit tests to be more reliable over different setups.
1.21 2006-05-23
- - Typo in Build.PL. Changed "build_requires" to be "recommends".
+ - Typo in Build.PL. Changed "build_requires" to be "recommends".
1.20 2006-05-23
- - Fixed POD to reflect functionality that existed but wasn't documented,
- or that was documented incorrectly.
+ - Fixed POD to reflect functionality that existed but wasn't documented,
+ or that was documented incorrectly.
1.19 2006-05-23
- - Changed license to Apache 2.0 http://www.apache.org/licenses/LICENSE-2.0
- - Fixed a couple of module file names.
- - Added additional unit tests.
- - Fixed loading of failover modules.
- - A few small bug fixes in parsing of some tab files.
+ - Changed license to Apache 2.0 http://www.apache.org/licenses/LICENSE-2.0
+ - Fixed a couple of module file names.
+ - Added additional unit tests.
+ - Fixed loading of failover modules.
+ - A few small bug fixes in parsing of some tab files.
1.18 2005-12-29
- - Modified Makefile.PL to submit information to perlgirl.org.uk if the
- user agrees. Tweaked the POD slightly.
+ - Modified Makefile.PL to submit information to perlgirl.org.uk if the
+ user agrees. Tweaked the POD slightly.
1.16 2005-12-08
- - Modified POD
+ - Modified POD
1.15 2005-12-02
- - Updated for revision number and email address
+ - Updated for revision number and email address
1.14 2005-01-30
- - Added some new filesystem property aliases and reference to AIX helper
- module
+ - Added some new filesystem property aliases and reference to AIX helper
+ module
1.13 2005-01-26
- - Added extra documentation and the device option for the filesystems
- method.
+ - Added extra documentation and the device option for the filesystems
+ method.
1.12 2005-01-13
- - Updated POD
+ - Updated POD
1.11 2004-10-06
1.10 2004-10-06
- - Fix from Win32 to MSWin32
+ - Fix from Win32 to MSWin32
1.09 2004-10-05
- - Updated Linux.pm to properly detect some more special fs types
+ - Updated Linux.pm to properly detect some more special fs types
1.08 2004-09-30
- - Added regular_filesystems() method
- - Added autofs and mntfs as special filesystems for Solaris
+ - Added regular_filesystems() method
+ - Added autofs and mntfs as special filesystems for Solaris
1.07 2004-09-30
- - Added solaris mnttab support
- - Fixed an AUTOLOAD and DESTROY issue
+ - Added solaris mnttab support
+ - Fixed an AUTOLOAD and DESTROY issue
1.06 2004-09-29
- - Added alias support and more POD docs
+ - Added alias support and more POD docs
1.04 2004-09-29
- - Initial release to get the code out there
+ - Initial release to get the code out there
@@ -1,4 +1,3 @@
-Build.PL
Changes
CREDITS
INSTALL
@@ -18,6 +17,7 @@ LICENSE
Makefile.PL
MANIFEST
MANIFEST.SKIP
+META.json
META.yml
NOTICE
README
@@ -26,4 +26,3 @@ t/02_basic.t
t/03_whereami.t
t/04_special.t
TODO
-META.json
@@ -1,10 +1,11 @@
{
"abstract" : "Retrieve list of filesystems and their properties",
"author" : [
+ "Nicola Worthington <nicolaw@cpan.org>",
"Jens Rehsack <rehsack@cpan.org>"
],
"dynamic_config" : 1,
- "generated_by" : "Module::Build version 0.4007, CPAN::Meta::Converter version 2.132140",
+ "generated_by" : "ExtUtils::MakeMaker version 6.8, CPAN::Meta::Converter version 2.132830",
"license" : [
"apache_2_0"
],
@@ -13,29 +14,39 @@
"version" : "2"
},
"name" : "Sys-Filesystem",
+ "no_index" : {
+ "directory" : [
+ "t",
+ "inc"
+ ]
+ },
"prereqs" : {
"build" : {
- "requires" : {
- "Test::More" : "0.9"
- }
+ "requires" : {}
},
"configure" : {
"requires" : {
"Carp" : "0",
+ "ExtUtils::MakeMaker" : "0",
"FindBin" : "0",
"IO" : "0",
"IPC::Cmd" : "0.80",
- "Module::Build" : "0.2800",
- "Module::Pluggable" : "4.5",
+ "Module::Pluggable" : "4.8",
"Params::Util" : "1.00",
- "perl" : "5.008"
+ "perl" : "5.008001"
}
},
- "runtime" : {
- "recommends" : {
- "Module::Pluggable" : "4.8",
+ "develop" : {
+ "requires" : {
+ "Test::CPAN::Changes" : "0",
+ "Test::CheckManifest" : "0",
"Test::Pod" : "0",
"Test::Pod::Coverage" : "0",
+ "Test::Pod::Spelling::CommonMistakes" : "0"
+ }
+ },
+ "runtime" : {
+ "recommends" : {
"perl" : "5.018001"
},
"requires" : {
@@ -43,70 +54,22 @@
"FindBin" : "0",
"IO" : "0",
"IPC::Cmd" : "0.80",
- "Module::Pluggable" : "4.5",
+ "Module::Pluggable" : "4.8",
"Params::Util" : "1.00",
- "perl" : "5.008"
+ "perl" : "5.008001"
}
- }
- },
- "provides" : {
- "Sys::Filesystem" : {
- "file" : "lib/Sys/Filesystem.pm",
- "version" : "1.401"
- },
- "Sys::Filesystem::Aix" : {
- "file" : "lib/Sys/Filesystem/Aix.pm",
- "version" : "1.401"
- },
- "Sys::Filesystem::Cygwin" : {
- "file" : "lib/Sys/Filesystem/Cygwin.pm",
- "version" : "1.401"
- },
- "Sys::Filesystem::Darwin" : {
- "file" : "lib/Sys/Filesystem/Darwin.pm",
- "version" : "1.401"
- },
- "Sys::Filesystem::Dummy" : {
- "file" : "lib/Sys/Filesystem/Dummy.pm",
- "version" : "1.401"
- },
- "Sys::Filesystem::Freebsd" : {
- "file" : "lib/Sys/Filesystem/Freebsd.pm",
- "version" : "1.401"
- },
- "Sys::Filesystem::Hpux" : {
- "file" : "lib/Sys/Filesystem/Hpux.pm",
- "version" : "1.401"
- },
- "Sys::Filesystem::Linux" : {
- "file" : "lib/Sys/Filesystem/Linux.pm",
- "version" : "1.401"
},
- "Sys::Filesystem::Mswin32" : {
- "file" : "lib/Sys/Filesystem/Mswin32.pm",
- "version" : "1.401"
- },
- "Sys::Filesystem::Netbsd" : {
- "file" : "lib/Sys/Filesystem/Netbsd.pm",
- "version" : "1.401"
- },
- "Sys::Filesystem::Solaris" : {
- "file" : "lib/Sys/Filesystem/Solaris.pm",
- "version" : "1.401"
- },
- "Sys::Filesystem::Unix" : {
- "file" : "lib/Sys/Filesystem/Unix.pm",
- "version" : "1.401"
+ "test" : {
+ "requires" : {
+ "Test::More" : "0.9"
+ }
}
},
"release_status" : "stable",
"resources" : {
"license" : [
- "http://apache.org/licenses/LICENSE-2.0"
- ],
- "repository" : {
- "url" : "https://github.com/rehsack/Sys-Filesystem"
- }
+ "http://www.apache.org/licenses/LICENSE-2.0.html"
+ ]
},
- "version" : "1.401"
+ "version" : "1.405"
}
@@ -1,76 +1,40 @@
---
abstract: 'Retrieve list of filesystems and their properties'
author:
+ - 'Nicola Worthington <nicolaw@cpan.org>'
- 'Jens Rehsack <rehsack@cpan.org>'
build_requires:
Test::More: 0.9
configure_requires:
Carp: 0
+ ExtUtils::MakeMaker: 0
FindBin: 0
IO: 0
IPC::Cmd: 0.80
- Module::Build: 0.2800
- Module::Pluggable: 4.5
+ Module::Pluggable: 4.8
Params::Util: 1.00
- perl: 5.008
+ perl: 5.008001
dynamic_config: 1
-generated_by: 'Module::Build version 0.4007, CPAN::Meta::Converter version 2.132140'
+generated_by: 'ExtUtils::MakeMaker version 6.8, CPAN::Meta::Converter version 2.132830'
license: apache
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: Sys-Filesystem
-provides:
- Sys::Filesystem:
- file: lib/Sys/Filesystem.pm
- version: 1.401
- Sys::Filesystem::Aix:
- file: lib/Sys/Filesystem/Aix.pm
- version: 1.401
- Sys::Filesystem::Cygwin:
- file: lib/Sys/Filesystem/Cygwin.pm
- version: 1.401
- Sys::Filesystem::Darwin:
- file: lib/Sys/Filesystem/Darwin.pm
- version: 1.401
- Sys::Filesystem::Dummy:
- file: lib/Sys/Filesystem/Dummy.pm
- version: 1.401
- Sys::Filesystem::Freebsd:
- file: lib/Sys/Filesystem/Freebsd.pm
- version: 1.401
- Sys::Filesystem::Hpux:
- file: lib/Sys/Filesystem/Hpux.pm
- version: 1.401
- Sys::Filesystem::Linux:
- file: lib/Sys/Filesystem/Linux.pm
- version: 1.401
- Sys::Filesystem::Mswin32:
- file: lib/Sys/Filesystem/Mswin32.pm
- version: 1.401
- Sys::Filesystem::Netbsd:
- file: lib/Sys/Filesystem/Netbsd.pm
- version: 1.401
- Sys::Filesystem::Solaris:
- file: lib/Sys/Filesystem/Solaris.pm
- version: 1.401
- Sys::Filesystem::Unix:
- file: lib/Sys/Filesystem/Unix.pm
- version: 1.401
+no_index:
+ directory:
+ - t
+ - inc
recommends:
- Module::Pluggable: 4.8
- Test::Pod: 0
- Test::Pod::Coverage: 0
perl: 5.018001
requires:
Carp: 0
FindBin: 0
IO: 0
IPC::Cmd: 0.80
- Module::Pluggable: 4.5
+ Module::Pluggable: 4.8
Params::Util: 1.00
- perl: 5.008
+ perl: 5.008001
resources:
- license: http://apache.org/licenses/LICENSE-2.0
- repository: https://github.com/rehsack/Sys-Filesystem
-version: 1.401
+ license: http://www.apache.org/licenses/LICENSE-2.0.html
+version: 1.405
@@ -1,35 +1,143 @@
-# Note: this file was auto-generated by Module::Build::Compat version 0.4007
-require 5.008;
+# vim:ts=4:sw=4:tw=78
+# $Id$
- unless (eval "use Module::Build::Compat 0.02; 1" ) {
- print "This module requires Module::Build to install itself.\n";
+use 5.008001;
- require ExtUtils::MakeMaker;
- my $yn = ExtUtils::MakeMaker::prompt
- (' Install Module::Build now from CPAN?', 'y');
+use strict;
+use vars qw($build);
+use FindBin;
+use lib $FindBin::Bin . '/lib';
- unless ($yn =~ /^y/i) {
- die " *** Cannot install without Module::Build. Exiting ...\n";
- }
+use ExtUtils::MakeMaker;
- require Cwd;
- require File::Spec;
- require CPAN;
+$@ = undef;
+my @fs;
+$^O eq 'MSWin32' or eval {
+ require Sys::Filesystem;
+ unless ( Sys::Filesystem->supported )
+ {
+ printf( STDERR "Can't be used ($@) - OS not supported or bad maintained?" );
+ exit(0);
+ }
+};
+
+my %RUN_DEPS = (
+ 'perl' => '5.008001',
+ 'Carp' => 0,
+ 'FindBin' => 0,
+ 'IO' => 0,
+ 'IPC::Cmd' => '0.80',
+ 'Module::Pluggable' => '4.8',
+ 'Params::Util' => '1.00',
+ (
+ $^O eq 'MSWin32'
+ ? (
+ 'Win32::DriveInfo' => 0,
+ )
+ : ()
+ ),
+ );
+my %CONFIGURE_DEPS = (
+ 'ExtUtils::MakeMaker' => 0,
+ %RUN_DEPS
+ );
+my %BUILD_DEPS = ();
+
+my %TEST_DEPS = (
+ 'Test::More' => 0.90,
+ );
- # Save this 'cause CPAN will chdir all over the place.
- my $cwd = Cwd::cwd();
+WriteMakefile1(
+ MIN_PERL_VERSION => '5.008001',
+ META_ADD => {
+ 'meta-spec' => { version => 2 },
+ resources => {
+ repository => "https://github.com/rehsack/Sys-Filesystem",
+ license => 'http://www.apache.org/licenses/LICENSE-2.0.html',
+ },
+ prereqs => {
+ develop => {
+ requires => {
+ 'Test::CPAN::Changes' => 0,
+ 'Test::CheckManifest' => 0,
+ 'Test::Pod' => 0,
+ 'Test::Pod::Coverage' => 0,
+ 'Test::Pod::Spelling::CommonMistakes' => 0,
+ },
+ },
+ configure => {
+ requires => {%CONFIGURE_DEPS},
+ },
+ build => { requires => {%BUILD_DEPS} },
+ test => { requires => {%TEST_DEPS} },
+ runtime => {
+ recommends => {
+ 'perl' => '5.018001',
+ },
+ requires => {
+ %RUN_DEPS,
+ },
+ },
+ },
+ },
+ NAME => 'Sys::Filesystem',
+ VERSION_FROM => 'lib/Sys/Filesystem.pm',
+ ABSTRACT_FROM => 'lib/Sys/Filesystem.pm',
+ LICENSE => 'Apache',
+ AUTHOR => [q{Nicola Worthington <nicolaw@cpan.org>}, q{Jens Rehsack <rehsack@cpan.org>}],
+ PREREQ_PM => \%RUN_DEPS,
+ BUILD_REQUIRES => \%BUILD_DEPS,
+ TEST_REQUIRES => \%TEST_DEPS,
+ test => { TESTS => 't/*.t xt/*.t' },
+ );
- CPAN::Shell->install('Module::Build::Compat');
- CPAN::Shell->expand("Module", "Module::Build::Compat")->uptodate
- or die "Couldn't install Module::Build, giving up.\n";
+sub WriteMakefile1
+{ # originally written by Alexandr Ciornii, version 0.21. Added by eumm-upgrade.
+ my %params = @_;
+ my $eumm_version = $ExtUtils::MakeMaker::VERSION;
+ $eumm_version = eval $eumm_version;
+ die "EXTRA_META is deprecated" if ( exists( $params{EXTRA_META} ) );
+ die "License not specified" if ( !exists( $params{LICENSE} ) );
+ if ( $params{TEST_REQUIRES} and ( $eumm_version < 6.6303 ) )
+ {
+ if ( $params{BUILD_REQUIRES} )
+ {
+ $params{BUILD_REQUIRES} = { %{ $params{BUILD_REQUIRES} }, %{ $params{TEST_REQUIRES} } };
+ }
+ else
+ {
+ $params{BUILD_REQUIRES} = delete $params{TEST_REQUIRES};
+ }
+ }
+ if ( $params{BUILD_REQUIRES} and ( $eumm_version < 6.5503 ) )
+ {
+ #EUMM 6.5502 has problems with BUILD_REQUIRES
+ $params{PREREQ_PM} = { %{ $params{PREREQ_PM} || {} }, %{ $params{BUILD_REQUIRES} } };
+ delete $params{BUILD_REQUIRES};
+ }
+ delete $params{CONFIGURE_REQUIRES} if ( $eumm_version < 6.52 );
+ delete $params{MIN_PERL_VERSION} if ( $eumm_version < 6.48 );
+ delete $params{META_MERGE} if ( $eumm_version < 6.46 );
+ delete $params{META_ADD}{prereqs} if ( $eumm_version < 6.58 );
+ delete $params{META_ADD}{'meta-spec'} if ( $eumm_version < 6.58 );
+ delete $params{META_ADD} if ( $eumm_version < 6.46 );
+ delete $params{LICENSE} if ( $eumm_version < 6.31 );
+ delete $params{AUTHOR} if ( $] < 5.005 );
+ delete $params{ABSTRACT_FROM} if ( $] < 5.005 );
+ delete $params{BINARY_LOCATION} if ( $] < 5.005 );
- chdir $cwd or die "Cannot chdir() back to $cwd: $!";
+ # more or less taken from Moose' Makefile.PL
+ if ( $params{CONFLICTS} )
+ {
+ my $ok = CheckConflicts(%params);
+ exit(0) if ( $params{PREREQ_FATAL} and not $ok );
+ my $cpan_smoker = grep { $_ =~ m/(?:CR_SMOKER|CPAN_REPORTER|AUTOMATED_TESTING)/ } keys %ENV;
+ unless ( $cpan_smoker || $ENV{PERL_MM_USE_DEFAULT} || $ENV{SQL_STATEMENT_WARN_UPDATE} )
+ {
+ sleep 4 unless ($ok);
+ }
+ delete $params{CONFLICTS};
}
- eval "use Module::Build::Compat 0.02; 1" or die $@;
-
- Module::Build::Compat->run_build_pl(args => \@ARGV);
- my $build_script = 'Build';
- $build_script .= '.com' if $^O eq 'VMS';
- exit(0) unless(-e $build_script); # cpantesters convention
- require Module::Build;
- Module::Build::Compat->write_makefile(build_class => 'Module::Build');
+
+ WriteMakefile(%params);
+}
@@ -24,6 +24,8 @@ package Sys::Filesystem::Aix;
# vim:ts=4:sw=4:tw=78
+use 5.008001;
+
use strict;
use warnings;
use vars qw($VERSION);
@@ -31,7 +33,7 @@ use vars qw($VERSION);
use Carp qw(croak);
use IO::File;
-$VERSION = '1.401';
+$VERSION = '1.405';
sub version()
{
@@ -66,7 +68,8 @@ sub new
} qx( /usr/sbin/mount );
my %fs_info = map {
- my ( $path, $device, $vfs, $nodename, $type, $size, $options, $mount, $account ) = split( m/:/, $_ );
+ my ( $path, $device, $vfs, $nodename, $type, $size, $options, $mount, $account ) =
+ split( m/:/, $_ );
( $path => [ $device, $vfs, $nodename, $type, $size, $options, $mount, $account ] )
}
@@ -76,7 +79,8 @@ sub new
{
$self->{$current_filesystem}->{filesystem} = $current_filesystem;
- my ( $device, $vfs, $nodename, $type, $size, $options, $mount, $account ) = @{ $fs_info{$current_filesystem} };
+ my ( $device, $vfs, $nodename, $type, $size, $options, $mount, $account ) =
+ @{ $fs_info{$current_filesystem} };
$self->{$current_filesystem}->{dev} = $device;
$self->{$current_filesystem}->{vfs} = $vfs;
@@ -86,7 +90,8 @@ sub new
$self->{$current_filesystem}->{size} = $size;
$self->{$current_filesystem}->{mount} = $mount;
$self->{$current_filesystem}->{account} = $account;
- $self->{$current_filesystem}->{special} = 1 if ( defined($vfs) && defined( $special_fs{$vfs} ) );
+ $self->{$current_filesystem}->{special} = 1
+ if ( defined($vfs) && defined( $special_fs{$vfs} ) );
# the filesystem is either currently mounted or is not,
# this does not need to be checked for each individual
@@ -118,7 +123,8 @@ sub new
$self->{$current_filesystem}->{PPs} = $pps;
$self->{$current_filesystem}->{PVs} = $pvs;
$self->{$current_filesystem}->{lvstate} = $lvstate;
- $self->{$current_filesystem}->{special} = 1 if ( defined($type) && defined( $special_fs{$type} ) );
+ $self->{$current_filesystem}->{special} = 1
+ if ( defined($type) && defined( $special_fs{$type} ) );
# the filesystem is either currently mounted or is not,
# this does not need to be checked for each individual
@@ -23,6 +23,8 @@ package Sys::Filesystem::Cygwin;
# vim:ts=4:sw=4:tw=78
+use 5.008001;
+
use strict;
use warnings;
use vars qw($VERSION @ISA);
@@ -30,7 +32,7 @@ use vars qw($VERSION @ISA);
use Carp qw(croak);
require Sys::Filesystem::Unix;
-$VERSION = '1.401';
+$VERSION = '1.405';
@ISA = qw(Sys::Filesystem::Unix);
sub version()
@@ -24,7 +24,7 @@ package Sys::Filesystem::Darwin;
# vim:ts=4:sw=4:tw=78
-use 5.006;
+use 5.008001;
use strict;
use warnings;
@@ -35,7 +35,7 @@ use IPC::Cmd ();
use Carp qw(croak);
-$VERSION = '1.401';
+$VERSION = '1.405';
@ISA = qw(Sys::Filesystem::Unix);
sub version()
@@ -63,18 +63,27 @@ sub new
my ( $class, %args ) = @_;
my $self = bless( {}, $class );
- $args{diskutil} ||= IPC::Cmd::can_run("diskutil");
- $args{disktool} ||= IPC::Cmd::can_run("disktool");
- $args{mount} ||= IPC::Cmd::can_run("mount");
+ foreach my $prog (qw(diskutil disktool mount))
+ {
+ defined $args{$prog}
+ or $args{$prog} =
+ ( grep { defined $_ and -x $_ } ( "/usr/sbin/$prog", "/sbin/$prog" ) )[0];
+ }
my @list_fs_cmd;
- defined $args{diskutil} and $args{diskutil} and @list_fs_cmd = ($args{diskutil}, "list");
- @list_fs_cmd or @list_fs_cmd = ($args{disktool}, "-l");
+ defined $args{diskutil} and $args{diskutil} and @list_fs_cmd = ( $args{diskutil}, "list" );
+ ( 0 == scalar @list_fs_cmd )
+ and defined $args{disktool}
+ and $args{disktool}
+ and @list_fs_cmd = ( $args{disktool}, "-l" );
+ @list_fs_cmd or croak("No command to list file systems ...");
# don't use backticks, don't use the shell
my @fslist = ();
my @mntlist = ();
- open( my $dt_fh, '-|' ) or exec( @list_fs_cmd ) or croak("Cannot execute " . join(" ", @list_fs_cmd) . ": $!");
+ open( my $dt_fh, '-|' )
+ or exec(@list_fs_cmd)
+ or croak( "Cannot execute " . join( " ", @list_fs_cmd ) . ": $!" );
@fslist = <$dt_fh>;
close($dt_fh);
open( my $m_fh, '-|' ) or exec( $args{mount} ) or croak("Cannot execute $args{mount}: $!");
@@ -23,11 +23,13 @@ package Sys::Filesystem::Dummy;
# vim:ts=4:sw=4:tw=78
+use 5.008001;
+
use strict;
use Carp qw(croak);
use vars qw($VERSION);
-$VERSION = '1.401';
+$VERSION = '1.405';
sub version()
{
@@ -24,6 +24,8 @@ package Sys::Filesystem::Freebsd;
# vim:ts=4:sw=4:tw=78
+use 5.008001;
+
use strict;
use warnings;
use vars qw(@ISA $VERSION);
@@ -31,7 +33,7 @@ use vars qw(@ISA $VERSION);
require Sys::Filesystem::Unix;
use Carp qw(croak);
-$VERSION = '1.401';
+$VERSION = '1.405';
@ISA = qw(Sys::Filesystem::Unix);
sub version()
@@ -20,7 +20,7 @@
package Sys::Filesystem::Hpux;
-use 5.006;
+use 5.008001;
use strict;
use warnings;
@@ -30,7 +30,7 @@ require Sys::Filesystem::Unix;
use Carp qw(croak);
-$VERSION = '1.401';
+$VERSION = '1.405';
@ISA = qw(Sys::Filesystem::Unix);
sub version()
@@ -23,6 +23,8 @@ package Sys::Filesystem::Linux;
# vim:ts=4:sw=4:tw=78
+use 5.008001;
+
use strict;
use warnings;
use vars qw($VERSION @ISA);
@@ -31,7 +33,7 @@ use Carp qw(croak);
require IO::File;
require Sys::Filesystem::Unix;
-$VERSION = '1.401';
+$VERSION = '1.405';
@ISA = qw(Sys::Filesystem::Unix);
sub version()
@@ -47,7 +49,7 @@ my %special_fs = (
devpts => 1,
fusectl => 1,
'fuse.gvfs-fuse-daemon' => 1,
- mini_fo => 1,
+ mini_fo => 1,
nfsd => 1,
proc => 1,
procbususb => 1,
@@ -23,23 +23,38 @@ package Sys::Filesystem::Mswin32;
# vim:ts=4:sw=4:tw=78
+use 5.008001;
+
use strict;
use warnings;
+use vars qw($VERSION);
+
use Params::Util qw(_STRING);
use Win32::DriveInfo;
use Carp qw(croak);
-use vars qw($VERSION);
-$VERSION = '1.401';
+$VERSION = '1.405';
sub version()
{
return $VERSION;
}
-my @volInfoAttrs =
- ( 'n/a', 'preserve case', 'case sensitive', 'unicode', 'acl', 'file compression', 'compressed volume' );
-my @typeExplain = ( 'not determined', 'not available', 'removeable', 'fixed', 'network', 'cdrom', 'ram disk' );
+my @volInfoAttrs = (
+ 'n/a',
+ 'preserve case',
+ 'case sensitive',
+ 'unicode',
+ 'acl',
+ 'file compression',
+ 'compressed volume'
+ );
+my @typeExplain = (
+ 'unable to determine', 'no root directory',
+ 'removeable', 'fixed',
+ 'network', 'cdrom',
+ 'ram disk'
+ );
sub new
{
@@ -56,26 +71,25 @@ sub new
Win32::DriveInfo::VolumeInfo($drvletter);
my $drvRoot = $drvletter . ":/";
- if ( defined( _STRING($VolumeName) ) )
- {
- $VolumeName =~ s/\\/\//g;
- $VolumeName = ucfirst($VolumeName);
- }
- else
- {
- $VolumeName = $drvRoot;
- }
+ defined( _STRING($VolumeName) ) and $VolumeName =~ s/\\/\//g;
+ defined( _STRING($VolumeName) ) or $VolumeName = $drvRoot;
+ $VolumeName = ucfirst($VolumeName);
$FileSystemName ||= 'CDFS' if ( $type == 5 );
- $self->{$drvRoot}->{mount_point} = $drvRoot; # XXX Win32::DriveInfo gives no details here ...
+ # XXX Win32::DriveInfo gives no details here ...
+ $self->{$drvRoot}->{mount_point} = $drvRoot;
$self->{$drvRoot}->{device} = $VolumeName;
- $self->{$drvRoot}->{format} = $FileSystemName; # XXX Win32::DriveInfo gives sometime wrong information here
+ # XXX Win32::DriveInfo gives sometime wrong information here
+ $self->{$drvRoot}->{format} = $FileSystemName;
$self->{$drvRoot}->{options} = join( ',', map { $volInfoAttrs[$_] } @attr );
- if ( $self->{$drvRoot}->{mounted} = $type > 1 )
- {
- $self->{$drvRoot}->{type} = $typeExplain[$type];
- }
+ my $mntstate = ( ( defined $FileSystemName ) and $type > 1 );
+ $mntstate
+ and 2 == $type
+ and $mntstate = Win32::DriveInfo::IsReady($drvletter);
+ $mntstate = $mntstate ? "mounted" : "unmounted";
+ $self->{$drvRoot}->{$mntstate} = 1;
+ $type > 0 and $self->{$drvRoot}->{type} = $typeExplain[$type];
}
bless( $self, $class );
@@ -23,13 +23,16 @@ package Sys::Filesystem::Netbsd;
# vim:ts=4:sw=4:tw=78
+use 5.008001;
+
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
require Sys::Filesystem::Unix;
use Carp qw(croak);
-$VERSION = '1.401';
+$VERSION = '1.405';
@ISA = qw(Sys::Filesystem::Unix);
sub version()
@@ -57,10 +60,13 @@ sub new
my $self = bless( {}, $class );
# Defaults
- $args{fstab} ||= '/etc/fstab';
+ $args{fstab} ||= $ENV{PATH_FSTAB} || '/etc/fstab';
my @mounts = qx( /sbin/mount );
- $self->readMounts( $mount_rx, [ 0, 1, 2 ], [qw(fs_spec fs_file fs_vfstype fs_mntops)], \%special_fs, @mounts );
+ $self->readMounts( $mount_rx,
+ [ 0, 1, 2 ],
+ [qw(fs_spec fs_file fs_vfstype fs_mntops)],
+ \%special_fs, @mounts );
$self->readSwap( $swap_rx, qx( /sbin/swapctl -l ) );
unless ( $self->readFsTab( $args{fstab}, \@keys, [ 0, 1, 2 ], \%special_fs ) )
{
@@ -24,6 +24,8 @@ package Sys::Filesystem::Solaris;
# vim:ts=4:sw=4:tw=78
+use 5.008001;
+
use strict;
use warnings;
use vars qw($VERSION @ISA);
@@ -32,7 +34,7 @@ use Carp qw(croak);
use Data::Dumper;
require Sys::Filesystem::Unix;
-$VERSION = '1.401';
+$VERSION = '1.405';
@ISA = qw(Sys::Filesystem::Unix);
sub version()
@@ -24,13 +24,17 @@ package Sys::Filesystem::Unix;
# vim:ts=4:sw=4:tw=78
+use 5.008001;
+
use strict;
+use warnings;
+use vars qw($VERSION);
+
use Carp qw(croak);
use Fcntl qw(:flock);
use IO::File;
-use vars qw($VERSION);
-$VERSION = '1.401';
+$VERSION = '1.405';
sub version()
{
@@ -86,7 +90,8 @@ sub readFsTab($\@\@\%)
if ( defined( $pridx->[2] ) )
{
my $vfs_type = $self->{ $vals[ $pridx->[1] ] }->{fs_vfstype} = $vals[ $pridx->[2] ];
- $self->{ $vals[ $pridx->[1] ] }->{special} = 1 if ( defined( $special_fs->{$vfs_type} ) );
+ $self->{ $vals[ $pridx->[1] ] }->{special} = 1
+ if ( defined( $special_fs->{$vfs_type} ) );
}
else
{
@@ -96,7 +101,8 @@ sub readFsTab($\@\@\%)
for ( my $i = 0; $i < @{$fstabKeys}; ++$i )
{
- $self->{ $vals[ $pridx->[1] ] }->{ $fstabKeys->[$i] } = defined( $vals[$i] ) ? $vals[$i] : '';
+ $self->{ $vals[ $pridx->[1] ] }->{ $fstabKeys->[$i] } =
+ defined( $vals[$i] ) ? $vals[$i] : '';
}
}
$fstab->close();
@@ -134,7 +140,8 @@ sub readMntTab($\@\@\%)
if ( defined( $pridx->[2] ) )
{
my $vfs_type = $self->{ $vals[ $pridx->[1] ] }->{fs_vfstype} = $vals[ $pridx->[2] ];
- $self->{ $vals[ $pridx->[1] ] }->{special} = 1 if ( defined( $special_fs->{$vfs_type} ) );
+ $self->{ $vals[ $pridx->[1] ] }->{special} = 1
+ if ( defined( $special_fs->{$vfs_type} ) );
}
else
{
@@ -144,7 +151,8 @@ sub readMntTab($\@\@\%)
for ( my $i = 0; $i < @{$mnttabKeys}; ++$i )
{
- $self->{ $vals[ $pridx->[1] ] }->{ $mnttabKeys->[$i] } = defined( $vals[$i] ) ? $vals[$i] : '';
+ $self->{ $vals[ $pridx->[1] ] }->{ $mnttabKeys->[$i] } =
+ defined( $vals[$i] ) ? $vals[$i] : '';
}
}
$mtab->close();
@@ -173,7 +181,8 @@ sub readMounts
if ( defined( $pridx->[2] ) )
{
my $vfs_type = $self->{ $vals[ $pridx->[1] ] }->{fs_vfstype} = $vals[ $pridx->[2] ];
- $self->{ $vals[ $pridx->[1] ] }->{special} = 1 if ( defined( $special->{$vfs_type} ) );
+ $self->{ $vals[ $pridx->[1] ] }->{special} = 1
+ if ( defined( $special->{$vfs_type} ) );
}
elsif ( !defined( $self->{ $vals[ $pridx->[1] ] }->{special} ) )
{
@@ -182,7 +191,8 @@ sub readMounts
for ( my $i = 0; $i < @{$keys}; ++$i )
{
- $self->{ $vals[ $pridx->[1] ] }->{ $keys->[$i] } = defined( $vals[$i] ) ? $vals[$i] : '';
+ $self->{ $vals[ $pridx->[1] ] }->{ $keys->[$i] } =
+ defined( $vals[$i] ) ? $vals[$i] : '';
}
}
}
@@ -24,7 +24,7 @@ package Sys::Filesystem;
# vim:ts=4:sw=4:tw=78
-use 5.006;
+use 5.008001;
my @query_order;
@@ -34,18 +34,21 @@ use vars qw($VERSION $AUTOLOAD);
use Carp qw(croak cluck confess);
use Module::Pluggable
require => 1,
- only =>
- [ @query_order = map { __PACKAGE__ . '::' . $_ } ucfirst( lc($^O) ), $^O =~ m/Win32/i ? 'Win32' : 'Unix', 'Dummy' ],
+ only => [
+ @query_order = map { __PACKAGE__ . '::' . $_ } ucfirst( lc($^O) ),
+ $^O =~ m/Win32/i ? 'Win32' : 'Unix', 'Dummy'
+ ],
inner => 0,
search_path => ['Sys::Filesystem'];
use Params::Util qw(_INSTANCE);
use Scalar::Util qw(blessed);
+use List::Util qw(first);
-use constant DEBUG => $ENV{SYS_FILESYSTEM_DEBUG} ? 1 : 0;
-use constant SPECIAL => ( 'darwin' eq $^O ) ? 0 : undef;
+use constant DEBUG => $ENV{SYS_FILESYSTEM_DEBUG} ? 1 : 0;
+use constant SPECIAL => ( 'darwin' eq $^O ) ? 0 : undef;
#use constant SPECIAL => undef;
-$VERSION = '1.401';
+$VERSION = '1.405';
my ( $FsPlugin, $Supported );
@@ -60,7 +63,7 @@ BEGIN
last;
}
- $Supported = ( $FsPlugin ne 'Sys::Filesystem::Unix' ) && ( $FsPlugin ne 'Sys::Filesystem::Dummy' );
+ $Supported = $FsPlugin ne 'Sys::Filesystem::Unix' and $FsPlugin ne 'Sys::Filesystem::Dummy';
}
sub new
@@ -121,7 +124,8 @@ sub filesystems
}
# Check we've got something sane passed
- croak 'Odd number of elements passed when even number was expected' if ( @_ % 2 );
+ @_ % 2 and croak 'Odd number of elements passed when even number was expected';
+
my $params = {@_};
for my $param ( keys %{$params} )
{
@@ -133,53 +137,34 @@ sub filesystems
if ( exists $params->{regular} )
{
delete $params->{regular};
- if ( exists( $params->{special} ) )
- {
- carp("Both parameters specified, 'special' and 'regular', which are mutually exclusive");
- }
+ exists( $params->{special} )
+ and carp("Mutual exclusive parameters 'special' and 'regular' specified together");
$params->{special} = SPECIAL;
}
my @filesystems = ();
# Return list of all filesystems
- unless ( keys %{$params} )
- {
- @filesystems = sort( keys( %{ $self->{filesystems} } ) );
+ keys %{$params} or return sort( keys( %{ $self->{filesystems} } ) );
- # Return list of specific filesystems
- }
- else
+ for my $fsname ( sort( keys( %{ $self->{filesystems} } ) ) )
{
- for my $fs ( sort( keys( %{ $self->{filesystems} } ) ) )
+ for my $requirement ( keys( %{$params} ) )
{
- for my $requirement ( keys( %{$params} ) )
- {
- my $fsreqname = $requirement;
- if ( !exists( $self->{filesystems}->{$fs}->{$requirement} )
- && exists( $self->{aliases}->{$requirement} ) )
- {
- foreach my $fsreqdef ( @{ $self->{aliases}->{$requirement} } )
- {
- if ( exists( $self->{filesystems}->{$fs}->{$fsreqdef} ) )
- {
- $fsreqname = $fsreqdef;
- last;
- }
- }
- }
- if (
- (
- ( defined( $params->{$requirement} ) && exists( $self->{filesystems}->{$fs}->{$fsreqname} ) )
- && ( $self->{filesystems}->{$fs}->{$fsreqname} eq $params->{$requirement} )
- )
- || ( !defined( $params->{$requirement} ) && !exists( $self->{filesystems}->{$fs}->{$fsreqname} ) )
- )
- {
- push( @filesystems, $fs );
- last;
- }
- }
+ my $fs = $self->{filesystems}->{$fsname};
+ my $fsreqname =
+ ( !exists $fs->{$requirement} and exists $self->{aliases}->{$requirement} )
+ ? first { exists $fs->{$_} } @{ $self->{aliases}->{$requirement} }
+ : $requirement;
+
+ defined $params->{$requirement}
+ and exists $fs->{$fsreqname}
+ and $fs->{$fsreqname} eq $params->{$requirement}
+ and push( @filesystems, $fsname )
+ and last;
+ push( @filesystems, $fsname ) and last
+ unless defined( $params->{$requirement} )
+ or exists( $fs->{$fsreqname} );
}
}
@@ -187,7 +172,7 @@ sub filesystems
return @filesystems;
}
-sub supported()
+sub supported
{
return $Supported;
}
@@ -216,38 +201,27 @@ sub DESTROY { }
sub AUTOLOAD
{
- my ( $self, $fs ) = @_;
+ my ( $self, $fsname ) = @_;
croak "$self is not an object" unless ( blessed($self) );
- croak "No filesystem passed where expected" unless ($fs);
+ croak "No filesystem passed where expected" unless ($fsname);
( my $name = $AUTOLOAD ) =~ s/.*://;
# No such filesystem
- unless ( exists $self->{filesystems}->{$fs} )
- {
- croak "No such filesystem";
- }
- else
- {
- # Found the property
- if ( exists $self->{filesystems}->{$fs}->{$name} )
- {
- return $self->{filesystems}->{$fs}->{$name};
- }
- elsif ( exists $self->{aliases}->{$name} )
- { # Didn't find the property, but check any aliases
- for my $alias ( @{ $self->{aliases}->{$name} } )
- {
- if ( exists $self->{filesystems}->{$fs}->{$alias} )
- { # Found the Alias
- return $self->{filesystems}->{$fs}->{$alias};
- }
- }
- }
- }
+ exists $self->{filesystems}->{$fsname} or croak "No such filesystem";
+
+ # Found the property
+ my $fs = $self->{filesystems}->{$fsname};
+
+ exists $fs->{$name} and return $fs->{$name};
+
+ # Didn't find the property, but check any aliases
+ exists $self->{aliases}->{$name}
+ and $name = first { exists $fs->{$_} } @{ $self->{aliases}->{$name} }
+ and return $fs->{$name};
- return undef;
+ return;
}
sub TRACE
@@ -5,4 +5,9 @@ use Test::More tests => 2;
require_ok('Sys::Filesystem');
use_ok('Sys::Filesystem');
-diag("Testing Sys::Filesystem $Sys::Filesystem::VERSION, Perl $], $^X");
+use Config;
+
+my $os_info = join("-", $Config{osname}, $Config{osvers});
+$^O eq "MSWin32" and eval "use Win32;" and $os_info = join("-", Win32::GetOSName(), Win32::GetOSVersion());
+
+diag("Testing Sys::Filesystem $Sys::Filesystem::VERSION, Perl $] ($^X) on $os_info");
@@ -1,9 +1,12 @@
use Test::More;
use Sys::Filesystem;
-my $fs;
-eval { $fs = Sys::Filesystem->new(); };
-plan( skip_all => "Cannot initialize Sys::Filesystem" ) if ($@);
+my ( $fs, @filesystems );
+eval { $fs = Sys::Filesystem->new(); @filesystems = $fs->filesystems(); };
+
+$@ and BAIL_OUT("Cannot initialize Sys::Filesystem: $@");
+@filesystems or BAILOUT("Badly poor supported OS or no file systems found.");
+
ok( ref($fs) eq 'Sys::Filesystem', 'Create new Sys::Filesystem object' );
my @mounted_filesystems = $fs->mounted_filesystems();
@@ -14,45 +17,45 @@ my @unmounted_filesystems = $fs->unmounted_filesystems();
my @special_filesystems = $fs->special_filesystems();
my @regular_filesystems = $fs->regular_filesystems();
-my @filesystems = $fs->filesystems();
-SKIP:
+ok( @regular_filesystems, 'Get list of regular filesystems' );
+ok( @filesystems, 'Get list of all filesystems' );
+
+diag( join( ' - ', qw(filesystem mounted special device options format volume label type) ) );
+for my $filesystem (@filesystems)
{
- unless (@filesystems)
+ my $mounted = $fs->mounted($filesystem) || 0;
+ my $unmounted = !$mounted;
+ ok( $mounted == grep( /^\Q$filesystem\E$/, @mounted_filesystems ), 'Mounted' );
+ ok( $unmounted == grep( /^\Q$filesystem\E$/, @unmounted_filesystems ), 'Unmounted' );
+
+ my $special = $fs->special($filesystem) || 0;
+ my $regular = !$special;
+ ok( $special == grep( /^\Q$filesystem\E$/, @special_filesystems ), 'Special' );
+ ok( $regular == grep( /^\Q$filesystem\E$/, @regular_filesystems ), 'Regular' );
+
+ my ( $device, $options, $format, $volume, $label );
+ ok( $device = $fs->device($filesystem), "Get device for $filesystem" );
+ ok( defined( $options = $fs->options($filesystem) ), "Get options for $filesystem: $options" );
+ SKIP:
{
- skip( 'Badly poor supported OS or no file systems found.', 0 );
- }
- else
- {
- ok( @regular_filesystems, 'Get list of regular filesystems' );
- ok( @filesystems, 'Get list of all filesystems' );
-
- for my $filesystem (@filesystems)
- {
- my $mounted = $fs->mounted($filesystem) || 0;
- my $unmounted = !$mounted;
- ok( $mounted == grep( /^\Q$filesystem\E$/, @mounted_filesystems ), 'Mounted' );
- ok( $unmounted == grep( /^\Q$filesystem\E$/, @unmounted_filesystems ), 'Unmounted' );
-
- my $special = $fs->special($filesystem) || 0;
- my $regular = !$special;
- ok( $special == grep( /^\Q$filesystem\E$/, @special_filesystems ), 'Special' );
- ok( $regular == grep( /^\Q$filesystem\E$/, @regular_filesystems ), 'Regular' );
-
- my ( $device, $options, $format, $volume, $label );
- ok( $device = $fs->device($filesystem), "Get device for $filesystem" );
- ok( defined( $options = $fs->options($filesystem) ), "Get options for $filesystem: $options" );
- ok( $format = $fs->format($filesystem), "Get format for $filesystem" );
- ok( $volume = $fs->volume($filesystem) || 1, "Get volume type for $filesystem" );
- ok( $label = $fs->label($filesystem) || 1, "Get label for $filesystem" );
- diag(join( ' - ', $filesystem, $mounted, $special, $device, $options, $format, $volume || '', $label || '' )
- );
- }
-
- my $device = $fs->device( $filesystems[0] );
- ok( my $foo_filesystem = Sys::Filesystem::filesystems( device => $device ),
- "Get filesystem attached to $device" );
+ $mounted or skip("Format might be unavailable unless mounted",1);
+ ok( $format = $fs->format($filesystem), "Get format for $filesystem" );
}
+ ok( $volume = $fs->volume($filesystem) || 1, "Get volume type for $filesystem" );
+ ok( $label = $fs->label($filesystem) || 1, "Get label for $filesystem" );
+
+ $type = $fs->type($filesystem);
+ diag(
+ join( ' - ',
+ $filesystem, $mounted, $special,
+ $device, $options, $format,
+ $volume || 'n/a', $label || 'n/a', $type || 'n/a' )
+ );
}
+my $device = $fs->device( $filesystems[0] );
+ok( my $foo_filesystem = Sys::Filesystem::filesystems( device => $device ),
+ "Get filesystem attached to $device" );
+
done_testing();