1. Toby Inkster
  2. p5-cache-moustache

Commits

Toby Inkster  committed a47fe84

fix some warnings; allow $expires_in to be "year", etc with no number

  • Participants
  • Parent commits ca896e7
  • Branches default

Comments (0)

Files changed (1)

File lib/Cache/Moustache.pm

View file
 	
 	$expires_in = $cache->{'~~~~default_expires_in'} if !defined $expires_in;
 	
-	if ($expires_in =~ /^(\d+)\s*([A-Za-z]+)$/)
+	if ($expires_in =~ /^(\d*)\s*([A-Za-z]+)$/)
 	{
 		($expires_in, my $mult) = ($1, $2);
 		$expires_in *= ($multipliers{$mult} || $multipliers{lc $mult});
 {
 	my ($cache, $key) = @_;
 	return if $key =~ /^~~~~/;
+	return unless exists $cache->{$key};
 	
 	my $expires_at = $cache->{$key}[1];
 	if ($expires_at >= 0 and $expires_at < time)