/usr/share/doc/libaspect-perl/examples/Singleton/oop.pl is in libaspect-perl 1.04-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #!/usr/bin/perl
use strict;
use warnings;
my $printer1 = Printer->new;
my $printer2 = Printer->new;
print 'using new(): '. ($printer1 eq $printer2? '': 'not '). "equal\n";
my $printer3 = Printer->instance;
my $printer4 = Printer->instance;
print 'using instance(): '. ($printer3 eq $printer4? '': 'not '). "equal\n";
# -----------------------------------------------------------------------------
package Printer;
my $Instance;
sub instance { $Instance ||= Printer->new }
sub new { bless {}, shift }
|