summaryrefslogtreecommitdiff
path: root/lib/VNWeb/Prelude.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-04-16 16:26:53 +0200
committerYorhel <git@yorhel.nl>2020-04-17 09:32:16 +0200
commit17445db2d7d7ce34616e21dd5cce6d8c81b66c21 (patch)
treea68822887460ee28ca2a72d0b334babc5898c479 /lib/VNWeb/Prelude.pm
parent86c0a244fa47a301c43e0750cedff494b0d0ef64 (diff)
v2rw/VN::Page: Start conversion of VN pages
Currently implemented: - Revision diff - Info box & tags (already implemented from /v+/chars page) - Stats There's a few annoying TODO's left, this conversion will take some effort.
Diffstat (limited to 'lib/VNWeb/Prelude.pm')
-rw-r--r--lib/VNWeb/Prelude.pm9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/VNWeb/Prelude.pm b/lib/VNWeb/Prelude.pm
index cd95c046..87810ac7 100644
--- a/lib/VNWeb/Prelude.pm
+++ b/lib/VNWeb/Prelude.pm
@@ -71,6 +71,7 @@ sub import {
no strict 'refs';
*{$c.'::RE'} = *RE;
*{$c.'::in'} = \&in;
+ *{$c.'::idcmp'} = \&idcmp;
}
@@ -113,4 +114,12 @@ sub in {
0
}
+
+# Compare two vndbids, using proper numeric order
+sub idcmp($$) {
+ my($a1, $a2) = $_[0] =~ /^([a-z]+)([0-9]+)$/;
+ my($b1, $b2) = $_[1] =~ /^([a-z]+)([0-9]+)$/;
+ $a1 cmp $b1 || $a2 <=> $b2
+}
+
1;