title: How can I install cpanm and local::lib if I can't write to ~/?
body: <p>As with many people whose sites are hosted on shared servers, I do not have root access, and the hosting company will not install Perl modules at the request of users.  </p>
  
  <p>Unfortunately, I also do not have write privileges to the <code>~/</code> folder, only to certain subfolders (such as <code>~/cgi-bin/</code>).</p>
  
  <p>I've attempted the solution suggested <a href="https://stackoverflow.com/a/2980715/270404">here</a>, changing <code>~/perl5</code> to <code>~/cgi-bin/perl5</code> (which I created), but I keep getting this error: </p>
  
  <blockquote>
    <p>"Can't write to cpanm home '~/.cpanm': You should fix it with
    chown/chmod first."</p>
  </blockquote>
  
  <p>The problem is, as I stated, <strong>I don't have write privileges to ~/</strong>.</p>
  
  <p>Is there some way to tell the installer to use <code>~/cgi-bin/.cpanm</code> instead? I've tried to figure it out by searching on here and elsewhere on the internet, but I'm starting to bash my head against the wall.</p>
  
  <p><strong>EDIT :</strong> So I've tried the suggestion by Steven below, using this command: </p>
  
  <blockquote>
    <p>HOME=$HOME/cgi-bin cpanm local::lib</p>
  </blockquote>
  
  <p>Now, <code>cpanm</code> successfully runs and tries to install the module, but has numerous warnings throughout the installation and ultimately fails (presumably something is still trying to write to a forbidden folder??).   </p>
  
  <p>Here are some sample warnings:</p>
  
  <blockquote>
    <p>Warning: prerequisite CPAN 1.82 not found. We have 1.7601.</p>
    
    <p>Warning: prerequisite ExtUtils::Install 1.43 not found. We have 1.32.</p>
    
    <p>Warning: prerequisite ExtUtils::MakeMaker 6.42 not found. We have 6.17.</p>
    
    <p>Warning: prerequisite Module::Build 0.36 not found.</p>
    
    <p>Warning: You do not have permissions to install into /usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi at /usr/lib/perl5/5.8.5/ExtUtils/Install.pm line 114.</p>
    
    <p>mkdir /usr/lib/perl5/5.8.5/App: Permission denied at /usr/lib/perl5/5.8.5/ExtUtils/Install.pm line 176</p>
    
    <p>make: *** [pure_perl_install] Error 255</p>
  </blockquote>