Skip to content

Commit

Permalink
Rename the project to Dandelions
Browse files Browse the repository at this point in the history
  • Loading branch information
atrodo committed Jun 19, 2014
1 parent 473b9c8 commit 3dae0ce
Show file tree
Hide file tree
Showing 18 changed files with 70 additions and 117 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,4 +1,4 @@
Revision history for Stilts
Revision history for Dandelions

{{$NEXT}}
- Initial release
4 changes: 2 additions & 2 deletions Makefile.PL
Expand Up @@ -15,10 +15,10 @@ my %WriteMakefileArgs = (
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => "6.30"
},
"DISTNAME" => "Stilts",
"DISTNAME" => "Dandelions",
"EXE_FILES" => [],
"LICENSE" => "artistic_2",
"NAME" => "Stilts",
"NAME" => "Dandelions",
"PREREQ_PM" => {
"Danga::Socket" => "1.61",
"HTTP::HeaderParser::XS" => "0.20",
Expand Down
12 changes: 0 additions & 12 deletions bin/stilts.json

This file was deleted.

60 changes: 0 additions & 60 deletions bin/stilts.pl

This file was deleted.

2 changes: 1 addition & 1 deletion dist.ini
@@ -1,3 +1,3 @@
name = Stilts
name = Dandelions
[@Milla]
installer=MakeMaker
20 changes: 11 additions & 9 deletions lib/Stilts.pm → lib/Dandelions.pm
@@ -1,4 +1,4 @@
package Stilts;
package Dandelions;

our $VERSION = 0.1;

Expand All @@ -19,14 +19,14 @@ use open qw/:encoding(UTF-8)/;

use Danga::Socket;

use Stilts::Config;
use Stilts::Server;
use Dandelions::Config;
use Dandelions::Server;

has config => (
is => 'ro',
default => sub {
my $self = shift;
return Stilts::Config->new($self->config_handle);
return Dandelions::Config->new($self->config_handle);
},
lazy => 1,
);
Expand All @@ -46,6 +46,8 @@ has config_handle => (
try
{
# No need to check with autodie enabled; silently ignore errors
#-r $cfg && -w $cfg;
#open my $cfg_fh, "+<", $cfg;
return IO::File->new($cfg, "+<");
};

Expand All @@ -71,7 +73,7 @@ sub prepare

foreach my $binding (@{ $self->config })
{
Stilts::Server->new($binding);
Dandelions::Server->new($binding);
}

$self->_prepared(1);
Expand Down Expand Up @@ -123,23 +125,23 @@ sub DEMOLISH
}
}

1; # End of Stilts
1; # End of Dandelions

__END__
=encoding utf-8
=head1 NAME
Stilts - PSGI based reverse proxy and webserver
Dandelions - PSGI based reverse proxy and webserver
=head1 SYNOPSIS
use Stilts;
use Dandelions;
=head1 DESCRIPTION
Stilts is a PSGI based reverse proxy and webserver
Dandelions is a PSGI based reverse proxy and webserver
=head1 AUTHOR
Expand Down
2 changes: 1 addition & 1 deletion lib/Stilts/Config.pm → lib/Dandelions/Config.pm
@@ -1,4 +1,4 @@
package Stilts::Config;
package Dandelions::Config;

use strict;
use warnings;
Expand Down
2 changes: 1 addition & 1 deletion lib/Stilts/Handler.pm → lib/Dandelions/Handler.pm
@@ -1,4 +1,4 @@
package Stilts::Handler;
package Dandelions::Handler;

use strict;
use warnings;
Expand Down
@@ -1,4 +1,4 @@
package Stilts::Handler::Static;
package Dandelions::Handler::Static;

use strict;
use warnings;
Expand All @@ -14,7 +14,7 @@ use Cwd qw/realpath/;

my $root = realpath("$FindBin::Bin");

with 'Stilts::Handler';
with 'Dandelions::Handler';

