1g/5\.12\.3/s//@VERSION@/g 2/^=head2 Installation Prefix/i 3=head1 Customizations in Apple's Perl 4 5Several custom features have been added to the version of perl in Mac OS X. 6 7=head2 Module Search Path (@INC) 8 9Since 10.4 "Tiger", system administrators can easily add paths to perl's 10module search path. 11The file '/Library/Perl/${version}/PrependToPath' contains paths (one per 12line) that will be added to the beginning of the search path, while the file 13'/Library/Perl/${version}/AppendToPath' contains paths that will be added 14to the end of the search path. 15 16By default, Mac OS X does not come with a PrependToPath file, but does come 17with an AppendToPath file. 18This file contains the path '/System/Library/Perl/Extras/${version}', where 19third-party perl modules that Apple ships on Mac OS X, are installed. 20In addition, it contains the paths to previous versions of 21'/Library/Perl/${version}' (where ${version} are the previous versions of perl 22that shipped in Mac OS X), to maintain backwards compatibility. 23 24In 10.5 "Leopard" and beyond, the environment variable NO_PERL_PREPENDTOPATH 25(set to anything) will cause perl to not load any PrependToPath file. 26Likewise, the NO_PERL_APPENDTOPATH environment variable will case perl to not 27load any AppendToPath file. 28 29In 10.5.7 for versions of perl before @VERSION@, there is a new path, 30'/Library/Perl/Updates/${version}' that comes before the system perl directory. 31When 'INSTALLDIRS=perl' is specified to Makefile.PL, modules that 32previous overwrite those in '/System/Library/Perl/${version}', will now be 33install in '/Library/Perl/Updates/${version}'. 34This allows Apple to update modules in the system perl, but users will 35get the versions they installed in '/Library/Perl/Updates/${version}'. 36 37In addition, the Config parameters "installprivlib" and "installarchlib" now 38corresponds to this new directory. 39There are also the new parameters "installupdateslib", "installupdatesarch", 40"updateslib" and "updatesarch", which also correspond to this new directory, 41and are provided for completeness. 42 43However, for perl @VERSION@ in Mac OS X 10.7, the order of the include 44paths was changed so that '/Library/Perl/@VERSION@' came before 45'/System/Library/Perl/@VERSION@', so '/Library/Perl/Updates' is no longer needed. 46The Config parameters "installprivlib" and "installarchlib" have returned 47to their original values, and "installupdateslib", "installupdatesarch", 48"updateslib" and "updatesarch" have been removed. 49 50=head2 Dtrace Support 51 52Dtrace support has been added to perl to allow tracing of perl subroutine 53calls, both entry and return. 54Here is a quick example: 55 56 % cat test.pl 57 #!/usr/bin/perl 58 59 sub a { 60 print "Ah! death. Welcome to thee brother\n"; 61 } 62 63 sub b { 64 print "Where art thou a()?\n"; 65 a(); 66 } 67 68 sub c { 69 print "The band of alphabets\n"; 70 b(); 71 } 72 73 sub main { 74 c(); 75 } 76 77 main(); 78 % cat pltest.d 79 perl$target::: 80 { 81 printf("%s\n", copyinstr(arg0)); 82 } 83 % sudo dtrace -s pltest.d -c 'perl test.pl' 84 dtrace: description 'perl$target::: ' matched 8 probes 85 The band of alphabets 86 Where art thou a()? 87 Ah! death. Welcome to thee brother 88 dtrace: pid 50272 has exited 89 CPU ID FUNCTION:NAME 90 0 14231 Perl_pp_entersub:sub-entry main 91 92 0 14231 Perl_pp_entersub:sub-entry c 93 94 0 14231 Perl_pp_entersub:sub-entry b 95 96 0 14231 Perl_pp_entersub:sub-entry a 97 98 0 15806 Perl_pp_leavesub:sub-return a 99 100 0 15806 Perl_pp_leavesub:sub-return b 101 102 0 15806 Perl_pp_leavesub:sub-return c 103 104 0 15806 Perl_pp_leavesub:sub-return main 105 106=head2 64-bit Support 107 108Since 10.5 "Leopard", Mac OS X provided both 32 and 64-bit support for libraries 109and frameworks, allowing both 32 and 64-bit applications to be written. 110While running perl (and all other command-line programs) remained 32-bit, the 111'libperl.dylib' library is 32/64 bits. 112This allows programs with embedded 113perl support to run in both 32 and 64-bit mode as needed. 114 115To support this, changes to the Config module were made to return the correct 116values for the internal sizes of perl types. 117For example, "longsize" return 4 in 32-bits, while it returns 8 in 64-bits. 118 119Related to this support is the new environment variable ARCHFLAGS, which 120provides a way to build extensions for different machine and 32/64-bit 121architectures. 122The default architecture to build extensions before 10.5 was the (single) 123architecture of the building machine. 124In 10.5, this became building both 32-bit PowerPC and Intel. 125In 10.6 and beyond, the default architectures were changed to building 32-bit 126for both PowerPC and Intel, and 64-bit only for Intel. 127With ARCHFLAGS, this can be changed to whatever architectures the user 128wants to build. 129For example: 130 131 % env ARCHFLAGS='-arch i386 -arch x86_64' perl Makefile.PL 132 % make 133 % make install 134 135will build only 2-way universal. 136 137=head2 Multiple Version Support 138 139Since 10.6 "SnowLeopard", more than one version of perl are supported. 140So out of the box, the default version of perl is @VERSION_DEFAULT@. 141However, to provide backwards compatibility with previous versions of perl, 142especially for systems that have installed (version-specific) perl modules, or 143to provide newer versions of perl that we aren't ready to make the default, 144'/usr/bin/perl' can be switched to use an alternate version, on a per-user or 145system-wide basis. 146The alternate version of perl that is provided is @VERSION_ALT@. 147 148Users can select the alternate version 149by simply running the following command: 150 151 % defaults write com.apple.versioner.perl Version @VERSION_ALT@ 152 153Subsequent invocations of '/usr/bin/perl' will then use the @VERSION_ALT@ version. 154 155In addition, both perl versions will ship as a universal binary containing 15664-bit support, which will be on by default. 157For those cases where 32-bit perl is desired, the following command can 158be used: 159 160 % defaults write com.apple.versioner.perl Prefer-32-Bit -bool yes 161 162To set defaults systemwide, use the above commands, but replace the third 163argument with '/Library/Preferences/com.apple.versioner.perl' (admin privileges 164will be required). 165 166The environment variables VERSIONER_PERL_VERSION (set to one of the supported versions) and 167VERSIONER_PERL_PREFER_32_BIT (set to 'true', 'false', 'yes', 'no', '1' or '0') 168can also be set, and they override the settings in any preference files. 169 170Note: this may changes in future versions of Mac OS X, which may use 171an improved scheme for making such settings. 172 173=head1 Building Perl 174 175. 176/64-bit PPC support/s//64-bit Support/ 177/PPC64/s//64-bit/ 178/^Last modified /s/ [^ ]*$/ 2011-10-31./ 179w 180