CAM-SQLManager
view release on metacpan or search on metacpan
lib/CAM/SQLManager.pm view on Meta::CPAN
if (!open(FILE, $self->{filename}))
{
&carp("Cannot open sql command '$$self{filename}': $!");
return undef;
}
local $/ = undef;
$self->{sql} = <FILE>;
close(FILE);
# Record the last-mod time of the file so we can notice if it changes
$self->{filetime} = (stat($self->{filename}))[9];
# Set up the statistics data structures
if (!exists $global_stats{cmds}->{$self->{cmd}})
{
# Any changes to this data structure should be propagated into
# _incrStats() and the documentation for statistics()
$global_stats{cmds}->{$self->{cmd}} = {
queries => 0,
time => 0,
query => {},
lib/CAM/SQLManager.pm view on Meta::CPAN
}
my @cmds = (@_);
foreach my $cmd (@cmds)
{
if (-e File::Spec->catfile($global_directory, $cmd))
{
if (exists $global_cache{$cmd})
{
# Check to make sure the SQL file has not changed
if ($global_cache{$cmd}->{filetime} < (stat($global_cache{$cmd}->{filename}))[9])
{
$global_cache{$cmd} = $pkg->new($cmd, @args);
}
}
else
{
$global_cache{$cmd} = $pkg->new($cmd, @args);
}
return $global_cache{$cmd};
}
( run in 1.704 second using v1.01-cache-2.11-cpan-49f99fa48dc )