From fb6a4e3d1893cf394778dcae77db790f4571b4a2 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sat, 1 Feb 2014 14:32:47 +0200 Subject: [PATCH] Name subs with Sub::Name --- Makefile.PL | 1 + lib/Gruntmaster/Data.pm | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 068bbb9..4ae4ad6 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -20,6 +20,7 @@ WriteMakefile( IO::Prompter 0 JSON 0 Redis 0 + Sub::Name 0 Term::ANSIColor 0/, }, META_MERGE => { diff --git a/lib/Gruntmaster/Data.pm b/lib/Gruntmaster/Data.pm index 1b2492c..a90149a 100644 --- a/lib/Gruntmaster/Data.pm +++ b/lib/Gruntmaster/Data.pm @@ -4,16 +4,17 @@ use warnings; use parent qw/Exporter/; use JSON qw/encode_json decode_json/; - use Redis; +use Sub::Name qw/subname/; our $contest; my $redis = Redis->new; my $pubsub = Redis->new; sub dynsub{ + our ($name, $sub) = @_; no strict 'refs'; - *{$_[0]} = $_[1]; + *$name = subname $name => $sub } BEGIN { -- 2.30.2