Package: perl-doc
Version: 5.8.8-6
Severity: normal

perlrun doesn't mention that -CSD is scoped so it only affects the main
program file or -e line and not any modules or other files. But it seems
that it is:

[EMAIL PROTECTED]:~/src/ikiwiki>cat foo.pl 
#!/usr/bin/perl -CSD

sub readfile ($) {
        my $file=shift;

        local $/=undef;
        open (IN, $file) || error("failed to read $file: $!");
        my $ret=<IN>;
        close IN;
        return $ret;
}

use Encode;
print "utf: ".Encode::is_utf8(readfile("/etc/passwd"))."\n";

1
[EMAIL PROTECTED]:~/src/ikiwiki>./foo.pl
utf: 1
[EMAIL PROTECTED]:~/src/ikiwiki>perl -CSD -e 'do "foo.pl"'
utf: 

This is highly suprising when factoring previously utf-clean code out into
modules where it promptly breaks. :-( Needs a big warning IMHO.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-2-686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages perl-doc depends on:
ii  perl                          5.8.8-6    Larry Wall's Practical Extraction 

perl-doc recommends no packages.

-- no debconf information

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature

Reply via email to