From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

#!/usr/bin/env perl -w
# Subclassing to define the buffer variables
use strict;
use Test::More qw( no_plan );
ok(my $t = MyTTS->new,'object');
$t->DEBUG(0);
ok( $t->compile(q/Just a test/), 'Define output buffer variables');
package MyTTS;
# if you relied on the old interface or relied on the buffer var being $OUT,
# then you have to subclass the module to restore that behaviour.
# (not a good idea though)
sub _output_buffer_var { ## no critic (ProhibitUnusedPrivateSubroutines)
my $self = shift;
my $type = shift || 'scalar';
return $type eq 'hash' ? '$OUT_HASH' # map_keys buffer
: $type eq 'array' ? '$OUT_ARRAY' # list buffer
: '$OUT' # output buffer
;
}