HEX
Server: Apache
System: Linux server-634962.emtiyz.com 5.14.0-611.11.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Dec 3 09:47:37 EST 2025 x86_64
User: codo66ho (1003)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //home/.cpan/build/Template-Toolkit-3.102-0/t/block_duplicate.t
use strict;
use warnings;

use Test::More tests => 1;

use Template;

my $warning_seen;
local $SIG{__WARN__} = sub {
    my @warnings = @_;
    if ($warnings[0] =~ /Block redefined: b1/) {
        ++$warning_seen;
    } else {
        die "Unexpected warning: ", @warnings;
    }
};

my $t = Template->new;
$t->process(\ << '__TEMPLATE__', {}, \ my $ignore_output);
[% BLOCK b1 %]first[% END %]
[% BLOCK b1 %]second[% END %]
__TEMPLATE__

is $warning_seen, 1, 'warning seen';