This distribution contains the module Filesys::DfPortable

Filesys::DfPortable - Perl extension for portable filesystem information.

SYNOPSIS


  use Filesys::DfPortable;

  my $ref = dfportable("C:\\"); # Default block size is 1, which outputs bytes
  if(defined($ref)) {
     print"Total bytes: $ref->{blocks}\n";
     print"Total bytes free: $ref->{bfree}\n";
     print"Total bytes avail to me: $ref->{bavail}\n";
     print"Total bytes used: $ref->{bused}\n";
     print"Percent full: $ref->{per}\n"
  }
                                                                                                                
                                                                                                                
  my $ref = dfportable("/tmp", 1024); # Display output in 1K blocks
  if(defined($ref)) {
     print"Total 1k blocks: $ref->{blocks}\n";
     print"Total 1k blocks free: $ref->{bfree}\n";
     print"Total 1k blocks avail to me: $ref->{bavail}\n";
     print"Total 1k blocks used: $ref->{bused}\n";
     print"Percent full: $ref->{per}\n"
  }


DESCRIPTION

This module provides a portable way to obtain filesystem information.

The module should work with all versions of Windows (95 and up),
all flavors of Unix, Mac OS X (Darwin, Tiger, etc), and Cygwin.

dfportable() requires a directory argument that represents the filesystem
you want to query. There is also an optional block size argument so the
you can tailor the size of the values returned. The default for block
size is 1, this will cause the function to return the values in bytes.
If you never use the block size argument then you can think of any
instance of "blocks" in this document to really mean "bytes". 

dfportable() returns a reference to a hash. The keys available in
the hash are as follows:
                                                                                                                
{blocks} = Total blocks on the filesystem.
                                                                                                                
{bfree} = Total blocks free on the filesystem.
                                                                                                                
{bavail} = Total blocks available to the user executing the Perl
application. This can be different than bfree if you have per-user
quotas on the filesystem, or if the super user has a reserved amount.
bavail can also be a negative value because of this. For instance
if there is more space being used than on the disk than is available
to you.
                                                                                                                
{bused} = Total blocks used on the filesystem.
                                                                                                                
{per} = Percent of disk space used. This is based on the disk space
available to the user executing the application. In other words, if
the filesystem has 10% of its space reserved for the superuser, then
the percent used can go up to 110%.)


If the dfportable() call fails for any reason, it will return
undef. This will probably happen if you do anything crazy like try
to get the disk space for /proc, or if you pass an invalid filesystem
 argument, or if there is an internal error. dfportable() will croak()
if you pass it a undefined value.


Requirements:
Your system must contain either statvfs(), statfs(), GetDiskFreeSpaceA(), 
or GetDiskFreeSpaceEx().

You must be running Perl 5.6 or higher.



INSTALL
TO INSTALL RUN:
	
	perl Makefile.PL
	make
	make test
	make install


During the 'make test', test.pl will try to test with '/' if you are
using a Unix system or 'c:\' if you are using Windows. 

Once installed, run 'perldoc Filesys::DfPortable' for more information. 

If you have any problems or questions please email me at IGuthrie@aol.com
with "DfPortable" in the subject line. If you run into a build problem, 
please include the output of the install commands, the version of Perl
you are using (perl -v), and what operating system you are using.

Copyright (c) 2006 Ian Guthrie. All rights reserved.
               This program is free software; you can redistribute it and/or
               modify it under the same terms as Perl itself.
