diff options
author | Yorhel <git@yorhel.nl> | 2008-11-30 13:43:31 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2008-11-30 13:43:31 +0100 |
commit | 85a55d309c201906669595e1ec0f60bcb2016072 (patch) | |
tree | 9a521728832898b0170e1d04afe3408e32f28b87 /lib/VNDB/Func.pm | |
parent | 165a55d275b816b36217daf2cc899848d0cde64e (diff) |
Added small VN browser + search
Diffstat (limited to 'lib/VNDB/Func.pm')
-rw-r--r-- | lib/VNDB/Func.pm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/VNDB/Func.pm b/lib/VNDB/Func.pm index d2f86cf1..ac555d1d 100644 --- a/lib/VNDB/Func.pm +++ b/lib/VNDB/Func.pm @@ -5,7 +5,7 @@ use strict; use warnings; use Exporter 'import'; use POSIX 'strftime'; -our @EXPORT = qw| shorten date datestr userstr bb2html |; +our @EXPORT = qw| shorten date datestr monthstr userstr bb2html |; # I would've done this as a #define if this was C... @@ -46,6 +46,17 @@ sub datestr { return qq|<b class="future">$str</b>|; } +# same as datestr(), but different output format: +# e.g.: 'Jan 2009', '2009', 'unknown', 'TBA' +sub monthstr { + my $date = sprintf '%08d', shift||0; + my($y, $m) = ($1, $2) if $date =~ /^([0-9]{4})([0-9]{2})/; + return 'TBA' if $y == 9999; + return 'unknown' if $y == 0; + return $y if $m == 99; + return strftime '%b %Y', 0, 0, 0, 0, $m-1, $y-1900, 0, 0, 0; +} + # Arguments: (uid, username), or a hashref containing that info sub userstr { |