Changeset 1227

Show
Ignore:
Timestamp:
08/07/06 18:58:39
Author:
miyagawa
Message:

use File::HomeDir? to detect home directory, rather than HOME env var

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/Makefile.PL

    r1206 r1227  
    3333requires('Encode', 2.10); 
    3434requires('Term::Encoding'); 
     35requires('File::HomeDir'); 
    3536 
    3637build_requires('YAML'); 
  • trunk/plagger/lib/Plagger.pm

    r1222 r1227  
    159159 
    160160    # cache is auto-vivified but that's okay 
    161     $self->{conf}->{cache}->{base} ||= File::Spec->catfile($ENV{HOME}, $dir); 
     161    $self->{conf}->{cache}->{base} ||= File::Spec->catfile($self->home_dir, $dir); 
    162162 
    163163    $self->cache( Plagger::Cache->new($self->{conf}->{cache}) ); 
     164} 
     165 
     166sub home_dir { 
     167    eval { require File::HomeDir }; 
     168    return $@ ? $ENV{HOME} : File::HomeDir->my_home; 
    164169} 
    165170