1 2 3 4 5 6 7 8 9 10 11
if ( $IMPLEMENTED_BY ) { # Allow for custom HomeDir classes # Leave it as the existing value } elsif ( $^O eq 'MSWin32' ) { # All versions of Windows $IMPLEMENTED_BY = 'File::HomeDir::Windows'; ... sub my_home { $IMPLEMENTED_BY->my_home; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#!perl use warnings; use strict; use 5.10.0; use File::HomeDir; use Devel::Peek; use Encode qw( decode ); use Encode::Locale; binmode STDOUT, ':encoding(console_out)'; binmode STDERR, ':encoding(console_out)'; my $d = File::HomeDir->my_home(); Dump $d; say $d; $d = decode( 'locale', $d ); say "================================================"; Dump $d; say $d;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
SV = PVMG(0xc02cbc) at 0xaba78c
REFCNT = 1
FLAGS = (PADMY,POK,pPOK)
IV = 0
NV = 0
PV = 0xc76b4c "C:\\Dokumente und Einstellungen\\h\344ll\366"\0
CUR = 36
LEN = 40
C:\Dokumente und Einstellungen\hällö
================================================
SV = PVMG(0xc02cbc) at 0xaba78c
REFCNT = 1
FLAGS = (PADMY,POK,pPOK,UTF8)
IV = 0
NV = 0
PV = 0xc798b4 "C:\\Dokumente und Einstellungen\\h\303\244ll\303\266"\0 [UTF8 "
C:\\Dokumente und Einstellungen\\h\x{e4}ll\x{f6}"]
CUR = 38
LEN = 40
C:\Dokumente und Einstellungen\hällö