summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageLocation.pm27
-rw-r--r--usr.sbin/pkg_add/pod/OpenBSD::PkgSpec.pod6
2 files changed, 15 insertions, 18 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm
index edf77c7c328..00d0a435c4a 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageLocation.pm,v 1.17 2009/04/19 15:18:23 espie Exp $
+# $OpenBSD: PackageLocation.pm,v 1.18 2010/01/12 10:14:37 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -22,6 +22,7 @@ package OpenBSD::PackageLocation;
use OpenBSD::PackageInfo;
use OpenBSD::Temp;
+use OpenBSD::Error;
sub new
{
@@ -56,25 +57,17 @@ sub name
return $self->{name};
}
-sub pkgname
-{
+OpenBSD::Auto::cache(pkgname,
+ sub {
my $self = shift;
- if (!defined $self->{pkgname}) {
- require OpenBSD::PackageName;
-
- $self->{pkgname} = OpenBSD::PackageName->from_string($self->name);
- }
- return $self->{pkgname};
-}
+ return OpenBSD::PackageName->from_string($self->name);
+ });
-sub update_info
-{
+OpenBSD::Auto::cache(update_info,
+ sub {
my $self = shift;
- if (!defined $self->{update_info}) {
- $self->{update_info} = $self->grabPlist(\&OpenBSD::PackingList::UpdateInfoOnly);
- }
- return $self->{update_info};
-}
+ return $self->grabPlist(\&OpenBSD::PackingList::UpdateInfoOnly);
+ });
# make sure self is opened and move to the right location if need be.
diff --git a/usr.sbin/pkg_add/pod/OpenBSD::PkgSpec.pod b/usr.sbin/pkg_add/pod/OpenBSD::PkgSpec.pod
index e26ee221344..f06bbd5afe6 100644
--- a/usr.sbin/pkg_add/pod/OpenBSD::PkgSpec.pod
+++ b/usr.sbin/pkg_add/pod/OpenBSD::PkgSpec.pod
@@ -1,4 +1,4 @@
-$OpenBSD: OpenBSD::PkgSpec.pod,v 1.6 2009/11/10 14:42:14 espie Exp $
+$OpenBSD: OpenBSD::PkgSpec.pod,v 1.7 2010/01/12 10:14:37 espie Exp $
=head1 NAME
@@ -21,3 +21,7 @@ extract matching package names from a C<@list>. The resulting list
C<@sublist> will only hold the package names that match the specification.
For performance reason, the result may contain duplicates.
+
+Note that any pattern will create a C<PkgSpec> object. If the syntax is
+incorrect, the resulting object won't match anything. Use
+C<$spec-E<gt>is_valid> to check for correctness.