WriteMakefile(
NAME => 'Gruntmaster::Page',
VERSION_FROM => 'lib/Gruntmaster/Page.pm',
- EXE_FILES => [ qw/gruntmaster-genpage gruntmaster-genallpages gruntmaster-problem/ ],
+ EXE_FILES => [ qw/gruntmaster-genpage gruntmaster-genallpages gruntmaster-paged gruntmaster-problem/ ],
ABSTRACT_FROM => 'lib/Gruntmaster/Page.pm',
AUTHOR => 'Marius Gavrilescu <marius@ieval.ro>',
MIN_PERL_VERSION => '5.14.0',
--- /dev/null
+#!/usr/bin/perl -w
+use v5.14;
+
+use Gruntmaster::Data qw/SUBSCRIBE WAIT_FOR_MESSAGES/;
+use Gruntmaster::Page qw/_generate/;
+
+SUBSCRIBE 'genpage', \&_generate;
+WAIT_FOR_MESSAGES 86400 while 1;
+
+1;
+__END__
our $contest;
my $redis = Redis->new;
+my $pubsub = Redis->new;
sub dynsub{
no strict 'refs';
for my $cmd (qw/multi exec smembers get hget hset sadd srem incr hmset hsetnx/) {
dynsub uc $cmd, sub { say "Arguments to \U$cmd: ", join ', ', @_; $redis->$cmd(@_) };
}
+
+ for my $cmd (qw/publish subscribe wait_for_messages/) {
+ dynsub uc $cmd, sub { say "Arguments to \U$cmd: ", join ', ', @_; $pubsub->$cmd(@_) };
+ }
}
sub cp { defined $contest ? "contest.$contest." : '' }
use strict;
use warnings;
use parent qw/Exporter/;
-our @EXPORT_OK = qw/generate/;
+our @EXPORT_OK = qw/generate _generate/;
use Fcntl qw/:flock/;
use File::Basename qw/fileparse/;
use File::Slurp qw/write_file/;
use IO::Compress::Gzip qw/gzip/;
use IO::File;
+use Gruntmaster::Data qw/PUBLISH/;
our $VERSION = '0.001';
our @generators;
declaregen 'Pb::Entry' => qr,^${contest}pb/$component$,;
}
-sub generate{
+sub _generate{
my ($path) = @_;
my ($path_noext, $ext) = $path =~ m/^(.*)\.(.*)$/;
my $basename = fileparse $path_noext;
close $typemap;
}
+sub generate{
+ PUBLISH 'genpage', shift;
+}
+
1;
__END__
# Below is stub documentation for your module. You'd better edit it!