Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 31bff509aa04b4b076dbd66d07b9f9b72e379d0a @bingos committed Mar 12, 2009
Showing with 1,352 additions and 0 deletions.
  1. +16 −0 Changes
  2. +377 −0 LICENSE
  3. +24 −0 MANIFEST
  4. +20 −0 Makefile.PL
  5. +74 −0 README
  6. +34 −0 examples/synopsis.pl
  7. +584 −0 lib/POE/Component/SmokeBox/Dists.pm
  8. +4 −0 t/00_compile.t
  9. +13 −0 t/01_smokebox_dir.t
  10. +29 −0 t/02_check_fetch.t
  11. +57 −0 t/03_author.t
  12. +56 −0 t/04_distro.t
  13. +56 −0 t/05_phalanx.t
  14. +4 −0 t/99_pod.t
  15. +4 −0 t/99_pod_coverage.t
@@ -0,0 +1,16 @@
+POE::Component::SmokeBox::Dists
+===============================
+
+0.08 Tue Nov 11 21:37:24 GMT 2008
+ - Added Phalanx 100 search.
+
+0.06 Wed Sep 24 20:07:54 BST 2008
+ - Added force parameter.
+
+0.04 Wed Sep 17 11:27:42 BST 2008
+ - Switched from Parse::CPAN::Packages to using
+ CPAN::DistnameInfo. All processing is now
+ handled within the forked process.
+
+0.02 Tue Sep 16 15:11:09 BST 2008
+ - Initial CPAN release
Oops, something went wrong.
@@ -0,0 +1,24 @@
+Changes
+examples/synopsis.pl
+inc/Module/Install.pm
+inc/Module/Install/Base.pm
+inc/Module/Install/Can.pm
+inc/Module/Install/Fetch.pm
+inc/Module/Install/Makefile.pm
+inc/Module/Install/Metadata.pm
+inc/Module/Install/Win32.pm
+inc/Module/Install/WriteAll.pm
+lib/POE/Component/SmokeBox/Dists.pm
+LICENSE
+Makefile.PL
+MANIFEST This list of files
+META.yml
+README
+t/00_compile.t
+t/01_smokebox_dir.t
+t/02_check_fetch.t
+t/03_author.t
+t/04_distro.t
+t/05_phalanx.t
+t/99_pod.t
+t/99_pod_coverage.t
@@ -0,0 +1,20 @@
+use strict;
+use inc::Module::Install;
+name 'POE-Component-SmokeBox-Dists';
+author 'Chris Williams <chris@bingosnet.co.uk>';
+license 'perl';
+perl_version '5.006';
+abstract_from 'lib/POE/Component/SmokeBox/Dists.pm';
+version_from 'lib/POE/Component/SmokeBox/Dists.pm';
+build_requires 'Test::More' => 0.47;
+requires 'File::Spec' => 0;
+requires 'POE' => 1.0001;
+requires 'File::Path' => 0;
+requires 'IO::Zlib' => 0;
+requires 'File::Fetch' => 0;
+#requires 'Parse::CPAN::Packages' => 2.29;
+requires 'CPAN::DistnameInfo' => 0.06;
+requires 'Sort::Versions' => 1.5;
+requires 'URI' => 0;
+clean_files '.smokebox no.network';
+WriteAll();
@@ -0,0 +1,74 @@
+NAME
+ POE::Component::SmokeBox::Dists - Search for CPAN distributions by
+ cpanid or distribution name
+
+SYNOPSIS
+DESCRIPTION
+ POE::Component::SmokeBox::Dists is a POE component that provides
+ non-blocking CPAN distribution searches. It is a wrapper around
+ File::Fetch for "02packages.details.txt.gz" file retrieval, IO::Zlib for
+ extraction and Parse::CPAN::Packages for parsing the packages data.
+
+ Given either author ( ie. CPAN ID ) or distribution search criteria,
+ expressed as a regular expression, it will return to a requesting
+ session all the CPAN distributions that match that pattern.
+
+ The component will retrieve the "02packages.details.txt.gz" file to the
+ ".smokebox" directory. If that file already exists, a newer version will
+ only be retrieved if the file is older than 6 hours.
+
+ The "02packages.details.txt.gz" is extracted and a Parse::CPAN::Packages
+ object built in order to run the search criteria. This process can take
+ a little bit of time.
+
+CONSTRUCTORS
+ There are two constructors:
+
+ "author"
+ Initiates an author search. Takes a number of parameters:
+
+ 'event', the name of the event to return results to, mandatory;
+ 'search', a regex pattern to match CPAN IDs against, mandatory;
+ 'session', specify an alternative session to send results to;
+
+ "distro"
+ Initiates a distribution search. Takes a number of parameters:
+
+ 'event', the name of the event to return results to, mandatory;
+ 'search', a regex pattern to match distributions against, mandatory;
+ 'session', specify an alternative session to send results to;
+
+ In both constructors, "session" is only required if the component is not
+ spawned from within an existing POE::Session or you wish the results
+ event to be sent to an alternative existing POE::Session.
+
+OUTPUT EVENT
+ Once the component has finished, retrieving, extracting and processing
+ an event will be sent.
+
+ "ARG0" will be a hashref, with the following data:
+
+ 'dists', an arrayref consisting of prefixed distributions;
+ 'error', only present if something went wrong with any of the stages;
+
+ENVIRONMENT
+ The component uses the ".smokebox" directory to stash the
+ "02packages.details.txt.gz" file.
+
+ This is usually located in the current user's home directory. Setting
+ the environment variable "PERL5_SMOKEBOX_DIR" will effect where the
+ ".smokebox" directory is located.
+
+AUTHOR
+ Chris "BinGOs" Williams <chris@bingosnet.co.uk>
+
+LICENSE
+ Copyright (C) Chris Williams
+
+ This module may be used, modified, and distributed under the same terms
+ as Perl itself. Please see the license that came with your Perl
+ distribution for details.
+
+SEE ALSO
+ Parse::CPAN::Packages
+
@@ -0,0 +1,34 @@
+use strict;
+use warnings;
+
+use POE;
+use POE::Component::SmokeBox::Dists;
+
+my $search = '^BINGOS$';
+
+POE::Session->create(
+ package_states => [
+ 'main' => [qw(_start _results)],
+ ],
+);
+
+$poe_kernel->run();
+exit 0;
+
+sub _start {
+ POE::Component::SmokeBox::Dists->author(
+ event => '_results',
+ search => $search,
+ );
+ return;
+}
+
+sub _results {
+ my $ref = $_[ARG0];
+
+ return if $ref->{error}; # Oh dear there was an error
+
+ print $_, "\n" for @{ $ref->{dists} };
+
+ return;
+}
Oops, something went wrong.

0 comments on commit 31bff50

Please sign in to comment.