| 1 | # ---------------------------------------------------------------------------- | ||
| 2 | # | ||
| 3 | # This module supports cached access to file properties. | ||
| 4 | # | ||
| 5 | # Copyright © 2010,2011 Brendt Wohlberg <wohl@cpan.org> | ||
| 6 | # See distribution LICENSE file for license details. | ||
| 7 | # | ||
| 8 | # Most recent modification: 4 November 2011 | ||
| 9 | # | ||
| 10 | # ---------------------------------------------------------------------------- | ||
| 11 | |||
| 12 | package File::Properties::PropsCache; | ||
| 13 | our $VERSION = 0.01; | ||
| 14 | |||
| 15 | use File::Properties::Error; | ||
| 16 | use File::Properties::Cache; | ||
| 17 | use File::Properties; | ||
| 18 | use base qw(File::Properties::Cache); | ||
| 19 | |||
| 20 | require 5.005; | ||
| 21 | use strict; | ||
| 22 | use warnings; | ||
| 23 | use Error qw(:try); | ||
| 24 | |||
| 25 | |||
| 26 | # ---------------------------------------------------------------------------- | ||
| 27 | # Initialiser | ||
| 28 | # ---------------------------------------------------------------------------- | ||
| 29 | sub _init { | ||
| 30 | my $self = shift; | ||
| 31 | my $dbfp = shift; # Database file path | ||
| 32 | my $opts = shift; # Options hash | ||
| 33 | |||
| 34 | $self->SUPER::_init($dbfp, $opts); | ||
| 35 | File::Properties->_cacheinit($self, $opts); | ||
| 36 | } | ||
| 37 | |||
| 38 | |||
| 39 | # ---------------------------------------------------------------------------- | ||
| 40 | # Create File::Properties object for specified path | ||
| 41 | # ---------------------------------------------------------------------------- | ||
| 42 | sub properties { | ||
| 43 | my $self = shift; | ||
| 44 | my $path = shift; # File path | ||
| 45 | |||
| 46 | return File::Properties->new($path, $self); | ||
| 47 | } | ||
| 48 | |||
| 49 | |||
| 50 | # ---------------------------------------------------------------------------- | ||
| 51 | # End of method definitions | ||
| 52 | # ---------------------------------------------------------------------------- | ||
| 53 | |||
| 54 | |||
| 55 | 1; | ||
| 56 | __END__ |