|
NAMEFreeBSD::Ports - Class for parsing FreeBSD's Ports INDEX WARNING!This is a very early version of this module. The interface to the class may be changed in the future. The documentation needs improving. Consequently, suggestions, comments and patches are extremely welcome! I believe the correct place to discuss this module is the freebsd-doc mailing list at freebsd-doc@freebsd.org. SYNOPSIS # Describe ports maintained by tom@FreeBSD.org, sorted alphabetically
use FreeBSD::Ports;
my $ports = tie my %port, 'FreeBSD::Ports', '/usr/ports/INDEX';
$ports->maintainer('tom@FreeBSD.org');
$ports->sort('alpha');
foreach my $p (values %port) {
print $p->as_ascii,"\n";
}
# How many ports are there currently?
use FreeBSD::Ports;
my $ports = tie my %port, 'FreeBSD::Ports', '/usr/ports/INDEX';
my $count = scalar keys %port;
print "There are $count ports\n";
# List ports containing 'MPEG' in their comment and present in the
# 'audio' category?
use FreeBSD::Ports;
my $ports = tie my %port, 'FreeBSD::Ports', '/usr/ports/INDEX';
$ports->category('audio');
$ports->match('mpeg', 'COMMENT', 1);
foreach my $name (keys %port) {
print "$name\n";
}
# Any ports which are under the 'www' or 'net' category
use FreeBSD::Ports;
my $all_ports = tie my %port, 'FreeBSD::Ports';
my $www_ports = tie my(%www_port), $all_ports;
$www_ports->category('www');
my $net_ports = tie my(%net_port), $all_ports;
$net_ports->category('net');
my %www_or_net_port;
while ( my($key, $value) = (each(%www_port), each(%net_port)) ) {
$www_or_net_port{$key} = $value;
}
DESCRIPTION"FreeBSD::Ports" is a simple interface to the INDEX file used in FreeBSD's ports collection. This class uses Perl's tie interface. See perltie for more information. For further information, or to obtain the latest version of this module, see <URL:http://people.FreeBSD.org/~tom/portpm/>. METHODS
CREDITSThis module is written by Tom Hukins <tom@FreeBSD.org>. Thanks to Nik Clayton, Martin Heinen and Lars Thegler for encouragement, assistance and patches. COPYRIGHTThis module is distributed under the same license as FreeBSD <http://www.FreeBSD.org/copyright/freebsd-license.html>. POD ERRORSHey! The above document had some coding errors, which are explained below:
|