summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/PackingList.pm
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2004-11-13 11:48:47 +0000
committerMarc Espie <espie@cvs.openbsd.org>2004-11-13 11:48:47 +0000
commit36b86cf7488c3abcd7c043b7b876b446e780c618 (patch)
tree389204beed4cf70e424d3ca81e7b7a752de8b345 /usr.sbin/pkg_add/OpenBSD/PackingList.pm
parentc653ebfbb06a735a5a647944357f87313acff6ef (diff)
likewise, packing-lists state will store refs to cwd, so make this
a true object with cwd()/set_cwd() functions.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/PackingList.pm')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingList.pm37
1 files changed, 31 insertions, 6 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
index a8d004e47dc..e392d9445c7 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingList.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackingList.pm,v 1.36 2004/11/13 11:39:40 espie Exp $
+# $OpenBSD: PackingList.pm,v 1.37 2004/11/13 11:48:46 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -17,20 +17,45 @@
use strict;
use warnings;
+
+package OpenBSD::PackingList::State;
+my $dot = '.';
+
+sub new
+{
+ my $class = shift;
+ bless { default_owner=>'root',
+ default_group=>'bin',
+ default_mode=> 0444,
+ cwd=>\$dot}, $class;
+}
+
+sub cwd
+{
+ return ${$_[0]->{cwd}};
+}
+
+sub set_cwd
+{
+ my ($self, $p) = @_;
+
+ require File::Spec;
+
+ $p = File::Spec->canonpath($p);
+ $self->{cwd} = \$p;
+}
+
package OpenBSD::PackingList;
use OpenBSD::PackingElement;
use OpenBSD::PackageInfo;
-my $dot = '.';
sub new
{
my $class = shift;
bless {state =>
- {default_owner=>'root',
- default_group=>'bin',
- default_mode=> 0444,
- cwd=>\$dot} }, $class;
+ OpenBSD::PackingList::State->new()
+ }, $class;
}
sub read