CARVIEW |
Select Language
HTTP/2 200
server: nginx
content-type: text/plain;charset=UTF-8
content-encoding: gzip
content-security-policy: default-src 'self'; connect-src 'self' *.google-analytics.com; img-src 'self' data: www.google-analytics.com www.googletagmanager.com; script-src 'self' 'unsafe-inline' www.google-analytics.com www.googletagmanager.com; style-src 'self'; report-uri /csp-reports
accept-ranges: bytes
age: 0
date: Tue, 14 Oct 2025 00:01:49 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210020-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1760400109.128142,VS0,VE750
vary: Accept-Encoding
strict-transport-security: max-age=31557600
content-length: 833
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> 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> is a synonym for S>. They may
be used interchangeably.
S> 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> turns off any UTF-8/ASCII expectations for the
remainder of its scope. The meaning of non-ASCII characters is then
undefined.
S> is automatically enabled within the
lexical scope of a S> or higher.
=head1 SEE ALSO
L
=cut