From: espie Date: Sat, 27 May 2023 10:06:38 +0000 (+0000) Subject: finish making this a singleton class (which I don't always like X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b48b4bf778f3580d62d268d3410999a637beac1c;p=openbsd finish making this a singleton class (which I don't always like and is definitely worthy of a comment) --- diff --git a/usr.sbin/pkg_add/OpenBSD/Tracker.pm b/usr.sbin/pkg_add/OpenBSD/Tracker.pm index 0b043bccdda..8ea46e51cce 100644 --- a/usr.sbin/pkg_add/OpenBSD/Tracker.pm +++ b/usr.sbin/pkg_add/OpenBSD/Tracker.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Tracker.pm,v 1.29 2018/10/22 10:29:06 espie Exp $ +# $OpenBSD: Tracker.pm,v 1.30 2023/05/27 10:06:38 espie Exp $ # # Copyright (c) 2009 Marc Espie # @@ -32,12 +32,14 @@ use strict; use warnings; package OpenBSD::Tracker; + +# XXX we're a singleton class our $s; sub new { my $class = shift; - return $s = bless {}, $class; + return $s //= bless {}, $class; } sub dump2