aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVíctor Moral <victor@venexma.es>2014-01-23 14:28:27 +0100
committerVíctor Moral <victor@venexma.es>2014-01-23 14:28:27 +0100
commita876d85021a5468e526e57aaf5e8688b74c08e28 (patch)
tree2727e1d4ebd6fad27d6153631d783140f01ea013
parent257d23a482ec271d1f166284b5a65cd69fbd0a74 (diff)
downloadcdt-a876d85021a5468e526e57aaf5e8688b74c08e28.tar.gz
cdt-a876d85021a5468e526e57aaf5e8688b74c08e28.tar.bz2
cdt-a876d85021a5468e526e57aaf5e8688b74c08e28.zip
- Añadido un primer módulo para gestionar colas de archivos.
- Añadido un test para el anterior - Nuevo directorio donde guardar resultados de test
-rw-r--r--lib/CDT/Queue.pm57
-rw-r--r--t/out/README.md4
-rw-r--r--t/queue.t28
3 files changed, 89 insertions, 0 deletions
diff --git a/lib/CDT/Queue.pm b/lib/CDT/Queue.pm
new file mode 100644
index 0000000..13eaea9
--- /dev/null
+++ b/lib/CDT/Queue.pm
@@ -0,0 +1,57 @@
+package CDT::Queue;
+use Moose;
+use Moose::Util::TypeConstraints;
+use namespace::autoclean;
+use utf8;
+
+# extensions and roles
+
+# external modules
+
+# attributes
+has 'base' => (
+ documentation => q(Directorio base para la cola de archivos),
+ is => 'ro',
+ isa => 'Str',
+ lazy => 1,
+ default => q(queue),
+ writer => 'set_base',
+);
+
+has 'is_empty' => (
+ documentation => q(Indicador de cola vacía),
+ traits => [ qw(Bool) ],
+ is => 'ro',
+ isa => 'Bool',
+ default => sub { 1; },
+ handles => {
+ no_empty => 'unset',
+ empty => 'set',
+ },
+);
+
+# variables
+our $VERSION = '0.1';
+
+# public methods
+sub enq {
+ my $self = shift;
+ my $input = shift;
+
+
+}
+
+sub deq {
+ my $self = shift;
+
+}
+
+# private methods
+
+no Moose;
+__PACKAGE__->meta->make_immutable;
+
+1;
+
+
+
diff --git a/t/out/README.md b/t/out/README.md
new file mode 100644
index 0000000..e50a00d
--- /dev/null
+++ b/t/out/README.md
@@ -0,0 +1,4 @@
+# t/out
+
+Este directorio lo utilizan los test del proyecto como zona temporal y
+auxiliar en sus trabajos.
diff --git a/t/queue.t b/t/queue.t
new file mode 100644
index 0000000..5c3fe14
--- /dev/null
+++ b/t/queue.t
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+
+use Modern::Perl;
+use Test::More;
+use lib qw(lib);
+use utf8;
+
+# Variables
+our $VERSION = '0.1';
+our $tmp_dir = q(t/out/queue.d);
+
+# Creamos entorno
+if (not -e $tmp_dir) {
+ mkdir($tmp_dir) || die "could not create $tmp_dir - $!";
+}
+
+# Test de carga de la clase
+my $class = "CDT::Queue";
+use_ok( $class );
+
+# Test de creación de instancias
+my $obj = new_ok( $class, { base => $tmp_dir } ););
+
+# Fin de test
+done_testing;
+
+1;
+