Difference between revisions of "Install Perl CPAN"

From AwkwardTV
Jump to: navigation, search
(Updating category to include a sort parameter; updating heading levels)
(Perl modules)
Line 26: Line 26:
 
  /usr/share/groff
 
  /usr/share/groff
 
These will be partly overwritten from the recovery partition files.
 
These will be partly overwritten from the recovery partition files.
 +
 +
Prior to installing Perl CPAN, you will need to [[Install_gcc|install gcc]] on the AppleTV.
  
 
==Perl modules==
 
==Perl modules==
Line 38: Line 40:
 
  cp -R /Volumes/OSBoot\ 1/System/Library/Perl /System/Library/
 
  cp -R /Volumes/OSBoot\ 1/System/Library/Perl /System/Library/
 
  umount /Volumes/OSBoot\ 1
 
  umount /Volumes/OSBoot\ 1
 +
 +
You also need to populate the directory <code>/System/Library/Perl/5.8.6/darwin-thread-multi-2level/CORE/</code> with <code>.h</code> files. I haven't found them on the [[Install_SSH_with_Leopard#Darwin_x86_iso|Darwin ISO]], but on a Mac with OS 10.4 (a.k.a. Tiger) and xCode tools installed.
  
 
Configure CPAN (make it simple: answer <code>no</code> to the first question):
 
Configure CPAN (make it simple: answer <code>no</code> to the first question):
Line 45: Line 49:
 
  perl -MCPAN -e 'install Bundle::CPAN'
 
  perl -MCPAN -e 'install Bundle::CPAN'
  
''With a Version 2.3 AppleTV OS, I did'nt manage to install <code>Mac::Carbon</code> and <code>Mac::Files</code> which are part of <code>File::HomeDir</code>. Nevertheless, CPAN update was OK.''
+
''With version 2.3 and 3.0.2 AppleTV OS, I did'nt manage to install <code>Mac::Carbon</code> and <code>Mac::Files</code> which are part of <code>File::HomeDir</code>. Nevertheless, CPAN update was OK.''
  
 
Once this is done, you can check your installation with one of:
 
Once this is done, you can check your installation with one of:
 
  perl -MCPAN -e 'autobundle'
 
  perl -MCPAN -e 'autobundle'
 
  perldoc perllocal
 
  perldoc perllocal
 +
perl -e 'print "hello world!\n"'
  
 
[[Category:How-to|Perl CPAN]]
 
[[Category:How-to|Perl CPAN]]
 
[[Category:2.1]]
 
[[Category:2.1]]
 
[[Category:2.3]]
 
[[Category:2.3]]
 +
[[Category:ATV3]]
 +
[[Category:3.0.2]]

Revision as of 13:52, 31 July 2010

The AppleTV comes with a minimal Perl installation. If you want to unleash the full power of Perl, the first thing you want is to install CPAN modules.

If you additionally want PHP and MySQL, you can consider installing XAMPP which provides all 4 items independently of the AppleTV OS.

Prerequisites

First of all, you'll need to install gcc.

We'll start with an ssh enabled AppleTV having a proper recovery partition.

We'll also need some binaries from an Intel Mac with Tiger and Xcode tools install.

Tiger files

From an Intel Mac with Tiger with Xcode tools installed, copy to the following files to AppleTV:

/usr/bin/groff
/usr/bin/grotty
/usr/bin/nroff
/usr/bin/perldoc
/usr/bin/pod2man
/usr/bin/troff

From the same Mac, copy to the following direcories:

/System/Library/Perl
/usr/share/groff

These will be partly overwritten from the recovery partition files.

Prior to installing Perl CPAN, you will need to install gcc on the AppleTV.

Perl modules

Log into the AppleTV as root.

Get the Perl modules from the recovery partition:

cd /Users/frontrow/Documents/
dd if=/dev/disk0s2 of=recovery.dmg bs=1m
hdiutil mount recovery.dmg
hdiutil mount /Volumes/Recovery/OS.dmg
cp -R /Volumes/OSBoot\ 1/System/Library/Perl /System/Library/
umount /Volumes/OSBoot\ 1

You also need to populate the directory /System/Library/Perl/5.8.6/darwin-thread-multi-2level/CORE/ with .h files. I haven't found them on the Darwin ISO, but on a Mac with OS 10.4 (a.k.a. Tiger) and xCode tools installed.

Configure CPAN (make it simple: answer no to the first question):

perl -MCPAN -e shell

Update CPAN (hit cr to the questions):

perl -MCPAN -e 'install Bundle::CPAN'

With version 2.3 and 3.0.2 AppleTV OS, I did'nt manage to install Mac::Carbon and Mac::Files which are part of File::HomeDir. Nevertheless, CPAN update was OK.

Once this is done, you can check your installation with one of:

perl -MCPAN -e 'autobundle'
perldoc perllocal
perl -e 'print "hello world!\n"'