Decode::Source - Run scripts written in encodings other than utf-8


NAME

Decode::Source - Run scripts written in encodings other than utf-8


SYNOPSIS

    use Decode::Source "iso-8859-1";
       ... code written in ISO-8859-1 ...
    use Decode::Source "cp-850";
       ... code written in DOS codepage 850 ...
    no Decode::Source;
        ... code written in US-ASCII ...


ABSTRACT

Use alternative encodings/charsets for your program code. Perl 5.8 or higher is required for use of this module.


DESCRIPTION

This code is so far only tested on Win32 platforms!

Decode::Source makes it possible to write perl programs in any script or encoding supported by the Encode module. Variable names can contain non-ASCII characters, just as when you use the use utf8 pragma. All theese characters, both in identifiers and string literals, will be decoded to perl's internal utf-8 form, before execution.

The syntax are similar to use utf8 and no utf8, but Decode::Source also takes an optional argument with source encoding. This argument can be any argument that Encode's decode function accept as a valid encoding. See also the Encode manpage.


EXAMPLE

  use Decode::Source "windows-1252";

  $åke   = ["Åke Braun", "08-555 55 55"];
  $örjan = ["Örjan Älg", "08-555 55 54"];
  binmode STDOUT, ":encodings(cp850)";

  printf "Name: %-20s   Phone: %12s\n", @$_ for $åke, $örjan;


SEE ALSO

the Encode manpage, the Encode::Supported manpage, the utf8 manpage


AUTHOR

Magnus Håkansson, <mailto:magnus@mbox604.swipnet.se>


COPYRIGHT AND LICENSE

Copyright 2003 by Magnus Håkansson

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

 Decode::Source - Run scripts written in encodings other than utf-8