[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#37999: PROPOSED]: A pre-install required space checking mechanism for Debian packages



M> Look at this script:

 OK...  Thank you for the Perl example.  I've just begun to learn the
 language...   I have a question that no doubt I can answer on my own
 after actually readin ALL of the perl manuals (I have the `info'
 version, and have read part of it, and all of the camel book, as well 
 as some of a few other books on Perl...)...

 Why must you call `print_du' like that...  Let's see.  The "('Size
 Data' => $data)" constructs a reference to a hash with one key, "Size 
 Data".  Why can't you just do something more like:

 my $data = &check_du();
 &print_du($data);

 ... then in &print_du, assign `my %params' as `my $data = $_[1]'?

 I'll go ahead and mail this anyway, then hit the info's.


sub print_du {
  my %params = @_;
  croak("Need argument 'Size Data'") unless defined $params{'Size Data'};
  
  
  for (sort keys %{$params{'Size Data'}}) {
    next unless $params{'Size Data'}{$_}{'Size'};
    printf "%10d %s\n", $params{'Size Data'}{$_}{'Size'}, 
                        $params{'Size Data'}{$_}{'Name'};
  }
}

sub test_du {
  my $data = &check_du();
  &print_du('Size Data' => $data);
}



-- 
mailto:psu25682@odin.cc.pdx.edu (Karl M. Hegbloom)
mailto:karlheg@debian.org (Karl M. Hegbloom)
Portland, OR  USA
Debian GNU Potato Linux 2.2  AMD K6-233(@266) XEmacs-21.2beta


Reply to: