Skip to content

Commit

Permalink
Add POE::Test::Loops to config_requires, so modern systems can install
Browse files Browse the repository at this point in the history
it before Makefile.PL runs.  Allow gen-tests.pl to fail gracefully if
POE::Test::Loops isn't installed.  Remove a bunch of tabs from
unrelated files.
  • Loading branch information
rcaputo committed Jul 5, 2008
1 parent a6f6333 commit 6cae398
Show file tree
Hide file tree
Showing 12 changed files with 124 additions and 109 deletions.
12 changes: 6 additions & 6 deletions docs/Makefile
Expand Up @@ -5,13 +5,13 @@
all: ../POE.pod ../POE-TODO.pod ../POE-HINTS.pod all: ../POE.pod ../POE-TODO.pod ../POE-HINTS.pod


../POE.pod: ./POE.outline ../POE.pod: ./POE.outline
./out-out.perl pod ./POE.outline > ../POE.pod ./out-out.perl pod ./POE.outline > ../POE.pod
./out-out.perl html ./POE.outline > ../POE.html ./out-out.perl html ./POE.outline > ../POE.html


../POE-TODO.pod: ./POE-TODO.outline ../POE-TODO.pod: ./POE-TODO.outline
./out-out.perl pod ./POE-TODO.outline > ../POE-TODO.pod ./out-out.perl pod ./POE-TODO.outline > ../POE-TODO.pod
./out-out.perl html ./POE-TODO.outline > ../POE-TODO.html ./out-out.perl html ./POE-TODO.outline > ../POE-TODO.html


../POE-HINTS.pod: ./POE-HINTS.outline ../POE-HINTS.pod: ./POE-HINTS.outline
./out-out.perl pod ./POE-HINTS.outline > ../POE-HINTS.pod ./out-out.perl pod ./POE-HINTS.outline > ../POE-HINTS.pod
./out-out.perl html ./POE-HINTS.outline > ../POE-HINTS.html ./out-out.perl html ./POE-HINTS.outline > ../POE-HINTS.html
2 changes: 1 addition & 1 deletion lib/POE.pm
Expand Up @@ -7,7 +7,7 @@ use strict;
use Carp qw( croak ); use Carp qw( croak );


use vars qw($VERSION $REVISION); use vars qw($VERSION $REVISION);
$VERSION = '1.001'; # NOTE - Should be #.### (three decimal places) $VERSION = '1.002'; # NOTE - Should be #.### (three decimal places)
$REVISION = do {my($r)=(q$Revision$=~/(\d+)/);sprintf"1.%04d",$r}; $REVISION = do {my($r)=(q$Revision$=~/(\d+)/);sprintf"1.%04d",$r};


sub import { sub import {
Expand Down
82 changes: 41 additions & 41 deletions lib/POE/Filter/HTTPD.pm
Expand Up @@ -386,55 +386,55 @@ POE::Filter::HTTPD - parse simple HTTP requests, and serialize HTTP::Response
=head1 SYNOPSIS =head1 SYNOPSIS
#!perl #!perl
use warnings; use warnings;
use strict; use strict;
use POE qw(Component::Server::TCP Filter::HTTPD); use POE qw(Component::Server::TCP Filter::HTTPD);
use HTTP::Response; use HTTP::Response;
POE::Component::Server::TCP->new( POE::Component::Server::TCP->new(
Port => 8088, Port => 8088,
ClientFilter => 'POE::Filter::HTTPD', ### <-- HERE WE ARE! ClientFilter => 'POE::Filter::HTTPD', ### <-- HERE WE ARE!
ClientInput => sub { ClientInput => sub {
my $request = $_[ARG0]; my $request = $_[ARG0];
# It's a response for the client if there was a problem. # It's a response for the client if there was a problem.
if ($request->isa("HTTP::Response")) { if ($request->isa("HTTP::Response")) {
$_[HEAP]{client}->put($request); $_[HEAP]{client}->put($request);
$_[KERNEL]->yield("shutdown"); $_[KERNEL]->yield("shutdown");
return; return;
} }
my $request_fields = ''; my $request_fields = '';
$request->headers()->scan( $request->headers()->scan(
sub { sub {
my ($header, $value) = @_; my ($header, $value) = @_;
$request_fields .= ( $request_fields .= (
"<tr><td>$header</td><td>$value</td></tr>" "<tr><td>$header</td><td>$value</td></tr>"
); );
} }
); );
my $response = HTTP::Response->new(200); my $response = HTTP::Response->new(200);
$response->push_header( 'Content-type', 'text/html' ); $response->push_header( 'Content-type', 'text/html' );
$response->content( $response->content(
"<html><head><title>Your Request</title></head>" . "<html><head><title>Your Request</title></head>" .
"<body>Details about your request:" . "<body>Details about your request:" .
"<table border='1'>$request_fields</table>" . "<table border='1'>$request_fields</table>" .
"</body></html>" "</body></html>"
); );
$_[HEAP]{client}->put($response); $_[HEAP]{client}->put($response);
$_[KERNEL]->yield("shutdown"); $_[KERNEL]->yield("shutdown");
} }
); );
print "Aim your browser at port 8088 of this host.\n"; print "Aim your browser at port 8088 of this host.\n";
POE::Kernel->run(); POE::Kernel->run();
exit; exit;
=head1 DESCRIPTION =head1 DESCRIPTION
Expand Down
4 changes: 2 additions & 2 deletions lib/POE/Filter/Reference.pm
Expand Up @@ -257,8 +257,8 @@ POE::Filter::Reference - freeze and thaw arbitrary Perl data
}, },
got_perl_data => sub { got_perl_data => sub {
print "Got data:\n", YAML::Dump($_[ARG0]); print "Got data:\n", YAML::Dump($_[ARG0]);
print "Bye!\n"; print "Bye!\n";
delete $_[HEAP]{io}; delete $_[HEAP]{io};
} }
} }
); );
Expand Down
4 changes: 2 additions & 2 deletions lib/POE/NFA.pm
Expand Up @@ -785,9 +785,9 @@ POE::NFA - an event-driven state machine (nondeterministic finite automaton)
$_[RUNSTATE]{io}->put('Bye!'); $_[RUNSTATE]{io}->put('Bye!');
$_[MACHINE]->stop(); $_[MACHINE]->stop();
} }
else { else {
$_[MACHINE]->goto_state(state_cmd => "on_entry"); $_[MACHINE]->goto_state(state_cmd => "on_entry");
} }
} }
=head1 DESCRIPTION =head1 DESCRIPTION
Expand Down
76 changes: 38 additions & 38 deletions lib/POE/Wheel/ReadLine.pm
Expand Up @@ -3065,51 +3065,51 @@ POE::Wheel::ReadLine - non-blocking Term::ReadLine for POE
=head1 SYNOPSIS =head1 SYNOPSIS
#!perl #!perl
use warnings; use warnings;
use strict; use strict;
use POE qw(Wheel::ReadLine); use POE qw(Wheel::ReadLine);
POE::Session->create( POE::Session->create(
inline_states=> { inline_states=> {
_start => \&setup_console, _start => \&setup_console,
got_user_input => \&handle_user_input, got_user_input => \&handle_user_input,
} }
); );
POE::Kernel->run(); POE::Kernel->run();
exit; exit;
sub handle_user_input { sub handle_user_input {
my ($input, $exception) = @_[ARG0, ARG1]; my ($input, $exception) = @_[ARG0, ARG1];
my $console = $_[HEAP]{console}; my $console = $_[HEAP]{console};
unless (defined $input) { unless (defined $input) {
$console->put("$exception caught. B'bye!"); $console->put("$exception caught. B'bye!");
$_[KERNEL]->signal($_[KERNEL], "UIDESTROY"); $_[KERNEL]->signal($_[KERNEL], "UIDESTROY");
$console->write_history("./test_history"); $console->write_history("./test_history");
return; return;
} }
$console->put(" You entered: $input"); $console->put(" You entered: $input");
$console->addhistory($input); $console->addhistory($input);
$console->get("Go: "); $console->get("Go: ");
} }
sub setup_console { sub setup_console {
$_[HEAP]{console} = POE::Wheel::ReadLine->new( $_[HEAP]{console} = POE::Wheel::ReadLine->new(
InputEvent => 'got_user_input' InputEvent => 'got_user_input'
); );
$_[HEAP]{console}->read_history("./test_history"); $_[HEAP]{console}->read_history("./test_history");
$_[HEAP]{console}->clear(); $_[HEAP]{console}->clear();
$_[HEAP]{console}->put( $_[HEAP]{console}->put(
"Enter some text.", "Enter some text.",
"Ctrl+C or Ctrl+D exits." "Ctrl+C or Ctrl+D exits."
); );
$_[HEAP]{console}->get("Go: "); $_[HEAP]{console}->get("Go: ");
} }
=head1 DESCRIPTION =head1 DESCRIPTION
Expand Down
1 change: 1 addition & 0 deletions mylib/Makefile-5004.pm
@@ -1,5 +1,6 @@
#!/usr/bin/perl #!/usr/bin/perl
# $Id$ # $Id$
# rocco // vim: ts=2 sw=2 expandtab


use strict; use strict;


