From: Dave Rolsky Date: Fri, 5 Dec 2008 17:09:30 +0000 (+0000) Subject: This shuts up a warning I see in my code that uses X-Git-Tag: 0.13~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=32bf84e9c634fea4b2e1b437e4249b1c2ccbc2fa;p=gitmo%2FMooseX-Singleton.git This shuts up a warning I see in my code that uses MX::Singleton. Unfortunately, I cannot really diagnose why I see it there and not in the MX::Singleton tests, so I can't add a test. I'm lame. --- diff --git a/lib/MooseX/Singleton/Meta/Method/Constructor.pm b/lib/MooseX/Singleton/Meta/Method/Constructor.pm index e95e318..eb8aaab 100644 --- a/lib/MooseX/Singleton/Meta/Method/Constructor.pm +++ b/lib/MooseX/Singleton/Meta/Method/Constructor.pm @@ -15,8 +15,8 @@ sub initialize_body { # the author, after all, nothing is free) my $source = 'sub {'; $source .= "\n" . 'my $class = shift;'; - - $source .= "\n" . 'my $existing = do { no strict "refs"; \${"$class\::singleton"}; };'; + + $source .= "\n" . 'my $existing = do { no strict "refs"; no warnings "once"; \${"$class\::singleton"}; };'; $source .= "\n" . 'return ${$existing} if ${$existing};'; $source .= "\n" . 'return $class->Moose::Object::new(@_)';