diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-05-02 15:13:06 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-05-02 15:13:06 +0000 |
commit | 7f1eb8d208053d542a80b3e94acc7374c0c6112d (patch) | |
tree | a1faa4e5b2f5cfcb75a7d3103cee217dccf452b0 /usr.sbin/pkg_add/OpenBSD | |
parent | f06529114330fdfa04fa084eeb7f011d4faadee9 (diff) |
replace abstract Factory name with a more sensible create name.
Call it OO, so that we can specialize it if we ever need it.
Be more explicit about parameters.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 18 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingList.pm | 4 |
2 files changed, 11 insertions, 11 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 28dc74215cf..20783f43c94 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingElement.pm,v 1.99 2007/05/02 15:05:30 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.100 2007/05/02 15:13:04 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -23,23 +23,23 @@ use OpenBSD::PackageInfo; require 5.008_000; # This is the basic class, which is mostly abstract, except for -# and Factory and register_with_factory. +# create and register_with_factory. # It does provide base methods for stuff under it, though. package OpenBSD::PackingElement; our %keyword; -sub Factory +sub create { - local $_ = shift; - if (m/^\@(\S+)\s*/) { + my ($class, $line, $plist) = @_; + if ($line =~ m/^\@(\S+)\s*(.*)/) { if (defined $keyword{$1}) { - $keyword{$1}->add(@_, $'); + $keyword{$1}->add($plist, $2); } else { - print STDERR "Unknown element: $_\n"; - exit(1); + print STDERR "Unknown element: $line\n"; + exit 1 ; } } else { - OpenBSD::PackingElement::File->add(@_, $_); + OpenBSD::PackingElement::File->add($plist, $line); } } diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm index 3cbbf2c7d32..0458f6e0b0c 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.60 2007/05/02 15:05:30 espie Exp $ +# $OpenBSD: PackingList.pm,v 1.61 2007/05/02 15:13:05 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -73,7 +73,7 @@ sub read local $_ = shift; return if m/^\s*$/; chomp; - OpenBSD::PackingElement::Factory($_, $plist); + OpenBSD::PackingElement->create($_, $plist); if ($plist->{need_modules}) { close($fh); open($fh, '<', '/dev/null'); |