Expand Down
1 change: 1 addition & 0 deletions mylib/Makefile-5005.pm
@@ -1,5 +1,6 @@
#!/usr/bin/perl #!/usr/bin/perl
# $Id$ # $Id$
# rocco // vim: ts=2 sw=2 expandtab


use strict; use strict;


Expand Down
24 changes: 13 additions & 11 deletions mylib/PoeBuildInfo.pm
@@ -1,4 +1,5 @@
# $Id$ # $Id$
# rocco // vim: ts=2 sw=2 expandtab


# Build information for POE. Moved into a library so it can be # Build information for POE. Moved into a library so it can be
# required by Makefile.PL and gen-meta.perl. # required by Makefile.PL and gen-meta.perl.
Expand All @@ -18,8 +19,16 @@ use vars qw(@EXPORT_OK);
DIST_ABSTRACT DIST_ABSTRACT
DIST_AUTHOR DIST_AUTHOR
RECOMMENDED_TIME_HIRES RECOMMENDED_TIME_HIRES
CONFIG_REQUIREMENTS
); );



sub CONFIG_REQUIREMENTS () {
(
"POE::Test::Loops" => 1.002,
)
}

sub CORE_REQUIREMENTS () { sub CORE_REQUIREMENTS () {
( (
"Carp" => 0, "Carp" => 0,
Expand All @@ -31,7 +40,6 @@ sub CORE_REQUIREMENTS () {
"Socket" => 1.7, "Socket" => 1.7,
"Test::Harness" => 2.26, "Test::Harness" => 2.26,
"Storable" => 2.16, "Storable" => 2.16,
"POE::Test::Loops" => 1.002,
( (
($^O eq "MSWin32") ($^O eq "MSWin32")
? ( ? (
Expand All @@ -40,6 +48,7 @@ sub CORE_REQUIREMENTS () {
) )
: () : ()
), ),
CONFIG_REQUIREMENTS,
) )
} }


Expand All @@ -66,16 +75,9 @@ sub CLEAN_FILES () {
t/20_resources/10_perl/* t/20_resources/10_perl/*
t/20_resources/20_xs t/20_resources/20_xs
t/20_resources/20_xs/* t/20_resources/20_xs/*
t/30_loops/select t/30_loops/*/*
t/30_loops/select/* t/30_loops/*
t/30_loops/io_poll t/30_loops
t/30_loops/io_poll/*
t/30_loops/event
t/30_loops/event/*
t/30_loops/gtk
t/30_loops/gtk/*
t/30_loops/tk
t/30_loops/tk/*
); );
"@clean_files"; "@clean_files";
} }
Expand Down
2 changes: 2 additions & 0 deletions mylib/gen-meta.perl
@@ -1,5 +1,6 @@
#!/usr/bin/perl -w #!/usr/bin/perl -w
# $Id$ # $Id$
# rocco // vim: ts=2 sw=2 expandtab


# Generate META.yml. # Generate META.yml.


Expand All @@ -24,6 +25,7 @@
RECOMMENDED_TIME_HIRES, RECOMMENDED_TIME_HIRES,
}, },
requires => { CORE_REQUIREMENTS }, requires => { CORE_REQUIREMENTS },
config_requires => { CONFIG_REQUIREMENTS },
no_index => { no_index => {
directory => [ "mylib", "t" ] directory => [ "mylib", "t" ]
}, },
Expand Down
11 changes: 10 additions & 1 deletion mylib/gen-tests.perl
@@ -1,9 +1,18 @@
#!/usr/bin/perl -w #!/usr/bin/perl -w
# $Id$
# rocco // vim: ts=2 sw=2 expandtab


use strict; use strict;
use File::Spec; use File::Spec;
use File::Path; use File::Path;
use POE::Test::Loops;
BEGIN {
eval "require POE::Test::Loops";
if ($@) {
warn "Could not load POE::Test::Loops. Skipping loop tests";
exit;
}
}


my $test_base = "t"; my $test_base = "t";


Expand Down
14 changes: 7 additions & 7 deletions mylib/preprocessor.perl
Expand Up @@ -4,11 +4,11 @@
use strict; use strict;


while (<STDIN>) { while (<STDIN>) {
if ($] < 5.006) { if ($] < 5.006) {
s/^(\s*)(use bytes;).*/$1#$2 # perl version $] at install/; s/^(\s*)(use bytes;).*/$1#$2 # perl version $] at install/;
} }
else { else {
s/^(\s*)#\s*(use bytes;).*/$1$2/; s/^(\s*)#\s*(use bytes;).*/$1$2/;
} }
print; print;
} }

0 comments on commit 6cae398

Please sign in to comment.