File-Queue/0000755000175000017500000000000011123757027012674 5ustar jlavoldjlavoldFile-Queue/MANIFEST0000644000175000017500000000020111123756770014022 0ustar jlavoldjlavoldChanges MANIFEST Makefile.PL README lib/File/Queue.pm lib/File/Queue.pod t/00-load.t t/01-simple.t.save t/pod-coverage.t t/pod.t File-Queue/.cvsignore0000644000175000017500000000014111015141047014655 0ustar jlavoldjlavoldblib* Makefile Makefile.old Build _build* pm_to_blib* *.tar.gz .lwpcookies File-Queue-* cover_db File-Queue/Makefile.PL0000644000175000017500000000074411015316133014640 0ustar jlavoldjlavolduse strict; use warnings; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'File::Queue', AUTHOR => 'Jason Lavold ', VERSION_FROM => 'lib/File/Queue.pm', ABSTRACT_FROM => 'lib/File/Queue.pod', PL_FILES => {}, PREREQ_PM => { 'Test::More' => 0, }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'File-Queue-*' }, ); File-Queue/t/0000755000175000017500000000000011123756742013142 5ustar jlavoldjlavoldFile-Queue/t/00-load.t0000644000175000017500000000021711015141047014445 0ustar jlavoldjlavold#!perl -T use Test::More tests => 1; BEGIN { use_ok( 'File::Queue' ); } diag( "Testing File::Queue $File::Queue::VERSION, Perl $], $^X" ); File-Queue/t/boilerplate.t0000644000175000017500000000244411015141047015617 0ustar jlavoldjlavold#!perl -T use strict; use warnings; use Test::More tests => 3; sub not_in_file_ok { my ($filename, %regex) = @_; open( my $fh, '<', $filename ) or die "couldn't open $filename for reading: $!"; my %violated; while (my $line = <$fh>) { while (my ($desc, $regex) = each %regex) { if ($line =~ $regex) { push @{$violated{$desc}||=[]}, $.; } } } if (%violated) { fail("$filename contains boilerplate text"); diag "$_ appears on lines @{$violated{$_}}" for keys %violated; } else { pass("$filename contains no boilerplate text"); } } sub module_boilerplate_ok { my ($module) = @_; not_in_file_ok($module => 'the great new $MODULENAME' => qr/ - The great new /, 'boilerplate description' => qr/Quick summary of what the module/, 'stub function definition' => qr/function[12]/, ); } TODO: { local $TODO = "Need to replace the boilerplate text"; not_in_file_ok(README => "The README is used..." => qr/The README is used/, "'version information here'" => qr/to provide version information/, ); not_in_file_ok(Changes => "placeholder date/time" => qr(Date/time) ); module_boilerplate_ok('lib/File/Queue.pm'); } File-Queue/t/pod-coverage.t0000644000175000017500000000104711015141047015666 0ustar jlavoldjlavolduse strict; use warnings; use Test::More; # Ensure a recent version of Test::Pod::Coverage my $min_tpc = 1.08; eval "use Test::Pod::Coverage $min_tpc"; plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" if $@; # Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, # but older versions don't recognize some common documentation styles my $min_pc = 0.18; eval "use Pod::Coverage $min_pc"; plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" if $@; all_pod_coverage_ok(); File-Queue/t/pod.t0000644000175000017500000000035011015141047014071 0ustar jlavoldjlavold#!perl -T use strict; use warnings; use Test::More; # Ensure a recent version of Test::Pod my $min_tp = 1.22; eval "use Test::Pod $min_tp"; plan skip_all => "Test::Pod $min_tp required for testing POD" if $@; all_pod_files_ok(); File-Queue/t/01-simple.t.save0000644000175000017500000000262411123755315015772 0ustar jlavoldjlavold#!perl -T use strict; use Storable qw/freeze/; use File::Queue; use Test::Simple tests => 3; my $queue_file = "t/rw/test_queue_$$"; my $struct = [ 'text element 0, text element 0, text element 0, text element 0', 'text element 1, text element 1, text element 1, text element 1', 'text element 2, text element 2, text element 2, text element 2', 'text element 3, text element 3, text element 3, text element 3', 'text element 4, text element 4, text element 4, text element 4', 'text element 5, text element 5, text element 5, text element 5', 'text element 6, text element 6, text element 6, text element 6', 'text element 7, text element 7, text element 7, text element 7', 'text element 8, text element 8, text element 8, text element 8', 'text element 9, text element 9, text element 9, text element 9', ]; my $q = File::Queue->new(File => $queue_file); foreach my $elem (@$struct) { $q->enq($elem); } $q->close; $q = File::Queue->new(File => $queue_file); my $peeked = $q->peek(scalar @$struct); ok(freeze($struct) eq freeze($peeked), 'Checking struct vs peeked'); $q->close; $q = File::Queue->new(File => $queue_file); my $deqed; while(my $elem = $q->deq()) { push @$deqed, $elem; } ok(freeze($struct) eq freeze($deqed), 'Checking struct vs deqed'); my $delete_success = 1; eval { $q->delete(); }; if($@) { $delete_success = 0; } ok($delete_success, 'Checking delete function'); File-Queue/lib/0000755000175000017500000000000011015141047013427 5ustar jlavoldjlavoldFile-Queue/lib/File/0000755000175000017500000000000011123754354014321 5ustar jlavoldjlavoldFile-Queue/lib/File/Queue.pod0000644000175000017500000000650011123752523016106 0ustar jlavoldjlavold=head1 NAME File::Queue - Persistent FIFO queue implemented in pure perl! =head1 SYNOPSIS use strict; # always! use File::Queue; my $q = new File::Queue (File => '/var/spool/yourprog/queue'); $q->enq('some flat text1'); $q->enq('some flat text2'); $q->enq('some flat text3'); # Get up to first 10 elements my $contents = $q->peek(10); my $elem1 = $q->deq(); my $elem2 = $q->deq(); # empty the queue $q->reset(); =head1 DESCRIPTION This module allows for the creation of persistent FIFO queue objects. File::Queue only handles scalars as queue elements. If you want to work with references, serialize them first! The module was written with speed in mind, and it is very fast, but it should be used with care. Please refer to the CAVEATS section. =head1 Interface File::Queue implements a OO interface. The object methods and parameters are described below. =head2 Methods File::Queue supports all of the queue-related functions a developer should expect. =over =item * new() Instantiates your File::Queue object. Parameters are described in the next sub-section. =item * enq() Enqueues a string element to the queue. =item * deq() Dequeues a string element from the queue, and returns the element. If the queue is empty, nothing is returned. =item * peek(n) Returns an arrayref containing the next n elements in the queue. If the queue size is less than n, all elements are returned. If the queue is empty, an empty arrayref is returned. =item * reset() Emptys the queue. =item * close() Closes the filehandles belonging to the queue object ('.dat' and '.idx'). =item * delete() Deletes the files belonging to the queue object ('.dat' and '.idx'). =back =head2 Parameters There are a number of parameters that can be passed when constructing your File::Queue objects. Parameters are case-insensitive. =over =item * File (required) File::Queue creates two files using this parameter as the base. In the case of the example in the SYNOPSIS, the two files are '/var/spool/yourprog/queue.dat' and '/var/spool/yourprog.idx'. The '.dat' file holds all of the data, the '.idx' file holds the byte index (pointer) of the starting point of the first element in the queue. =item * Mode (optional) The file bit mode to be shared by both the '.dat' and '.idx' files. Defaults to '0600'. =item * Seperator (optional) The character or byte sequence that is used to seperate queue elements in the '.dat' file. It should be something you can guarantee will NEVER appear in your queue data. Defaults to the newline character. =item * BlockSize (optional) This is the size of the byte chunks that are pulled at each iteration when checking for the end of a queued element. Defaults to 64, which will be fine for most cases, but can be tweaked or tuned for your specific case to squeeze out a few extra nanoseconds. =back =head1 CAVEATS This module should never be used in situations where the queue is not expected to become empty. The '.dat' file is not truncated (emptied) until the queue is empty. Even the data you've already dequeued remains in the '.dat' file until the queue is empty. If you keep enqueueing elements and never FULLY dequeue everything, eventually your disk will fill up! =head1 SEE ALSO Tie::File =head1 AUTHOR Jason Lavold Ejlavold [ at ] gmail.comE =cut File-Queue/lib/File/Queue.pm0000740000175000017500000001035611123754015015737 0ustar jlavoldjlavoldpackage File::Queue; use strict; use IO::File; use Fcntl 'SEEK_END', 'SEEK_SET', 'O_CREAT', 'O_RDWR'; use Carp qw(carp croak); our $VERSION = '1.01'; sub new { my $class = shift; my $mi = $class . '->new()'; croak "$mi requires an even number of parameters" if (@_ & 1); my %params = @_; # convert to lower case while( my($key, $val) = each %params) { delete $params{$key}; $params{ lc($key) } = $val; } croak "$mi needs an File parameter" unless exists $params{file}; my $queue_file = delete $params{file}; my $idx_file = $queue_file . '.idx'; $queue_file .= '.dat'; my $self; my $mode = delete $params{mode} || '0600'; $self->{block_size} = delete $params{blocksize} || 64; $self->{seperator} = delete $params{seperator} || "\n"; $self->{sep_length} = length $self->{seperator}; croak "Seperator length cannot be greater than BlockSize" if ($self->{sep_length} > $self->{block_size}); $self->{queue_file} = $queue_file; $self->{idx_file} = $idx_file; $self->{queue} = new IO::File $queue_file, O_CREAT | O_RDWR, $mode or croak $!; $self->{idx} = new IO::File $idx_file, O_CREAT | O_RDWR, $mode or croak $!; ### Default ptr to 0, replace it with value in idx file if one exists $self->{idx}->sysseek(0, SEEK_SET); $self->{idx}->sysread($self->{ptr}, 1024); $self->{ptr} = '0' unless $self->{ptr}; if($self->{ptr} > -s $queue_file) { carp "Ptr is greater than queue file size, resetting ptr to '0'"; $self->{idx}->truncate(0) or croak "Could not truncate idx: $!"; $self->{idx}->sysseek(0, SEEK_SET); $self->{idx}->syswrite('0') or croak "Could not syswrite to idx: $!"; } bless $self, $class; return $self; } sub enq { my ($self, $element) = @_; $self->{queue}->sysseek(0, SEEK_END); if(ref $element) { croak 'Cannot handle references'; } if($element =~ s/$self->{seperator}//g) { carp "Removed illegal seperator(s) from $element"; } $self->{queue}->syswrite("$element$self->{seperator}") or croak "Could not syswrite to queue: $!"; } sub deq { my $self = shift; my $element; $self->{queue}->sysseek($self->{ptr}, SEEK_SET); my $i; while($self->{queue}->sysread($_, $self->{block_size})) { $i = index($_, $self->{seperator}); if($i != -1) { $element .= substr($_, 0, $i); $self->{ptr} += $i + $self->{sep_length}; $self->{queue}->sysseek($self->{ptr}, SEEK_SET); last; } else { ## If seperator isn't found, go back 'sep_length' spaces to ensure we don't miss it between reads $element .= substr($_, 0, -$self->{sep_length}, ''); $self->{ptr} += $self->{block_size} - $self->{sep_length}; $self->{queue}->sysseek($self->{ptr}, SEEK_SET); } } ## If queue seek pointer is at the EOF, truncate the queue file if($self->{queue}->sysread($_, 1) == 0) { $self->{queue}->truncate(0) or croak "Could not truncate queue: $!"; $self->{queue}->sysseek($self->{ptr} = 0, SEEK_SET); } ## Set idx file contents to point to the current seek position in queue file $self->{idx}->truncate(0) or croak "Could not truncate idx: $!"; $self->{idx}->sysseek(0, SEEK_SET); $self->{idx}->syswrite($self->{ptr}) or croak "Could not syswrite to idx: $!"; return $element; } sub peek { my ($self, $count) = @_; croak "Invalid argument to peek ($count)" unless $count > 0; my $elements; $self->{queue}->sysseek($self->{ptr}, SEEK_SET); my (@items, $remainder); GATHER: while($self->{queue}->sysread($_, $self->{block_size})) { if(defined $remainder) { $_ = $remainder . $_; } @items = split /$self->{seperator}/, $_, -1; $remainder = pop @items; foreach (@items) { push @$elements, $_; last GATHER if $count == @$elements; } } return $elements; } sub reset { my $self = shift; $self->{idx}->truncate(0) or croak "Could not truncate idx: $!"; $self->{idx}->sysseek(0, SEEK_SET); $self->{idx}->syswrite('0') or croak "Could not syswrite to idx: $!"; $self->{queue}->sysseek($self->{ptr} = 0, SEEK_SET); } sub close { my $self = shift; $self->{idx}->close(); $self->{queue}->close(); } sub delete { my $self = shift; $self->close(); unlink $self->{queue_file}; unlink $self->{idx_file}; } 1; File-Queue/README0000644000175000017500000000255211015141047013545 0ustar jlavoldjlavoldFile-Queue The README is used to introduce the module and provide instructions on how to install the module, any machine dependencies it may have (for example C compilers and installed libraries) and any other information that should be provided before the module is installed. A README file is required for CPAN modules since CPAN extracts the README file from a module distribution so that people browsing the archive can use it to get an idea of the module's uses. It is usually a good idea to provide version information here so that people can decide whether fixes for the module are worth downloading. INSTALLATION To install this module, run the following commands: perl Makefile.PL make make test make install SUPPORT AND DOCUMENTATION After installing, you can find documentation for this module with the perldoc command. perldoc File::Queue You can also look for information at: RT, CPAN's request tracker http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-Queue AnnoCPAN, Annotated CPAN documentation http://annocpan.org/dist/File-Queue CPAN Ratings http://cpanratings.perl.org/d/File-Queue Search CPAN http://search.cpan.org/dist/File-Queue COPYRIGHT AND LICENCE Copyright (C) 2008 Jason Lavold This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. File-Queue/Makefile.old0000644000175000017500000005223711123757011015113 0ustar jlavoldjlavold# This Makefile is for the File::Queue extension to perl. # # It was generated automatically by MakeMaker version # 6.30_01 (Revision: Revision: 4535 ) from the contents of # Makefile.PL. Don't edit this file, edit Makefile.PL instead. # # ANY CHANGES MADE HERE WILL BE LOST! # # MakeMaker ARGV: () # # MakeMaker Parameters: # ABSTRACT_FROM => q[lib/File/Queue.pod] # AUTHOR => q[Jason Lavold ] # NAME => q[File::Queue] # PL_FILES => { } # PREREQ_PM => { Test::More=>q[0] } # VERSION_FROM => q[lib/File/Queue.pm] # clean => { FILES=>q[File-Queue-*] } # dist => { COMPRESS=>q[gzip -9f], SUFFIX=>q[gz] } # --- MakeMaker post_initialize section: # --- MakeMaker const_config section: # These definitions are from config.sh (via /usr/lib/perl/5.8/Config.pm) # They may have been overridden via Makefile.PL or on the command line AR = ar CC = cc CCCDLFLAGS = -fPIC CCDLFLAGS = -Wl,-E DLEXT = so DLSRC = dl_dlopen.xs LD = cc LDDLFLAGS = -shared -L/usr/local/lib LDFLAGS = -L/usr/local/lib LIBC = /lib/libc-2.6.1.so LIB_EXT = .a OBJ_EXT = .o OSNAME = linux OSVERS = 2.6.15.7 RANLIB = : SITELIBEXP = /usr/local/share/perl/5.8.8 SITEARCHEXP = /usr/local/lib/perl/5.8.8 SO = so EXE_EXT = FULL_AR = /usr/bin/ar VENDORARCHEXP = /usr/lib/perl5 VENDORLIBEXP = /usr/share/perl5 # --- MakeMaker constants section: AR_STATIC_ARGS = cr DIRFILESEP = / DFSEP = $(DIRFILESEP) NAME = File::Queue NAME_SYM = File_Queue VERSION = 1.01 VERSION_MACRO = VERSION VERSION_SYM = 1_01 DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\" XS_VERSION = 1.01 XS_VERSION_MACRO = XS_VERSION XS_DEFINE_VERSION = -D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\" INST_ARCHLIB = blib/arch INST_SCRIPT = blib/script INST_BIN = blib/bin INST_LIB = blib/lib INST_MAN1DIR = blib/man1 INST_MAN3DIR = blib/man3 MAN1EXT = 1p MAN3EXT = 3pm INSTALLDIRS = site DESTDIR = PREFIX = /usr PERLPREFIX = $(PREFIX) SITEPREFIX = $(PREFIX)/local VENDORPREFIX = $(PREFIX) INSTALLPRIVLIB = $(PERLPREFIX)/share/perl/5.8 DESTINSTALLPRIVLIB = $(DESTDIR)$(INSTALLPRIVLIB) INSTALLSITELIB = $(SITEPREFIX)/share/perl/5.8.8 DESTINSTALLSITELIB = $(DESTDIR)$(INSTALLSITELIB) INSTALLVENDORLIB = $(VENDORPREFIX)/share/perl5 DESTINSTALLVENDORLIB = $(DESTDIR)$(INSTALLVENDORLIB) INSTALLARCHLIB = $(PERLPREFIX)/lib/perl/5.8 DESTINSTALLARCHLIB = $(DESTDIR)$(INSTALLARCHLIB) INSTALLSITEARCH = $(SITEPREFIX)/lib/perl/5.8.8 DESTINSTALLSITEARCH = $(DESTDIR)$(INSTALLSITEARCH) INSTALLVENDORARCH = $(VENDORPREFIX)/lib/perl5 DESTINSTALLVENDORARCH = $(DESTDIR)$(INSTALLVENDORARCH) INSTALLBIN = $(PERLPREFIX)/bin DESTINSTALLBIN = $(DESTDIR)$(INSTALLBIN) INSTALLSITEBIN = $(SITEPREFIX)/bin DESTINSTALLSITEBIN = $(DESTDIR)$(INSTALLSITEBIN) INSTALLVENDORBIN = $(VENDORPREFIX)/bin DESTINSTALLVENDORBIN = $(DESTDIR)$(INSTALLVENDORBIN) INSTALLSCRIPT = $(PERLPREFIX)/bin DESTINSTALLSCRIPT = $(DESTDIR)$(INSTALLSCRIPT) INSTALLSITESCRIPT = $(SITEPREFIX)/bin DESTINSTALLSITESCRIPT = $(DESTDIR)$(INSTALLSITESCRIPT) INSTALLVENDORSCRIPT = $(VENDORPREFIX)/bin DESTINSTALLVENDORSCRIPT = $(DESTDIR)$(INSTALLVENDORSCRIPT) INSTALLMAN1DIR = $(PERLPREFIX)/share/man/man1 DESTINSTALLMAN1DIR = $(DESTDIR)$(INSTALLMAN1DIR) INSTALLSITEMAN1DIR = $(SITEPREFIX)/man/man1 DESTINSTALLSITEMAN1DIR = $(DESTDIR)$(INSTALLSITEMAN1DIR) INSTALLVENDORMAN1DIR = $(VENDORPREFIX)/share/man/man1 DESTINSTALLVENDORMAN1DIR = $(DESTDIR)$(INSTALLVENDORMAN1DIR) INSTALLMAN3DIR = $(PERLPREFIX)/share/man/man3 DESTINSTALLMAN3DIR = $(DESTDIR)$(INSTALLMAN3DIR) INSTALLSITEMAN3DIR = $(SITEPREFIX)/man/man3 DESTINSTALLSITEMAN3DIR = $(DESTDIR)$(INSTALLSITEMAN3DIR) INSTALLVENDORMAN3DIR = $(VENDORPREFIX)/share/man/man3 DESTINSTALLVENDORMAN3DIR = $(DESTDIR)$(INSTALLVENDORMAN3DIR) PERL_LIB = /usr/share/perl/5.8 PERL_ARCHLIB = /usr/lib/perl/5.8 LIBPERL_A = libperl.a FIRST_MAKEFILE = Makefile MAKEFILE_OLD = Makefile.old MAKE_APERL_FILE = Makefile.aperl PERLMAINCC = $(CC) PERL_INC = /usr/lib/perl/5.8/CORE PERL = /usr/bin/perl FULLPERL = /usr/bin/perl ABSPERL = $(PERL) PERLRUN = $(PERL) FULLPERLRUN = $(FULLPERL) ABSPERLRUN = $(ABSPERL) PERLRUNINST = $(PERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" FULLPERLRUNINST = $(FULLPERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" ABSPERLRUNINST = $(ABSPERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" PERL_CORE = 0 PERM_RW = 644 PERM_RWX = 755 MAKEMAKER = /usr/share/perl/5.8/ExtUtils/MakeMaker.pm MM_VERSION = 6.30_01 MM_REVISION = Revision: 4535 # FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle). # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle) # PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar) # DLBASE = Basename part of dynamic library. May be just equal BASEEXT. FULLEXT = File/Queue BASEEXT = Queue PARENT_NAME = File DLBASE = $(BASEEXT) VERSION_FROM = lib/File/Queue.pm OBJECT = LDFROM = $(OBJECT) LINKTYPE = dynamic BOOTDEP = # Handy lists of source code files: XS_FILES = C_FILES = O_FILES = H_FILES = MAN1PODS = MAN3PODS = lib/File/Queue.pod # Where is the Config information that we are using/depend on CONFIGDEP = $(PERL_ARCHLIB)$(DFSEP)Config.pm $(PERL_INC)$(DFSEP)config.h # Where to build things INST_LIBDIR = $(INST_LIB)/File INST_ARCHLIBDIR = $(INST_ARCHLIB)/File INST_AUTODIR = $(INST_LIB)/auto/$(FULLEXT) INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT) INST_STATIC = INST_DYNAMIC = INST_BOOT = # Extra linker info EXPORT_LIST = PERL_ARCHIVE = PERL_ARCHIVE_AFTER = TO_INST_PM = lib/File/Queue.pm \ lib/File/Queue.pod PM_TO_BLIB = lib/File/Queue.pm \ blib/lib/File/Queue.pm \ lib/File/Queue.pod \ blib/lib/File/Queue.pod # --- MakeMaker platform_constants section: MM_Unix_VERSION = 1.50_01 PERL_MALLOC_DEF = -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc # --- MakeMaker tool_autosplit section: # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto AUTOSPLITFILE = $(ABSPERLRUN) -e 'use AutoSplit; autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1)' # --- MakeMaker tool_xsubpp section: # --- MakeMaker tools_other section: SHELL = /bin/sh CHMOD = chmod CP = cp MV = mv NOOP = $(SHELL) -c true NOECHO = @ RM_F = rm -f RM_RF = rm -rf TEST_F = test -f TOUCH = touch UMASK_NULL = umask 0 DEV_NULL = > /dev/null 2>&1 MKPATH = $(ABSPERLRUN) "-MExtUtils::Command" -e mkpath EQUALIZE_TIMESTAMP = $(ABSPERLRUN) "-MExtUtils::Command" -e eqtime ECHO = echo ECHO_N = echo -n UNINST = 0 VERBINST = 0 MOD_INSTALL = $(ABSPERLRUN) -MExtUtils::Install -e 'install({@ARGV}, '\''$(VERBINST)'\'', 0, '\''$(UNINST)'\'');' DOC_INSTALL = $(ABSPERLRUN) "-MExtUtils::Command::MM" -e perllocal_install UNINSTALL = $(ABSPERLRUN) "-MExtUtils::Command::MM" -e uninstall WARN_IF_OLD_PACKLIST = $(ABSPERLRUN) "-MExtUtils::Command::MM" -e warn_if_old_packlist MACROSTART = MACROEND = USEMAKEFILE = -f FIXIN = $(PERLRUN) "-MExtUtils::MY" -e "MY->fixin(shift)" # --- MakeMaker makemakerdflt section: makemakerdflt: all $(NOECHO) $(NOOP) # --- MakeMaker dist section: TAR = tar TARFLAGS = cvf ZIP = zip ZIPFLAGS = -r COMPRESS = gzip -9f SUFFIX = gz SHAR = shar PREOP = $(NOECHO) $(NOOP) POSTOP = $(NOECHO) $(NOOP) TO_UNIX = $(NOECHO) $(NOOP) CI = ci -u RCS_LABEL = rcs -Nv$(VERSION_SYM): -q DIST_CP = best DIST_DEFAULT = tardist DISTNAME = File-Queue DISTVNAME = File-Queue-1.01 # --- MakeMaker macro section: # --- MakeMaker depend section: # --- MakeMaker cflags section: # --- MakeMaker const_loadlibs section: # --- MakeMaker const_cccmd section: # --- MakeMaker post_constants section: # --- MakeMaker pasthru section: PASTHRU = LIBPERL_A="$(LIBPERL_A)"\ LINKTYPE="$(LINKTYPE)"\ PREFIX="$(PREFIX)" # --- MakeMaker special_targets section: .SUFFIXES : .xs .c .C .cpp .i .s .cxx .cc $(OBJ_EXT) .PHONY: all config static dynamic test linkext manifest blibdirs clean realclean disttest distdir # --- MakeMaker c_o section: # --- MakeMaker xs_c section: # --- MakeMaker xs_o section: # --- MakeMaker top_targets section: all :: pure_all manifypods $(NOECHO) $(NOOP) pure_all :: config pm_to_blib subdirs linkext $(NOECHO) $(NOOP) subdirs :: $(MYEXTLIB) $(NOECHO) $(NOOP) config :: $(FIRST_MAKEFILE) blibdirs $(NOECHO) $(NOOP) help : perldoc ExtUtils::MakeMaker # --- MakeMaker blibdirs section: blibdirs : $(INST_LIBDIR)$(DFSEP).exists $(INST_ARCHLIB)$(DFSEP).exists $(INST_AUTODIR)$(DFSEP).exists $(INST_ARCHAUTODIR)$(DFSEP).exists $(INST_BIN)$(DFSEP).exists $(INST_SCRIPT)$(DFSEP).exists $(INST_MAN1DIR)$(DFSEP).exists $(INST_MAN3DIR)$(DFSEP).exists $(NOECHO) $(NOOP) # Backwards compat with 6.18 through 6.25 blibdirs.ts : blibdirs $(NOECHO) $(NOOP) $(INST_LIBDIR)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_LIBDIR) $(NOECHO) $(CHMOD) 755 $(INST_LIBDIR) $(NOECHO) $(TOUCH) $(INST_LIBDIR)$(DFSEP).exists $(INST_ARCHLIB)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_ARCHLIB) $(NOECHO) $(CHMOD) 755 $(INST_ARCHLIB) $(NOECHO) $(TOUCH) $(INST_ARCHLIB)$(DFSEP).exists $(INST_AUTODIR)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_AUTODIR) $(NOECHO) $(CHMOD) 755 $(INST_AUTODIR) $(NOECHO) $(TOUCH) $(INST_AUTODIR)$(DFSEP).exists $(INST_ARCHAUTODIR)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_ARCHAUTODIR) $(NOECHO) $(CHMOD) 755 $(INST_ARCHAUTODIR) $(NOECHO) $(TOUCH) $(INST_ARCHAUTODIR)$(DFSEP).exists $(INST_BIN)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_BIN) $(NOECHO) $(CHMOD) 755 $(INST_BIN) $(NOECHO) $(TOUCH) $(INST_BIN)$(DFSEP).exists $(INST_SCRIPT)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_SCRIPT) $(NOECHO) $(CHMOD) 755 $(INST_SCRIPT) $(NOECHO) $(TOUCH) $(INST_SCRIPT)$(DFSEP).exists $(INST_MAN1DIR)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_MAN1DIR) $(NOECHO) $(CHMOD) 755 $(INST_MAN1DIR) $(NOECHO) $(TOUCH) $(INST_MAN1DIR)$(DFSEP).exists $(INST_MAN3DIR)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_MAN3DIR) $(NOECHO) $(CHMOD) 755 $(INST_MAN3DIR) $(NOECHO) $(TOUCH) $(INST_MAN3DIR)$(DFSEP).exists # --- MakeMaker linkext section: linkext :: $(LINKTYPE) $(NOECHO) $(NOOP) # --- MakeMaker dlsyms section: # --- MakeMaker dynamic section: dynamic :: $(FIRST_MAKEFILE) $(INST_DYNAMIC) $(INST_BOOT) $(NOECHO) $(NOOP) # --- MakeMaker dynamic_bs section: BOOTSTRAP = # --- MakeMaker dynamic_lib section: # --- MakeMaker static section: ## $(INST_PM) has been moved to the all: target. ## It remains here for awhile to allow for old usage: "make static" static :: $(FIRST_MAKEFILE) $(INST_STATIC) $(NOECHO) $(NOOP) # --- MakeMaker static_lib section: # --- MakeMaker manifypods section: POD2MAN_EXE = $(PERLRUN) "-MExtUtils::Command::MM" -e pod2man "--" POD2MAN = $(POD2MAN_EXE) manifypods : pure_all \ lib/File/Queue.pod \ lib/File/Queue.pod $(NOECHO) $(POD2MAN) --section=$(MAN3EXT) --perm_rw=$(PERM_RW) \ lib/File/Queue.pod $(INST_MAN3DIR)/File::Queue.$(MAN3EXT) # --- MakeMaker processPL section: # --- MakeMaker installbin section: # --- MakeMaker subdirs section: # none # --- MakeMaker clean_subdirs section: clean_subdirs : $(NOECHO) $(NOOP) # --- MakeMaker clean section: # Delete temporary files but do not touch installed files. We don't delete # the Makefile here so a later make realclean still has a makefile to use. clean :: clean_subdirs - $(RM_F) \ *$(LIB_EXT) core \ core.[0-9] $(INST_ARCHAUTODIR)/extralibs.all \ core.[0-9][0-9] $(BASEEXT).bso \ pm_to_blib.ts core.[0-9][0-9][0-9][0-9] \ $(BASEEXT).x $(BOOTSTRAP) \ perl$(EXE_EXT) tmon.out \ *$(OBJ_EXT) pm_to_blib \ $(INST_ARCHAUTODIR)/extralibs.ld blibdirs.ts \ core.[0-9][0-9][0-9][0-9][0-9] *perl.core \ core.*perl.*.? $(MAKE_APERL_FILE) \ perl $(BASEEXT).def \ core.[0-9][0-9][0-9] mon.out \ lib$(BASEEXT).def perlmain.c \ perl.exe so_locations \ $(BASEEXT).exp - $(RM_RF) \ File-Queue-* blib - $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) $(DEV_NULL) # --- MakeMaker realclean_subdirs section: realclean_subdirs : $(NOECHO) $(NOOP) # --- MakeMaker realclean section: # Delete temporary files (via clean) and also delete dist files realclean purge :: clean realclean_subdirs - $(RM_F) \ $(MAKEFILE_OLD) $(FIRST_MAKEFILE) - $(RM_RF) \ $(DISTVNAME) # --- MakeMaker metafile section: metafile : create_distdir $(NOECHO) $(ECHO) Generating META.yml $(NOECHO) $(ECHO) '# http://module-build.sourceforge.net/META-spec.html' > META_new.yml $(NOECHO) $(ECHO) '#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#' >> META_new.yml $(NOECHO) $(ECHO) 'name: File-Queue' >> META_new.yml $(NOECHO) $(ECHO) 'version: 1.01' >> META_new.yml $(NOECHO) $(ECHO) 'version_from: lib/File/Queue.pm' >> META_new.yml $(NOECHO) $(ECHO) 'installdirs: site' >> META_new.yml $(NOECHO) $(ECHO) 'requires:' >> META_new.yml $(NOECHO) $(ECHO) ' Test::More: 0' >> META_new.yml $(NOECHO) $(ECHO) '' >> META_new.yml $(NOECHO) $(ECHO) 'distribution_type: module' >> META_new.yml $(NOECHO) $(ECHO) 'generated_by: ExtUtils::MakeMaker version 6.30_01' >> META_new.yml -$(NOECHO) $(MV) META_new.yml $(DISTVNAME)/META.yml # --- MakeMaker signature section: signature : cpansign -s # --- MakeMaker dist_basics section: distclean :: realclean distcheck $(NOECHO) $(NOOP) distcheck : $(PERLRUN) "-MExtUtils::Manifest=fullcheck" -e fullcheck skipcheck : $(PERLRUN) "-MExtUtils::Manifest=skipcheck" -e skipcheck manifest : $(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest veryclean : realclean $(RM_F) *~ *.orig */*~ */*.orig # --- MakeMaker dist_core section: dist : $(DIST_DEFAULT) $(FIRST_MAKEFILE) $(NOECHO) $(ABSPERLRUN) -l -e 'print '\''Warning: Makefile possibly out of date with $(VERSION_FROM)'\''' \ -e ' if -e '\''$(VERSION_FROM)'\'' and -M '\''$(VERSION_FROM)'\'' < -M '\''$(FIRST_MAKEFILE)'\'';' tardist : $(DISTVNAME).tar$(SUFFIX) $(NOECHO) $(NOOP) uutardist : $(DISTVNAME).tar$(SUFFIX) uuencode $(DISTVNAME).tar$(SUFFIX) $(DISTVNAME).tar$(SUFFIX) > $(DISTVNAME).tar$(SUFFIX)_uu $(DISTVNAME).tar$(SUFFIX) : distdir $(PREOP) $(TO_UNIX) $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME) $(RM_RF) $(DISTVNAME) $(COMPRESS) $(DISTVNAME).tar $(POSTOP) zipdist : $(DISTVNAME).zip $(NOECHO) $(NOOP) $(DISTVNAME).zip : distdir $(PREOP) $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME) $(RM_RF) $(DISTVNAME) $(POSTOP) shdist : distdir $(PREOP) $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar $(RM_RF) $(DISTVNAME) $(POSTOP) # --- MakeMaker distdir section: create_distdir : $(RM_RF) $(DISTVNAME) $(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \ -e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');" distdir : create_distdir distmeta $(NOECHO) $(NOOP) # --- MakeMaker dist_test section: disttest : distdir cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL cd $(DISTVNAME) && $(MAKE) $(PASTHRU) cd $(DISTVNAME) && $(MAKE) test $(PASTHRU) # --- MakeMaker dist_ci section: ci : $(PERLRUN) "-MExtUtils::Manifest=maniread" \ -e "@all = keys %{ maniread() };" \ -e "print(qq{Executing $(CI) @all\n}); system(qq{$(CI) @all});" \ -e "print(qq{Executing $(RCS_LABEL) ...\n}); system(qq{$(RCS_LABEL) @all});" # --- MakeMaker distmeta section: distmeta : create_distdir metafile $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'eval { maniadd({q{META.yml} => q{Module meta-data (added by MakeMaker)}}) } ' \ -e ' or print "Could not add META.yml to MANIFEST: $${'\''@'\''}\n"' # --- MakeMaker distsignature section: distsignature : create_distdir $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'eval { maniadd({q{SIGNATURE} => q{Public-key signature (added by MakeMaker)}}) } ' \ -e ' or print "Could not add SIGNATURE to MANIFEST: $${'\''@'\''}\n"' $(NOECHO) cd $(DISTVNAME) && $(TOUCH) SIGNATURE cd $(DISTVNAME) && cpansign -s # --- MakeMaker install section: install :: all pure_install doc_install $(NOECHO) $(NOOP) install_perl :: all pure_perl_install doc_perl_install $(NOECHO) $(NOOP) install_site :: all pure_site_install doc_site_install $(NOECHO) $(NOOP) install_vendor :: all pure_vendor_install doc_vendor_install $(NOECHO) $(NOOP) pure_install :: pure_$(INSTALLDIRS)_install $(NOECHO) $(NOOP) doc_install :: doc_$(INSTALLDIRS)_install $(NOECHO) $(NOOP) pure__install : pure_site_install $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site doc__install : doc_site_install $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site pure_perl_install :: $(NOECHO) umask 022; $(MOD_INSTALL) \ $(INST_LIB) $(DESTINSTALLPRIVLIB) \ $(INST_ARCHLIB) $(DESTINSTALLARCHLIB) \ $(INST_BIN) $(DESTINSTALLBIN) \ $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \ $(INST_MAN1DIR) $(DESTINSTALLMAN1DIR) \ $(INST_MAN3DIR) $(DESTINSTALLMAN3DIR) $(NOECHO) $(WARN_IF_OLD_PACKLIST) \ $(SITEARCHEXP)/auto/$(FULLEXT) pure_site_install :: $(NOECHO) umask 02; $(MOD_INSTALL) \ read $(SITEARCHEXP)/auto/$(FULLEXT)/.packlist \ write $(DESTINSTALLSITEARCH)/auto/$(FULLEXT)/.packlist \ $(INST_LIB) $(DESTINSTALLSITELIB) \ $(INST_ARCHLIB) $(DESTINSTALLSITEARCH) \ $(INST_BIN) $(DESTINSTALLSITEBIN) \ $(INST_SCRIPT) $(DESTINSTALLSITESCRIPT) \ $(INST_MAN1DIR) $(DESTINSTALLSITEMAN1DIR) \ $(INST_MAN3DIR) $(DESTINSTALLSITEMAN3DIR) $(NOECHO) $(WARN_IF_OLD_PACKLIST) \ $(PERL_ARCHLIB)/auto/$(FULLEXT) pure_vendor_install :: $(NOECHO) umask 022; $(MOD_INSTALL) \ $(INST_LIB) $(DESTINSTALLVENDORLIB) \ $(INST_ARCHLIB) $(DESTINSTALLVENDORARCH) \ $(INST_BIN) $(DESTINSTALLVENDORBIN) \ $(INST_SCRIPT) $(DESTINSTALLVENDORSCRIPT) \ $(INST_MAN1DIR) $(DESTINSTALLVENDORMAN1DIR) \ $(INST_MAN3DIR) $(DESTINSTALLVENDORMAN3DIR) doc_perl_install :: doc_site_install :: $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLSITEARCH)/perllocal.pod -$(NOECHO) umask 02; $(MKPATH) $(DESTINSTALLSITEARCH) -$(NOECHO) umask 02; $(DOC_INSTALL) \ "Module" "$(NAME)" \ "installed into" "$(INSTALLSITELIB)" \ LINKTYPE "$(LINKTYPE)" \ VERSION "$(VERSION)" \ EXE_FILES "$(EXE_FILES)" \ >> $(DESTINSTALLSITEARCH)/perllocal.pod doc_vendor_install :: uninstall :: uninstall_from_$(INSTALLDIRS)dirs $(NOECHO) $(NOOP) uninstall_from_perldirs :: uninstall_from_sitedirs :: $(NOECHO) $(UNINSTALL) $(SITEARCHEXP)/auto/$(FULLEXT)/.packlist uninstall_from_vendordirs :: # --- MakeMaker force section: # Phony target to force checking subdirectories. FORCE: $(NOECHO) $(NOOP) # --- MakeMaker perldepend section: # --- MakeMaker makefile section: # We take a very conservative approach here, but it's worth it. # We move Makefile to Makefile.old here to avoid gnu make looping. $(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP) $(NOECHO) $(ECHO) "Makefile out-of-date with respect to $?" $(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..." -$(NOECHO) $(RM_F) $(MAKEFILE_OLD) -$(NOECHO) $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) - $(MAKE) $(USEMAKEFILE) $(MAKEFILE_OLD) clean $(DEV_NULL) $(PERLRUN) Makefile.PL $(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <==" $(NOECHO) $(ECHO) "==> Please rerun the $(MAKE) command. <==" false # --- MakeMaker staticmake section: # --- MakeMaker makeaperl section --- MAP_TARGET = perl FULLPERL = /usr/bin/perl $(MAP_TARGET) :: static $(MAKE_APERL_FILE) $(MAKE) $(USEMAKEFILE) $(MAKE_APERL_FILE) $@ $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE) pm_to_blib $(NOECHO) $(ECHO) Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET) $(NOECHO) $(PERLRUNINST) \ Makefile.PL DIR= \ MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \ MAKEAPERL=1 NORECURS=1 CCCDLFLAGS= # --- MakeMaker test section: TEST_VERBOSE=0 TEST_TYPE=test_$(LINKTYPE) TEST_FILE = test.pl TEST_FILES = t/*.t TESTDB_SW = -d testdb :: testdb_$(LINKTYPE) test :: $(TEST_TYPE) test_dynamic :: pure_all PERL_DL_NONLAZY=1 $(FULLPERLRUN) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES) testdb_dynamic :: pure_all PERL_DL_NONLAZY=1 $(FULLPERLRUN) $(TESTDB_SW) "-I$(INST_LIB)" "-I$(INST_ARCHLIB)" $(TEST_FILE) test_ : test_dynamic test_static :: test_dynamic testdb_static :: testdb_dynamic # --- MakeMaker ppd section: # Creates a PPD (Perl Package Description) for a binary distribution. ppd: $(NOECHO) $(ECHO) '' > $(DISTNAME).ppd $(NOECHO) $(ECHO) ' $(DISTNAME)' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' Persistent FIFO queue implemented in pure perl!' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' Jason Lavold <jlavold@gmail.com>' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) '' >> $(DISTNAME).ppd # --- MakeMaker pm_to_blib section: pm_to_blib : $(TO_INST_PM) $(NOECHO) $(ABSPERLRUN) -MExtUtils::Install -e 'pm_to_blib({@ARGV}, '\''$(INST_LIB)/auto'\'', '\''$(PM_FILTER)'\'')' \ lib/File/Queue.pm blib/lib/File/Queue.pm \ lib/File/Queue.pod blib/lib/File/Queue.pod $(NOECHO) $(TOUCH) pm_to_blib # --- MakeMaker selfdocument section: # --- MakeMaker postamble section: # End. File-Queue/Changes0000644000175000017500000000030411123753070014156 0ustar jlavoldjlavoldRevision history for File-Queue 1.01 2008-12-22 Fixed bug in the enq() function, and in the sample code. 1.00 2008-05-27 First version, released on an unsuspecting world.