diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2009-11-11 11:13:17 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2009-11-11 11:13:17 +0000 |
commit | 024f77906b97fce9a8373ec1379798c0bef2117b (patch) | |
tree | a299abbd0e3079ef5ead283c71faadf13569eb42 /usr.sbin/pkg_add/OpenBSD/UpdateSet.pm | |
parent | f18f15fad5f8c520648c53de85793be58f0021b7 (diff) |
remove forwarders, and provide a sensible API that says what's going on
(e.g., we're logging information for later).
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/UpdateSet.pm')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/UpdateSet.pm | 55 |
1 files changed, 22 insertions, 33 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm index e204a0f7cfb..9b701a782ce 100644 --- a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm +++ b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: UpdateSet.pm,v 1.16 2009/11/11 11:01:55 espie Exp $ +# $OpenBSD: UpdateSet.pm,v 1.17 2009/11/11 11:13:16 espie Exp $ # # Copyright (c) 2007 Marc Espie <espie@openbsd.org> # @@ -45,57 +45,46 @@ sub cleanup OpenBSD::SharedItems::cleanup($self, $state); } -package OpenBSD::pkg_foo::State; +package OpenBSD::Log; use OpenBSD::Error; +our @ISA = qw(OpenBSD::Error); -sub new -{ - my $class = shift; - my $o = bless {}, $class; - $o->init(@_); - return $o; -} - -sub init +sub set_context { - my $self = shift; - $self->{l} = OpenBSD::Error->new; + &OpenBSD::Error::set_pkgname; } -sub log +sub dump { - my $self = shift; - return $self->{l}; + &OpenBSD::Error::delayed_output; } -sub set_pkgname -{ - my $self = shift; - $self->log->set_pkgname(@_); -} -sub print -{ - my $self = shift; - $self->log->print(@_); -} +package OpenBSD::pkg_foo::State; +use OpenBSD::Error; -sub warn +sub new { - my $self = shift; - $self->log->warn(@_); + my $class = shift; + my $o = bless {}, $class; + $o->init(@_); + return $o; } -sub fatal +sub init { my $self = shift; - $self->log->fatal(@_); + $self->{l} = OpenBSD::Log->new; } -sub delayed_output +sub log { my $self = shift; - $self->log->delayed_output(@_); + if (@_ == 0) { + return $self->{l}; + } else { + $self->{l}->print(@_); + } } sub system |