File: HTC_Utils.pm

package info (click to toggle)
libhtml-template-compiled-perl 1.003-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 772 kB
  • sloc: perl: 4,759; makefile: 5
file content (28 lines) | stat: -rw-r--r-- 647 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package # hide from cpan =)
    HTC_Utils;
use base 'Exporter';
use File::Spec;
@EXPORT_OK = qw($cache $cache_lock $tdir &cdir &create_cache &remove_cache);

$cache = File::Spec->catdir(qw(t cache));
$cache_lock = File::Spec->catdir(qw(t cache lock));
$tdir  = File::Spec->catdir(qw(t templates));

sub cdir { File::Spec->catdir(@_) }

sub create_cache {
    my ($dir) = @_;
    my $cache = File::Spec->catdir('t', $dir);
    mkdir $cache;
    return $cache;
}

sub remove_cache {
    my ($dir) = @_;
    $dir ||= 'cache';
    my $cache = $dir;
    my $cache_lock = File::Spec->catdir($dir, 'lock');
    unlink $cache_lock;
    rmdir $cache;
}
1;