Your IP : 216.73.216.21


Current Path : /pkg/perl/.plenv/versions/5.42.2/lib/5.42.2/source/
Upload File :
Current File : //pkg/perl/.plenv/versions/5.42.2/lib/5.42.2/source/encoding.pm

package source::encoding;

use v5.40;

our $VERSION = '0.01';

our $ascii_hint_bits = 0x00000010;

sub import {
    unimport();     # Get rid of any 'use utf8'
    my (undef, $arg) = @_;
    if ($arg eq 'utf8') {
        require utf8;
        utf8->import;
        return;
    }
    elsif ($arg eq 'ascii') {
        $^H |= $ascii_hint_bits;
        return;
    }

    die "Bad argument for source::encoding: '$arg'";
}

sub unimport {
    $^H &= ~$ascii_hint_bits;
    utf8->unimport;
}

1;
__END__

=head1 NAME

source::encoding -- Declare Perl source code encoding

=head1 SYNOPSIS

 use source::encoding 'ascii';
 use source::encoding 'utf8';
 no source::encoding;

=head1 DESCRIPTION

These days, Perl code either generally contains only ASCII characters with
C<\x{}> and similar escapes to represent non-ASCII, or C<S<use utf8>> is used
to indicate that the source code itself contains characters encoded as UTF-8.

That means that a character in the source code not meeting these criteria is
often a typographical error.  This pragma is used to tell Perl to raise an
error when this happens.

S<C<use source::encoding 'utf8'>> is a synonym for S<C<use utf8>>.  They may
be used interchangeably.

S<C<use source::encoding 'ascii'>> turns off any UTF-8 expectations, and
raises a fatal error if any character within its scope in the input source
code is not ASCII (or ASCII-equivalent on EBCDIC systems).

S<C<no source::encoding>> turns off any UTF-8/ASCII expectations for the
remainder of its scope.  The meaning of non-ASCII characters is then
undefined.

S<C<use source::encoding 'ascii'>> is automatically enabled within the
lexical scope of a S<C<use v5.41.0>> or higher.

=head1 SEE ALSO

L<utf8>

=cut

https://nalibali.org/post-sitemap.xml 2026-11-20T09:00:00+00:00 https://nalibali.org/page-sitemap.xml 2026-11-18T09:24:11+00:00 https://nalibali.org/stories-sitemap.xml 2026-05-05T06:48:38+00:00 https://nalibali.org/stories-sitemap2.xml 2026-05-05T06:48:38+00:00 https://nalibali.org/audio_stories-sitemap.xml 2026-03-27T06:53:13+00:00 https://nalibali.org/story_cards-sitemap.xml 2025-06-06T10:27:48+00:00 https://nalibali.org/story_seeds-sitemap.xml 2025-05-19T07:35:43+00:00 https://nalibali.org/rhymes-sitemap.xml 2025-06-17T07:43:10+00:00 https://nalibali.org/activity_sheets-sitemap.xml 2025-05-16T09:16:43+00:00 https://nalibali.org/printables-sitemap.xml 2025-05-16T09:28:40+00:00 https://nalibali.org/posters_bookmarks-sitemap.xml 2025-05-16T10:20:22+00:00 https://nalibali.org/team_member-sitemap.xml 2025-05-28T09:40:43+00:00 https://nalibali.org/video_stories-sitemap.xml 2025-06-23T08:48:28+00:00 https://nalibali.org/guides-sitemap.xml 2025-06-17T09:38:41+00:00 https://nalibali.org/story_supplements-sitemap.xml 2025-09-16T12:22:20+00:00 https://nalibali.org/vacancies-sitemap.xml 2026-09-17T07:05:01+00:00 https://nalibali.org/category-sitemap.xml 2026-11-20T09:00:00+00:00 https://nalibali.org/post_tag-sitemap.xml 2026-11-06T00:00:00+00:00 https://nalibali.org/test-sitemap.xml 2025-06-13T09:36:28+00:00 https://nalibali.org/story_categories-sitemap.xml 2026-05-05T06:48:38+00:00 https://nalibali.org/activity_sheets_categories-sitemap.xml 2025-05-16T09:16:43+00:00 https://nalibali.org/printables_categories-sitemap.xml 2025-05-16T09:28:40+00:00 https://nalibali.org/posters_bookmarks_categories-sitemap.xml 2025-05-16T10:20:22+00:00 https://nalibali.org/single_audio-sitemap.xml 2026-03-27T06:53:13+00:00 https://nalibali.org/rhyme_categories-sitemap.xml 2025-06-17T07:43:10+00:00 https://nalibali.org/guide_categories-sitemap.xml 2025-06-17T09:38:41+00:00 https://nalibali.org/author-sitemap.xml 2026-01-22T07:26:07+00:00