has path => (
is => 'ro',
Expand Down
6 changes: 3 additions & 3 deletions lib/Stilts/Protocol.pm → lib/Dandelions/Protocol.pm
@@ -1,4 +1,4 @@
package Stilts::Protocol;
package Dandelions::Protocol;

use strict;
use warnings;
Expand All @@ -14,8 +14,8 @@ has handler => (
is => 'ro',
required => 1,
isa => sub {
croak "Must pass a Stilts::Handler to Stilts::Protocol"
unless blessed($_[0]) && $_[0]->does("Stilts::Handler");
croak "Must pass a Dandelions::Handler to Dandelions::Protocol"
unless blessed($_[0]) && $_[0]->does("Dandelions::Handler");
},
);

Expand Down
@@ -1,4 +1,4 @@
package Stilts::Protocol::PSGI;
package Dandelions::Protocol::PSGI;

use strict;
use warnings;
Expand All @@ -8,7 +8,7 @@ use Carp;
use autodie;
use Try::Tiny;

with 'Stilts::Protocol';
with 'Dandelions::Protocol';

use HTTP::HeaderParser::XS;
use URI::Escape qw//;
Expand Down Expand Up @@ -164,7 +164,7 @@ sub reader

try
{
Stilts::Socket->new($body, reader => $otherfd);
Dandelions::Socket->new($body, reader => $otherfd);
}
catch
{
Expand Down
18 changes: 9 additions & 9 deletions lib/Stilts/Server.pm → lib/Dandelions/Server.pm
@@ -1,12 +1,12 @@
package Stilts::Server;
package Dandelions::Server;

use strict;
use warnings;

use Moo;
use Carp;

use Stilts::Socket;
use Dandelions::Socket;
use IO::Socket::INET;
use UNIVERSAL::require;

Expand All @@ -30,13 +30,13 @@ has protocol_class => (
required => 1,
coerce => sub
{
my $protocol_class = join "::", "Stilts::Protocol", shift;
my $protocol_class = join "::", "Dandelions::Protocol", shift;

croak $@
if !$protocol_class->require;

croak "$protocol_class does not implement Stilts::Protocol"
unless $protocol_class->does("Stilts::Protocol");
croak "$protocol_class does not implement Dandelions::Protocol"
unless $protocol_class->does("Dandelions::Protocol");

return $protocol_class;
},
Expand All @@ -46,13 +46,13 @@ has handler_class => (
is => 'ro',
required => 1,
coerce => sub {
my $handler_class = join "::", "Stilts::Handler", shift;
my $handler_class = join "::", "Dandelions::Handler", shift;

croak $@
if !$handler_class->require;

croak "$handler_class does not implement Stilts::Handler"
unless $handler_class->does("Stilts::Handler");
croak "$handler_class does not implement Dandelions::Handler"
unless $handler_class->does("Dandelions::Handler");

return $handler_class;
},
Expand Down Expand Up @@ -102,7 +102,7 @@ around BUILDARGS => sub
$args->{handler_class} = delete $args->{Handler};
$args->{handler_options} = delete $args->{Options};

$args->{sock} = Stilts::Socket->new(
$args->{sock} = Dandelions::Socket->new(
IO::Socket::INET->new(
LocalAddr => $args->{bound},
Proto => "tcp",
Expand Down
25 changes: 24 additions & 1 deletion lib/Stilts/Socket.pm → lib/Dandelions/Socket.pm
@@ -1,4 +1,4 @@
package Stilts::Socket;
package Dandelions::Socket;

use Moo;
use Carp;
Expand Down Expand Up @@ -37,6 +37,23 @@ sub BUILD
$self->watch_write(1);
}

BEGIN
{

package MagicalCodeRef;

require B;
use overload '""' => sub
{

my $ref = shift;
my $gv = B::svref_2object($ref)->GV;
sprintf "%s:%d", $gv->FILE, $gv->LINE;
};

sub enchant { bless $_[1], $_[0] }
}

sub reader
{
my $self = shift;
Expand All @@ -53,6 +70,8 @@ sub reader
{
my $sub_self = $sub;
$sub = sub {
my $gv = B::svref_2object($sub_self->can("reader"))->GV;
warn sprintf "%s:%d\n", $gv->FILE, $gv->LINE;
$sub_self->reader(@_);
};
}
Expand All @@ -61,6 +80,8 @@ sub reader
{
my $sub_self = $sub;
$sub = sub {
my $gv = B::svref_2object($sub_self)->GV;
warn sprintf "%s:%d\n", $gv->FILE, $gv->LINE;
$sub_self->(@_);
};
}
Expand Down Expand Up @@ -126,6 +147,8 @@ sub event_read
{
my $self = shift;

warn $self . " " . $self->reader_sub . "\n";

try { $self->reader_sub->($self, @_); }
catch {
warn "!!!: @_";
Expand Down
4 changes: 2 additions & 2 deletions t/00-load.t
Expand Up @@ -3,7 +3,7 @@
use Test::More tests => 1;

BEGIN {
use_ok( 'Stilts' ) || print "Bail out!\n";
use_ok( 'Dandelions' ) || print "Bail out!\n";
}

diag( "Testing Stilts $Stilts::VERSION, Perl $], $^X" );
diag( "Testing Dandelions $Dandelions::VERSION, Perl $], $^X" );
4 changes: 2 additions & 2 deletions t/01-start.t
Expand Up @@ -2,9 +2,9 @@

use Test::More tests => 1;

use Stilts;
use Dandelions;

my $stilt = Stilts->new();
my $stilt = Dandelions->new();

$stilt->run_child;

Expand Down
8 changes: 4 additions & 4 deletions t/02-config.t
Expand Up @@ -2,7 +2,7 @@

use Test::More tests => 3;

use Stilts;
use Dandelions;
use Try::Tiny;

my $port = "63021";
Expand All @@ -16,11 +16,11 @@ my $cfg = <<EOD;
]
EOD

Stilts->new(config_handle => $cfg);
Dandelions->new(config_handle => $cfg);

pass("Loaded a good JSON file");

is( try { Stilts->new(config_handle => "$cfg;"); 1; }, 1, "Did not load a bad JSON config");
is( try { Dandelions->new(config_handle => "$cfg;"); 1; }, 1, "Did not load a bad JSON config");

$cfg =~ s/}/,}/g;
ok( Stilts->new(config_handle => "$cfg"), "Did load a hand crafted JSON config");
ok( Dandelions->new(config_handle => "$cfg"), "Did load a hand crafted JSON config");

0 comments on commit 3dae0ce

Please sign in to comment.