File-Cache

 view release on metacpan or  search on metacpan

CHANGES  view on Meta::CPAN

  - fixed the CHANGES file to reflect the version 0.05 changes
  - updated the perldoc (David Coppit <david@coppit.org>)
  - now using File::Spec for the path generation (thanks for David for
    the idea)
  - updated the test.pl and test/test_get.pl scripts to include tests
    for setting the username, filemode, and max_size


0.05 2000-02-22-16-23
  - updated the requirements in the README
  - provided a default username if getpwuid is not available (MacOS)
  - fixed a problem where _purge failed on FreeBSD (thanks to
    Doug Steinwand)


0.04 2000-02-16-14-48
  - create a per-user namespace to better deal with file 
    permission problems when more than one user wants
    to use File::Cache
  - only create a globally read/write directory for 
    the default root of the cache (i.e., /tmp/File::Cache/)

Cache.pm  view on Meta::CPAN

# by default, the filemode is world read/writable

my $sDEFAULT_FILEMODE = 0777;


# by default, there is no max size to the cache

my $sDEFAULT_MAX_SIZE = $sNO_MAX_SIZE;


# if the OS does not support getpwuid, use this as a default username

my $sDEFAULT_USERNAME = 'nobody';


# by default, the objects in the cache never expire

my $sDEFAULT_GLOBAL_EXPIRES_IN = $sEXPIRES_NEVER;


# default cache depth

Cache.pm  view on Meta::CPAN

# independent way

sub _FIND_USERNAME
{
    my ($self) = @_;

    my $username;

    my $success = eval {
	my $effective_uid = $>;
	$username = getpwuid($effective_uid);	
    };

    if ($success and $username) {
	return $username;
    } else {
	return $sDEFAULT_USERNAME;
    }
}

# -----------------------------------------------------------------------------



( run in 0.260 second using v1.01-cache-2.11-cpan-8d75d55dd25 )