Groups > Novell > Perl for NetWare > Re: volscgi purgeable space




volscgi purgeable space

volscgi purgeable space
Tue, 23 May 2006 03:57:05 GMT
I'm having some trouble with getting purgeable space to display using
volscgi, the code is fairly similar to the sample volscgi script, but with
a purgeablespace part added...

# Create an HTML table based on the values from the db
#
print "<table border><TD>";
print "<tr><B><th>Description</th><th>Total
Space</th><th>Free
Space</th><th>Block Size</th><th>Total
Dir<th/></tr>";
my $vm;
if ($] < 5.006) {
	$vm = UCSExt->new("UCX:Volumemgr");
} else {
	$vm = Perl2UCS->new("UCX:Volumemgr");
}
my $db = $vm->{"Volumes"}; # fails for the first time in mod_perl
my $retVal1 = $db->reset();
$retVal1 = $db->hasMoreElements();
do
{
    my $retVal2 = $db->Next();
    my $retVal3 = $retVal2->{"Name"};
    my $tb      = $retVal2->{"TotalSpace"};
    my $fb      = $retVal2->{"PurgeableSpace"};
    print "<tr><td> ";
    print $retVal3;
    print "</td>";
    print "<td>";
    print $tb;
    print "</td>";
    print "<td>";
    print $fb;
    print "</td><td>";
    my $mt      = $retVal2->{"BlockSize"};
    print $mt;
    print "</td><td>";
    $mt      = $retVal2->{"TotalDir"};
    print $mt;
    print "</td></tr>";
    $retVal1 = $db->hasMoreElements();
} while ($retVal1);
print "</table>";

I'd expect this to fill in the 'freespace' column with the purgeable space
values, but all i get is empty table spaces, there is a PurgeableSpace
variable available, but it doesnt seem to work with perl?
Post Reply
Re: volscgi purgeable space
Thu, 01 Jun 2006 05:23:31 GMT
#-----------------------------------------------------------------------------
# Reports the free space available in the volume given as the argument
#-----------------------------------------------------------------------------
sub GetFreeSpace
{
   my $volname = $_[0];
   $verbose && print "Computing free space for volume
$volnamen";
   if ($] < 5.006) {
      $volume_mgr = UCSExt->new("UCX:Volumemgr") or die "Can't
get
UCX:Volumemgr";
   } else {
      $volume_mgr = Perl2UCS->new("UCX:Volumemgr") or die
"Can't get
UCX:Volumemgr";
   }
   my $volumes = $volume_mgr->{"VOLUMES"};
   my $volume = $volumes->Element($volname);
   my $freespace = $volume->{"FreeSpace"} +
$volume->{"PurgableSpace"};
   return $freespace;
}

Regards
K.Murugan


phrostyboi wrote:

> I'm having some trouble with getting purgeable space to display using
> volscgi, the code is fairly similar to the sample volscgi script, but with
> a purgeablespace part added...

> # Create an HTML table based on the values from the db
> #
> print "<table border><TD>";
> print
"<tr><B><th>Description</th><th>Total
Space</th><th>Free
> Space</th><th>Block Size</th><th>Total
Dir<th/></tr>";
> my $vm;
> if ($] < 5.006) {
> 	$vm = UCSExt->new("UCX:Volumemgr");
> } else {
> 	$vm = Perl2UCS->new("UCX:Volumemgr");
> }
> my $db = $vm->{"Volumes"}; # fails for the first time in
mod_perl
> my $retVal1 = $db->reset();
> $retVal1 = $db->hasMoreElements();
> do
> {
>     my $retVal2 = $db->Next();
>     my $retVal3 = $retVal2->{"Name"};
>     my $tb      = $retVal2->{"TotalSpace"};
>     my $fb      = $retVal2->{"PurgeableSpace"};
>     print "<tr><td> ";
>     print $retVal3;
>     print "</td>";
>     print "<td>";
>     print $tb;
>     print "</td>";
>     print "<td>";
>     print $fb;
>     print "</td><td>";
>     my $mt      = $retVal2->{"BlockSize"};
>     print $mt;
>     print "</td><td>";
>     $mt      = $retVal2->{"TotalDir"};
>     print $mt;
>     print "</td></tr>";
>     $retVal1 = $db->hasMoreElements();
> } while ($retVal1);
> print "</table>";

> I'd expect this to fill in the 'freespace' column with the purgeable space
> values, but all i get is empty table spaces, there is a PurgeableSpace
> variable available, but it doesnt seem to work with perl?

Post Reply
about | contact