From: Steve Scaffidi Date: Thu, 25 Jun 2009 07:42:37 +0000 (-0400) Subject: initial commit for config loading bugfix and test X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=456e158d69d784e044a506a053a2ff671c67c1c9;p=urisagit%2FStem.git initial commit for config loading bugfix and test --- diff --git a/lib/Stem/Conf.pm b/lib/Stem/Conf.pm index 8eed0c4..9def747 100644 --- a/lib/Stem/Conf.pm +++ b/lib/Stem/Conf.pm @@ -230,7 +230,7 @@ sub configure { no strict 'refs' ; - unless ( %{"::${class}"} ) { + unless ( %{"${class}::"} ) { my $module = $class ; $module =~ s{::}{/}g ; diff --git a/t/config/test_stem_bug.pl b/t/config/test_stem_bug.pl new file mode 100644 index 0000000..5f90534 --- /dev/null +++ b/t/config/test_stem_bug.pl @@ -0,0 +1,22 @@ +#!/usr/bin/env perl + +use strict ; +use warnings ; +use Test::More tests => 2; +use Test::Exception; + +use_ok( 'Stem' ); + +my @config = ( + { class => 'Foobar', }, + { class => 'Stem::Console', }, +) ; + + +lives_ok( sub { Stem::Conf::configure( \@config ) }, 'load config from data structure' ); + +package Foobar ; + +sub foobar_cmd { return "FOOBAR!!!\n" } + +