Changeset 235
- Timestamp:
- 06/12/07 22:20:16 (3 years ago)
- Location:
- veekun/trunk
- Files:
-
- 4 modified
-
lib/Vee.pm (modified) (2 diffs)
-
lib/Vee/Utils.pm (modified) (1 diff)
-
templates/style/global.tt (modified) (1 diff)
-
templates/wrapper.tt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
veekun/trunk/lib/Vee.pm
r186 r235 54 54 __PACKAGE__->setup; 55 55 56 # grab the current revision number, if applicable 57 __PACKAGE__->cache->{svn_revision} = 58 Vee::Utils::timed_exec( 5 => sub { 59 open my $fh, '-|', 'svnversion' or return; 60 my $revision = <$fh>; 61 close $fh; 62 $revision =~ s/ \D+ $//gx; 63 return $revision; 64 } ); 65 56 66 { 57 67 no strict 'refs'; … … 85 95 =cut 86 96 87 my $cache = {};97 my $cache; 88 98 sub cache { 99 $cache ||= {}; # so we can call this function above 89 100 return $cache; 90 101 } -
veekun/trunk/lib/Vee/Utils.pm
r137 r235 84 84 } 85 85 86 # execute code but give up after x seconds 87 # this is taken from perldoc -f alarm 88 sub timed_exec { 89 my ($secs, $subref) = @_; 90 my $res = eval { 91 local $SIG{ALRM} = sub { die "alarm\n" }; 92 alarm $secs; 93 my $res = $subref->(); 94 alarm 0; 95 return $res; 96 }; 97 98 if ($@) { 99 die unless $@ eq "alarm\n"; # propagate unexpected errors 100 return; 101 } else { 102 return $res; 103 } 104 } 105 86 106 sub pad { sprintf "%0$_[1]d", $_[0] } 87 107 sub round { $_[1] ||= 0; return int($_[0] * 10 ** $_[1] + .5) / 10 ** $_[1]; } -
veekun/trunk/templates/style/global.tt
r231 r235 96 96 #debug { margin-bottom: 1em; } 97 97 #footer { -moz-border-radius-bottomright: 64px; } 98 #footer #svn-revision { float: right; font-size: 85%; } 98 99 99 100 #breadcrumbs { margin: -0.5em; margin-bottom: 0.5em; padding: 0.5em; background: [% glass_background(tablerow_fill2) %]; } -
veekun/trunk/templates/wrapper.tt
r234 r235 173 173 174 174 <div id="footer"> 175 [% IF c.cache.svn_revision %] 176 <div id="svn-revision">Revision [% 177 c.cache.svn_revision 178 .replace(':', ' through ') 179 .replace('(\d+)', '<a href="http://trac.veekun.com/changeset/$1">$1</a>') 180 %]</div> 181 [% END %] 175 182 All content copyright its original owners. Pokémon is copyright to Nintendo and Game Freak. Current site layout by Eevee/Alex Munroe and is ©2005. <br/> 176 183 [% IF from_cache %]
