package Net::IDN::Nameprep;

use strict;
use utf8;
use warnings;

our $VERSION = "1.102";

require Exporter;
our @ISA    = qw(Exporter);
our @EXPORT = qw(nameprep);

use Unicode::Stringprep 1.1;

use Unicode::Stringprep::Mapping;
use Unicode::Stringprep::Prohibited;

our $_nameprep_stored;
our $_nameprep_query;

sub nameprep {
  my ($input, %param) = @_;
  if (
   || $param{'AllowUnassigned'}
  ) {
    goto &$_nameprep_query;
  } else {
    goto &$_nameprep_stored;

  my @_common_args = (

  our $_nameprep_stored = Unicode::Stringprep->new(

  our $_nameprep_query = Unicode::Stringprep->new(


=encoding UTF-8

=head1 NAME

Net::IDN::Nameprep - A Stringprep Profile for Internationalized Domain Names (S<RFC 3491>)


  use Net::IDN::Nameprep;
  $output = nameprep $input;


This module implements the I<nameprep> specification, which describes how to
prepare internationalized domain name (IDN) labels in order to increase the
likelihood that name input and name comparison work in ways that make sense for
typical users throughout the world.  Nameprep is a profile of the stringprep
protocol and is used as part of a suite of on-the-wire protocols for
internationalizing the Domain Name System (DNS).


This module implements a single function, C<nameprep>, which is exported by default.


=item nameprep( $input [, AllowUnassigned => 1 ] )

Processes C<$input> according to the I<nameprep> specification and
returns the result.

If C<$input> contains characters not allowed for I<nameprep>, it
throws an exception (so use C<eval> if necessary).

This function takes the following optional parameter:


=item AllowUnassigned

(boolean) If set to a false value, unassigned code points in C<$input> are not allowed.

False MUST be used for I<stored strings>.

True MAY be used for I<queries>.

The default is true (backwards compatibility).



=head1 AUTHOR

Claus FE<auml>rber <>

Previous versions written by Tatsuhiko Miyagawa E<lt>miyagawa@bulknews.netE<gt>

=head1 LICENSE

Copyright 2007-2015 Claus FE<auml>rber.

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=head1 SEE ALSO

L<Unicode::Stringprep>, S<RFC 3491> (L<>)