From b48b4bf778f3580d62d268d3410999a637beac1c Mon Sep 17 00:00:00 2001 From: espie Date: Sat, 27 May 2023 10:06:38 +0000 Subject: [PATCH] finish making this a singleton class (which I don't always like and is definitely worthy of a comment) --- usr.sbin/pkg_add/OpenBSD/Tracker.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 -- 2.20.1