From: Marius Gavrilescu Date: Sat, 1 Feb 2014 12:32:47 +0000 (+0200) Subject: Name subs with Sub::Name X-Git-Tag: 5999.000_001~8 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=fb6a4e3d1893cf394778dcae77db790f4571b4a2;p=gruntmaster-data.git Name subs with Sub::Name --- 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 {