Data-CTable
view release on metacpan or search on metacpan
However, since other directories could be created, be sure to exercise
caution when allowing the module to create any directories for you on
any system where security might be an issue.
Also, if the 0666 permissions on the cache files themselves are too
liberal, you can either 1) turn off cacheing, or 2) call the
prep_cache_file() method to get the name of the cache file that would
have been written, if any, and then restrict its permissions:
chmod (0600, $this->prep_cache_file());
=head1 READING DATA FILES
## Replacing data in table with data read from a file
$t->read($Path) ## Simple calling convention
$t->read( ## Named-parameter convention
## Params that override params in the object if supplied...
_FDelimiter => $this->{_FDelimiter},
_HeaderRow => $this->{_HeaderRow },
_Subset => $this->{_Subset },
_Newline => "\n",
)};
$this->warn("Failed to cache $CacheFileName"),
unlink($CacheFileName),
goto done ## Successful completion.
unless $this->write_cache($Data, $CacheFileName);
chmod 0666, $CacheFileName; ## Liberal perms if possible.
}
goto done; ## Successful completion: we read from the file & maybe saved cache.
}
done:
return ($Success);
}
=pod
## _ReturnEncoding because those only are relevant
## when reading physical files. Cached data has the
## return chars already encoded as returns.
)};
$this->warn("Failed to cache $CacheFileName"),
unlink($CacheFileName), ## Delete cache if failure
goto done ## Successful completion.
unless $this->write_cache($Data, $CacheFileName);
chmod 0666, $CacheFileName; ## Liberal perms if possible.
done:
return($WriteFileName);
}
sub write_cache
{
my $this = shift;
my ($Data, $CacheFileName) = @_;
However, since other directories could be created, be sure to exercise
caution when allowing the module to create any directories for you on
any system where security might be an issue.
Also, if the 0666 permissions on the cache files themselves are too
liberal, you can either 1) turn off cacheing, or 2) call the
prep_cache_file() method to get the name of the cache file that would
have been written, if any, and then restrict its permissions:
chmod (0600, $this->prep_cache_file());
READING DATA FILES
## Replacing data in table with data read from a file
$t->read($Path) ## Simple calling convention
$t->read( ## Named-parameter convention
## Params that override params in the object if supplied...
( run in 0.262 second using v1.01-cache-2.11-cpan-496ff517765 )