Noame has asked for the wisdom of the Perl Monks concerning the following question:
And Failed with the following error: Can't call method "Filesys::DiskSpace::df" without a package or object reference at ./try.pl line 27. Please advice. Thanks.#! /usr/local/bin/perl BEGIN { push ( @INC, "$ENV{HOME}/Filesys-DiskSpace-0.05/lib"); # Filesys:: +DiskSpace - Perl df } use strict; use warnings; require Filesys::DiskSpace; # file system /home or /dev/sda5 my $dir = "/home"; # get data for /home fs my ($fs_type, $fs_desc, $used, $avail, $fused, $favail) = Filesys::Dis +kSpace::df $dir; # calculate free space in % my $df_free = (($avail) / ($avail+$used)) * 100.0; # display message my $out = sprintf("Disk space on $dir == %0.2f\n",$df_free); print $out;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: import external package
by JavaFan (Canon) on Jan 22, 2009 at 19:40 UTC | |
|
Re: import external package
by kyle (Abbot) on Jan 22, 2009 at 19:44 UTC | |
|
Re: import external package
by Anonymous Monk on Jan 23, 2009 at 13:19 UTC |