[Debtags-commits] [svn] r1449 -
central-database/branches/alioth/webfrontend
Enrico Zini
enrico at costa.debian.org
Mon Oct 31 08:57:06 UTC 2005
Author: enrico
Date: Mon Oct 31 08:57:03 2005
New Revision: 1449
Modified:
central-database/branches/alioth/webfrontend/Engine.pm
Log:
Reuse Package, Tag and Facet strructures, making it so that two of them pointing to the same thing have the same reference and can be sued to index hashses
Modified: central-database/branches/alioth/webfrontend/Engine.pm
==============================================================================
--- central-database/branches/alioth/webfrontend/Engine.pm (original)
+++ central-database/branches/alioth/webfrontend/Engine.pm Mon Oct 31 08:57:03 2005
@@ -35,9 +35,12 @@
use warnings;
use Carp;
+our %cache;
+
sub new ($$)
{
my ($class, $pkg) = @_;
+ return $cache{$pkg} if exists $cache{$pkg};
return bless {
name => $pkg
}, $class;
@@ -85,11 +88,14 @@
use strict;
use warnings;
+our %cache;
+
sub new ($$)
{
- my ($class, $pkg) = @_;
+ my ($class, $facet) = @_;
+ return $cache{$facet} if exists $cache{$facet};
return bless {
- name => $pkg
+ name => $facet
}, $class;
}
@@ -141,12 +147,14 @@
use warnings;
use Carp;
+our %cache;
+
sub new ($$)
{
- my ($class, $pkg) = @_;
- confess "pkg is undef" if not defined $pkg;
+ my ($class, $tag) = @_;
+ return $cache{$tag} if exists $cache{$tag};
return bless {
- name => $pkg
+ name => $tag
}, $class;
}
More information about the Debtags-commits
mailing list