# RT48642 Can't use inline TagSet (embedded package)
# 
# To apply this patch:
# STEP 1: Chdir to the source directory.
# STEP 2: Run the 'applypatch' program with this patch file as input.
#
# If you do not have 'applypatch', it is part of the 'makepatch' package
# that you can fetch from the Comprehensive Perl Archive Network:
# http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz
# In the above URL, 'x' should be 2 or higher.
#
# To apply this patch without the use of 'applypatch':
# STEP 1: Chdir to the source directory.
# If you have a decent Bourne-type shell:
# STEP 2: Run the shell with this file as input.
# If you don't have such a shell, you may need to manually create
# the files as shown below.
# STEP 3: Run the 'patch' program with this file as input.
#
# These are the commands needed to create/delete files/directories:
#
touch "t/inline-tagset.t"
chmod 0666 "t/inline-tagset.t"
#
# This command terminates the shell and need not be executed manually.
exit
#
#### End of Preamble ####

#### Patch data follows ####
diff -urp --binary "Template-Declare-0.40\MANIFEST" "Template-Declare-0.40.RT48642\MANIFEST"
Index: ./MANIFEST
--- ./MANIFEST	Wed Jul  8 22:23:48 2009
+++ ./MANIFEST	Wed Aug 12 13:48:55 2009
@@ -39,6 +39,7 @@ t/forms.t
 t/importing.t
 t/indent.t
 t/indexhtml.t
+t/inline-tagset.t
 t/instrumentation.t
 t/MyTagSet.pm
 t/namespace.t
diff -urp --binary "Template-Declare-0.40\lib\Template\Declare\Tags.pm" "Template-Declare-0.40.RT48642\lib\Template\Declare\Tags.pm"
Index: ./lib/Template/Declare/Tags.pm
--- ./lib/Template/Declare/Tags.pm	Thu Apr 23 05:28:36 2009
+++ ./lib/Template/Declare/Tags.pm	Wed Aug 12 13:44:11 2009
@@ -57,10 +57,12 @@ sub import {
             "Template::Declare::TagSet::$lang";
 
         ### Loading tag set: $module
-        eval "use $module";
-        if ($@) {
-            warn $@;
-            croak "Failed to load tagset module $module";
+        if (! $module->can('get_tag_list') ) {
+            eval "use $module";
+            if ($@) {
+                warn $@;
+                croak "Failed to load tagset module $module";
+            }
         }
         ### TagSet options: $opts
         my $tagset = $module->new($opts);
diff -urp --binary nul "Template-Declare-0.40.RT48642\t\inline-tagset.t"
Index: ./t/inline-tagset.t
--- ./t/inline-tagset.t	Thu Jan  1 01:00:00 1970
+++ ./t/inline-tagset.t	Wed Aug 12 13:51:54 2009
@@ -0,0 +1,19 @@
+# Test for RT48642 by Olivier Mengué
+
+use Test::More tests => 1;
+
+{
+    package Template::Declare::TagSet::FooBarBaz;
+    use base 'Template::Declare::TagSet';
+    sub get_tag_list {
+        [qw/foo bar baz/]
+    }
+}
+
+eval "use Template::Declare::Tags 'FooBarBaz'";
+my $res = $@;
+SKIP: {
+    skip "T::D::TS::FooBarBaz.pm exists, can't test!" if exists $INC{'Template/Declare/TagSet/FooBarBaz.pm'};
+    ok(!$res, "use inline TagSet");
+    diag $res if $res;
+}
#### End of Patch data ####

#### ApplyPatch data follows ####
# Data version        : 1.0
# Date generated      : Wed Aug 12 13:51:56 2009
# Generated by        : makepatch 2.03
# Recurse directories : Yes
# Excluded files      : (\A|/).*\~\Z
#                       (\A|/).*\.a\Z
#                       (\A|/).*\.bak\Z
#                       (\A|/).*\.BAK\Z
#                       (\A|/).*\.elc\Z
#                       (\A|/).*\.exe\Z
#                       (\A|/).*\.gz\Z
#                       (\A|/).*\.ln\Z
#                       (\A|/).*\.o\Z
#                       (\A|/).*\.obj\Z
#                       (\A|/).*\.olb\Z
#                       (\A|/).*\.old\Z
#                       (\A|/).*\.orig\Z
#                       (\A|/).*\.rej\Z
#                       (\A|/).*\.so\Z
#                       (\A|/).*\.Z\Z
#                       (\A|/)\.del\-.*\Z
#                       (\A|/)\.make\.state\Z
#                       (\A|/)\.nse_depinfo\Z
#                       (\A|/)core\Z
#                       (\A|/)tags\Z
#                       (\A|/)TAGS\Z
# p "MANIFEST" 1330 1250077735 0100666
# p "lib/Template/Declare/Tags.pm" 24026 1250077451 0100666
# c "t/inline-tagset.t" 0 1250077914 0100666
#### End of ApplyPatch data ####

#### End of Patch kit [created: Wed Aug 12 13:51:56 2009] ####
#### Patch checksum: 93 3214 16054 ####
#### Checksum: 123 4280 40372 ####
