package Fiets::Cache; use strict; use warnings; ... sub new { my ($self,$class)=@_; my $cdir = Fiets::getvar('cachedir'); if ($cdir) { use Cache::FileCache; use base qw(Cache::FileCache); $self=Cache::FileCache->new({ 'cache_root' => $cdir, 'default_expires_in' => '4 h' }); } else { use Cache::NullCache; use base qw(Cache::NullCache); $self=Cache::NullCache->new({ 'default_expires_in' => '4 h', }); } bless ($self,$class); return $self; } ... 1;