package Text::Wigwam::Library::Character;

    use strict;
    use warnings;
    our $VERSION = '0.01';

    use base q/Exporter/;

    use Text::Wigwam::Const qw/ NUM STRING /;

    our %EXPORT_TAGS = (
        all => [
          qw/
            _proto_asc _asc
            _proto_chr _chr
            _proto_ord _ord
          /
        ],
        asc => [ qw/ _proto_asc _asc / ],
        chr => [ qw/ _proto_chr _chr / ],
        ord => [ qw/ _proto_ord _ord / ],
    );

    our @EXPORT_OK = @{
        $EXPORT_TAGS{'all'}
    };
    our @EXPORT = qw( );

=head1 Name

Text::Wigwam::Library::Character - A Wigwam directive library.

=head1 Description

This library provides several directives which are useful for manipulating character data.

=head1 Usage

The directives within this library can be imported into specific branches of
the directive tree (which transcends from  C<Text::Wigwam::Directives>) via
plug-ins or modules using one of the following techniques.

 package Text::Wigwam::Directives::some::arbitrary::branch;
 # import everything
 use Text::Wigwam::Library::Character qw/:all/;

 package Text::Wigwam::Directives::another::arbitrary::branch;
 # import selectively
 use Text::Wigwam::Library::Character(
  qw/ :asc :chr :ord /
 );

=head1 Directives

=cut

sub _proto_asc { _proto_ord(@_) }
sub _asc { _ord(@_) }

=head2 #asc I<chr>

Returns the unsigned ASCII value of I<chr>.

 [!! #ord "a" /* output: 97 */ !!]

=cut

sub _proto_chr { [ NUM ] }
sub _chr { chr $_[0]->get_arg }

=head2 #chr I<num>

Returns the ASCII character represented by I<num>.

 [!! #chr 98 /* output: b */ !!]

=cut

sub _proto_ord { [ STRING ] }
sub _ord { ord $_[0]->get_arg }

=head2 #ord I<chr>

Same as C<#asc>.

 [!! #ord "b" /* output: 98 */ !!]

=cut

1;
