Filter-Template

 view release on metacpan or  search on metacpan

lib/Filter/Template/UseBytes.pm  view on Meta::CPAN


# Because the conditionals are evaluated at compile time, it's
# imperative that the things they test be defined.  The BEGIN block
# makes sure HAS_BYTES is defined before the tests are executed.

BEGIN {
	eval "use bytes; sub HAS_BYTES () { 1 }";
	eval "sub HAS_BYTES () { 0 }" if $@;
};

if (HAS_BYTES) { # include
template use_bytes {
	use bytes;
}
} else { # include
template use_bytes {
}
} # include

1;

__END__

=head1 NAME

Filter::Template::UseBytes - conditionally use bytes.pm depending on availability

=head1 VERSION

version 1.043

=head1 SYNOPSIS

	use Filter::Template ( isa => "Filter::Template::UseBytes" );

	print "Phi length in characters: ", length(chr(0x618)), "\n";
	{% use_bytes %}
	print "Phi length in bytes: ", length(chr(0x618)), "\n";

=head1 DESCRIPTION

The UseBytes template evaluates to C<use bytes;> if Perl 5.005_55 or
later is running.  Otherwise it evaluates to an empty string, which
does nothing but doesn't throw an exception either.

=head1 BUGS

All the caveats of L<Filter::Template> apply here.

=head1 SEE ALSO

L<Filter::Template>.

=head1 AUTHOR & COPYRIGHT

Filter::Template::UseBytes is Copyright 2000-2013 Rocco Caputo.  All
rights reserved.  Filter::Template::UseBytes is free software; you may
redistribute it and/or modify it under the same terms as Perl itself.

Filter::Template::UseBytes was previously known as
POE::Macro::UseBytes.

=cut



( run in 0.944 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )