Data::Section::Pluggable::Plugin::Trim - Data::Section::Pluggable plugin that trims whitespace
version 0.08
use Data::Section::Pluggable; my $dsp = Data::Section::Pluggable->new ->add_plugin('trim'); # prints "Welcome to Perl" without prefix # or trailing white space. say $dsp->get_data_section('hello.txt'); __DATA__ @@ hello.txt Welcome to Perl __END__
This plugin trims leading and trailing whitespace from data in __DATA__
. This is sometimes useful or these data sections tend to include a lot of extra whitespace if you want to space the different sections apart.
By default, this plugin only operates on files with the txt
extension, but you can override this with the "extensions" property.
$dsp->plugin( 'trim', extensions => \@extensions );
Array reference of filename extensions whitespace should be trimmed from. If not provided, only txt
will get trimmed.
Graham Ollis <plicease@cpan.org>
This software is copyright (c) 2024 by Graham Ollis.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.