Update of /cvsroot/fink/fink/perlmod/Fink
In directory sc8-pr-cvs17:/tmp/cvs-serv2367
Modified Files:
ChangeLog PkgVersion.pm
Log Message:
parameter-passing and doc cleanups
Index: PkgVersion.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/PkgVersion.pm,v
retrieving revision 1.595
retrieving revision 1.596
diff -u -d -r1.595 -r1.596
--- PkgVersion.pm 28 Aug 2007 13:25:54 -0000 1.595
+++ PkgVersion.pm 30 Aug 2007 01:54:14 -0000 1.596
@@ -1989,23 +1989,15 @@
my $desc = $self->get_desc_detail %options;
Returns the description of the package with percent fields expanded but
-otherwise unformatted.
-
-=over 4
-
-=item canonical_prefix (optional)
-
-If the value is true, use "/sw" for %p when parsing the DescDetail field
instead
-of the local fink's normal installation path.
-
-=back
+otherwise unformatted. See the _get_text_field method for descriptions
+the %options that are supported.
=cut
# Used by the pdb in the 'dump' script
sub get_desc_detail {
my $self = shift;
- my %options = ( defined $_[0] ? @_ : () );
+ my %options = @_;
return $self->_get_text_field('DescDetail', %options);
}
@@ -2017,48 +2009,47 @@
my $desc = $self->get_desc_usage %options;
Returns the usage description of the package with percent fields expanded but
-otherwise unformatted.
-
-=over 4
-
-=item canonical_prefix (optional)
-
-If the value is true, use "/sw" for %p when parsing the DescUsage field
instead
-of the local fink's normal installation path.
-
-=back
+otherwise unformatted. See the _get_text_field method for descriptions
+the %options that are supported.
=cut
# Used by the pdb in the 'dump' script
sub get_desc_usage {
my $self = shift;
- my %options = ( defined $_[0] ? @_ : () );
+ my %options = @_;
return $self->_get_text_field('DescUsage', %options);
}
+=item _get_text_field
+
+ my $value = $self->_get_text_field $field;
+ my $value = $self->_get_text_field $field, %options;
+
+A private method to retrieve the value of a plain-text $field, with
+percent-expansion performed but no other formatting. The following
+%options are known:
+
+=over 4
+
+=item canonical_prefix (optional)
+
+If the value is true, use "/sw" for %p when parsing the fields content
+instead of the local fink's normal installation path.
+
+=back
+
+=cut
-# PRIVATE: _get_text_field
-#
-# my $content = $self->_get_text_field $field;
-# my $content = $self->_get_text_field $field, %options;
-#
-# Returns the the contents of a text field of the package, unformatted.
-#
-# field:
-# The name of the text field.
-#
-# canonical_prefix (optional):
-# If the value is true, use "/sw" for %p when parsing the fields content
instead
-# of the local fink's normal installation path.
-#
sub _get_text_field {
my $self = shift;
- my $field = shift || '';
- my %options = ( defined $_[0] ? @_ : () );
-
- my $text = '';
+ my $field = shift;
+ my %options = @_;
+
+ unless (defined $field && $self->has_param($field)) {
+ return '';
+ }
# need local copy of the %-exp map so we can change it
my %expand = %{$self->{_expand}};
@@ -2066,16 +2057,10 @@
$expand{p} = '/sw';
}
- if ($field && $self->has_param($field)) {
- $text .= &expand_percent($self->param($field), \%expand,
+ return &expand_percent($self->param($field), \%expand,
$self->get_info_filename.' "$field"', 2);
- }
-
- return $text;
}
-
-
### get installation state
sub is_fetched {
Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v
retrieving revision 1.1486
retrieving revision 1.1487
diff -u -d -r1.1486 -r1.1487
--- ChangeLog 28 Aug 2007 13:25:54 -0000 1.1486
+++ ChangeLog 30 Aug 2007 01:54:14 -0000 1.1487
@@ -1,3 +1,8 @@
+2007-08-29 Daniel Macks <[EMAIL PROTECTED]>
+
+ * PkgVersion.pm: Simplify parameter passing; document wrappers in
+ terms of their back-end.
+
2007-08-28 Benjamin Reed <[EMAIL PROTECTED]>
* PkgVersion.pm: A couple of useful accessor methods used by the
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Fink-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-commits