• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

ChangesH A D25-Jun-2006576 1611

DfPortable.pmH A D25-Jun-20069.9 KiB304122

MANIFESTH A D11-May-2006184 1211

META.ymlH A D25-Jun-2006308 119

Makefile.PLH A D14-May-20064.5 KiB187134

READMEH A D25-Jun-20065.2 KiB13091

XS_statfsH A D14-May-20061.3 KiB6452

XS_statvfsH A D14-May-20061 KiB4838

XS_winH A D23-Jun-20063.3 KiB12396

test.plH A D14-May-20061.1 KiB4022

typemapH A D11-May-2006263 1514

README

1INSTALL
2TO INSTALL RUN:
3
4        perl Makefile.PL
5        make
6        make test
7        make install
8
9
10(On Windows you will probably be using nmake or a ppm file)
11
12During the 'make test', test.pl will try to test with '/' if you are
13using a Unix system or 'C:\' if you are using Windows.
14
15Once installed, run 'perldoc Filesys::DfPortable' for more information.
16
17If you have any problems or questions please email me at IGuthrie@aol.com
18with "DfPortable" in the subject line. If you run into a build problem,
19please include the output of the install commands, the version of Perl
20you are using (perl -v), and what operating system you are using.
21
22
23Module Documentation:
24Filesys::DfPortable - Perl extension for filesystem disk space information.
25
26SYNOPSIS
27
28
29  use Filesys::DfPortable;
30
31  my $ref = dfportable("C:\\"); # Default block size is 1, which outputs bytes
32  if(defined($ref)) {
33     print"Total bytes: $ref->{blocks}\n";
34     print"Total bytes free: $ref->{bfree}\n";
35     print"Total bytes avail to me: $ref->{bavail}\n";
36     print"Total bytes used: $ref->{bused}\n";
37     print"Percent full: $ref->{per}\n"
38  }
39
40  my $ref = dfportable("/tmp", 1024); # Display output in 1K blocks
41  if(defined($ref)) {
42     print"Total 1k blocks: $ref->{blocks}\n";
43     print"Total 1k blocks free: $ref->{bfree}\n";
44     print"Total 1k blocks avail to me: $ref->{bavail}\n";
45     print"Total 1k blocks used: $ref->{bused}\n";
46     print"Percent full: $ref->{per}\n"
47  }
48
49
50DESCRIPTION
51
52This module provides a portable way to obtain filesystem disk space
53information.
54
55The module should work with all versions of Windows (95 and up),
56and with all flavors of Unix that implement the statvfs or the statfs
57calls. This would include Linux, *BSD, HP-UX, AIX, Solaris, Mac OS X, Irix,
58Cygwin, etc ...
59
60This module differs from Filesys::Df in that it has added support
61for Windows, but does not support open filehandles as a argument.
62
63dfportable() requires a directory argument that represents the filesystem
64you want to query. There is also an optional block size argument so that
65you can tailor the size of the values returned. The default block size
66is 1, this will cause the function to return the values in bytes.
67If you never use the block size argument, then you can think of any
68instance of "blocks" in this document to really mean "bytes".
69
70dfportable() returns a reference to a hash. The keys available in
71the hash are as follows:
72
73{blocks} = Total blocks on the filesystem.
74
75{bfree} = Total blocks free on the filesystem.
76
77{bavail} = Total blocks available to the user executing the Perl
78application. This can be different than bfree if you have per-user
79quotas on the filesystem, or if the super user has a reserved amount.
80bavail can also be a negative value because of this. For instance
81if there is more space being used then you have available to you.
82
83{bused} = Total blocks used on the filesystem.
84
85{per} = Percent of disk space used. This is based on the disk space
86available to the user executing the application. In other words, if
87the filesystem has 10% of its space reserved for the superuser, then
88the percent used can go up to 110%.
89
90
91You can obtain inode information through the module as well. But you
92must call exists() on the {files} key to make sure the information is
93available:
94if(exists($ref->{files})) {
95	#### Inode info is available
96}
97Some filesystems may not return inode information, for
98example Windows, and some NFS filesystems.
99
100Here are the available inode keys:
101
102{files} = Total inodes on the filesystem.
103
104{ffree} = Total inodes free on the filesystem.
105
106{favail} = Total inodes available to the user executing the application.
107See the rules for the {bavail} key.
108
109{fused} = Total inodes used on the filesystem.
110
111{fper} = Percent of inodes used on the filesystem. See rules for the {per}
112key.
113
114
115If the dfportable() call fails for any reason, it will return
116undef. This will probably happen if you do anything crazy like try
117to get information for /proc, or if you pass an invalid filesystem name,
118or if there is an internal error. dfportable() will croak() if you pass
119it a undefined value.
120
121Requirements:
122Your system must contain either statvfs(), statfs(), GetDiskFreeSpaceA(),
123or GetDiskFreeSpaceEx().
124
125You must be running Perl 5.6 or higher.
126
127Copyright (c) 2006 Ian Guthrie. All rights reserved.
128               This program is free software; you can redistribute it and/or
129               modify it under the same terms as Perl itself.
130