Permalink
Browse files

tests

  • Loading branch information...
1 parent 54a9a6d commit 10946744ccc9510119d70061bb7abcd9451c92f3 @rkoeppl rkoeppl committed May 5, 2016
Showing with 11 additions and 3 deletions.
  1. +11 −3 modules/printengine.pl
View
@@ -18,7 +18,7 @@
use Sys::Mmap;
use Graphics::Framebuffer;
use Time::HiRes;
-use Sort::Key::Natural qw( natsort );
+#use Sort::Key::Natural qw( natsort );
#import configuration from configuration file
our $cfg = new Config::Simple();
$cfg->read("printengine.cfg");
@@ -216,8 +216,16 @@
} readdir(DIR);
closedir(DIR);
#sort array
- my @pics_sorted=natsort @pics;
- print @pics_sorted;
+# my @pics_sorted=natsort @pics;
+# print @pics_sorted;
+my @pics_sorted=sort { mask($a) <=> mask($b) } @pics;
+# where mask is a function to return digits and mask out anything else, so
+# integer comparison will work
+sub mask {
+ s/[^0-9]//og;
+ return $_;
+}
+print @pics_sorted;
#builtin framebuffer access
my $fb = Graphics::Framebuffer->new( FB_DEVICE=>$display_device, SPLASH=>0 );

0 comments on commit 1094674

Please sign in to comment.