Skip to content

Commit

Permalink
removed a few debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 12, 2012
1 parent 8240fa3 commit d973340
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,6 +1,6 @@
This file documents the revision history for Perl extension Mojolicious.

2.81 2012-04-11
2.81 2012-04-12
- Improved all debug messages.
- Improved documentation.
- Improved tests.
Expand Down
19 changes: 1 addition & 18 deletions lib/Mojo/Server/Morbo.pm
Expand Up @@ -5,8 +5,6 @@ use Mojo::Home;
use Mojo::Server::Daemon;
use POSIX 'WNOHANG';

use constant DEBUG => $ENV{MORBO_DEBUG} || 0;

has watch => sub { [qw/lib templates/] };

# "All in all, this is one day Mittens the kitten won’t soon forget.
Expand All @@ -28,7 +26,6 @@ sub check_file {

sub run {
my ($self, $app) = @_;
warn "-- Manager started ($$)\n" if DEBUG;

# Watch files and manage worker
$SIG{CHLD} = sub { $self->_reap };
Expand All @@ -51,7 +48,6 @@ sub _manage {
my $self = shift;

# Discover files
warn "-- Discovering new files\n" if DEBUG;
my @files;
for my $watch (@{$self->watch}) {
if (-d $watch) {
Expand All @@ -63,9 +59,7 @@ sub _manage {

# Check files
for my $file (@files) {
warn "-- Checking ($file)\n" if DEBUG;
next unless $self->check_file($file);
warn "-- Modified ($file)\n" if DEBUG;
say qq/File "$file" changed, restarting./ if $ENV{MORBO_VERBOSE};
kill 'TERM', $self->{running} if $self->{running};
$self->{modified} = 1;
Expand All @@ -80,10 +74,7 @@ sub _manage {

sub _reap {
my $self = shift;
while ((my $pid = waitpid -1, WNOHANG) > 0) {
warn "-- Worker stopped ($pid)\n" if DEBUG;
delete $self->{running};
}
while ((my $pid = waitpid -1, WNOHANG) > 0) { delete $self->{running} }
}

# "Morbo cannot read his teleprompter.
Expand All @@ -102,7 +93,6 @@ sub _spawn {
return $self->{running} = $pid if $pid;

# Worker
warn "-- Worker started ($$)\n" if DEBUG;
$SIG{CHLD} = 'DEFAULT';
$SIG{INT} = $SIG{TERM} = $SIG{QUIT} = sub { $self->{finished} = 1 };
my $daemon = Mojo::Server::Daemon->new;
Expand Down Expand Up @@ -177,13 +167,6 @@ Check if file has been modified since last check.
Run server for application.
=head1 DEBUGGING
You can set the C<MORBO_DEBUG> environment variable to get some advanced
diagnostics information printed to C<STDERR>.
MORBO_DEBUG=1
=head1 SEE ALSO
L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicio.us>.
Expand Down
18 changes: 2 additions & 16 deletions lib/Mojolicious/Plugin/Config.pm
Expand Up @@ -5,8 +5,6 @@ use File::Basename 'basename';
use File::Spec::Functions 'file_name_is_absolute';
use Mojo::Util 'decamelize';

use constant DEBUG => $ENV{MOJO_CONFIG_DEBUG} || 0;

# "Who are you, my warranty?!"
sub load {
my ($self, $file, $conf, $app) = @_;
Expand Down Expand Up @@ -55,18 +53,13 @@ sub register {
# Default extension
$file .= '.' . ($conf->{ext} || 'conf');
}
warn "-- Config file ($file)\n" if DEBUG;

# Mode specific config file
my $mode;
if ($file =~ /^(.*)\.([^\.]+)$/) {
$mode = join '.', $1, $app->mode, $2;
warn "-- Mode specific config file ($mode)\n" if DEBUG;
}
if ($file =~ /^(.*)\.([^\.]+)$/) { $mode = join '.', $1, $app->mode, $2 }

# Absolute path
$file = $app->home->rel_file($file)
unless file_name_is_absolute $file;
$file = $app->home->rel_file($file) unless file_name_is_absolute $file;
$mode = $app->home->rel_file($mode)
if defined $mode && !file_name_is_absolute $mode;

Expand Down Expand Up @@ -188,13 +181,6 @@ Parse configuration file.
Register plugin in L<Mojolicious> application.
=head1 DEBUGGING
You can set the C<MOJO_CONFIG_DEBUG> environment variable to get some
advanced diagnostics information printed to C<STDERR>.
MOJO_CONFIG_DEBUG=1
=head1 SEE ALSO
L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicio.us>.
Expand Down

0 comments on commit d973340

Please sign in to comment.