Acme-Matt-Daemon

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: 1.4
name: Acme-Matt-Daemon
no_index:
  directory:
    - inc
    - t
requires:
  Log::Syslog::Abstract: 0
  Proc::Daemon: 0
resources:
  license: http://dev.perl.org/licenses/
  repository: http://github.com/robertkrimen/acme-matt-daemon/tree/master
version: 0.01

Makefile.PL  view on Meta::CPAN

        return $_[1];
    };
}

{
    map { my ($pk, $vr) = split m/\s/; build_requires $pk => $vr || 0 } grep { ! /^\s*#/ } split m/\n/, <<_END_;
Test::More
_END_

    map { my ($pk, $vr) = split m/\s/; requires $pk => $vr || 0 } grep { ! /^\s*#/ } split m/\n/, <<_END_;
Log::Syslog::Abstract
Proc::Daemon
_END_
}

if (-e 'inc/.author') {
    my $all_from = join '/', 'lib', split m/-/, name . '.pm';
    `perldoc -tF $all_from > README` if ! -e 'README' || (stat $all_from)[9] > (stat 'README')[9];
}

auto_install;

README  view on Meta::CPAN

SYNOPSIS
    MATT DAEMON

        perl -MAcme::Matt::Daemon -e 'MATT DAEMON'

DESCRIPTION
    MATT DAEMON

    <http://www.youtube.com/watch?v=ZWTzyU5MFgM>

    Acme::Matt::Daemon will daemonize and output MATT DAEMON to your syslog
    at every 15 to 60 minutes (randomly). Enjoy!

AUTHOR
    Robert Krimen, "<rkrimen at cpan.org>"

BUGS
    Please report any bugs or feature requests to "bug-acme-matt-daemon at
    rt.cpan.org", or through the web interface at
    <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Acme-Matt-Daemon>. I
    will be notified, and then you'll automatically be notified of progress

inc/Module/Install/Fetch.pm  view on Meta::CPAN

    require Cwd;
    my $dir = Cwd::getcwd();
    chdir $args{local_dir} or return if exists $args{local_dir};

    if (eval { require LWP::Simple; 1 }) {
        LWP::Simple::mirror($args{url}, $file);
    }
    elsif (eval { require Net::FTP; 1 }) { eval {
        # use Net::FTP to get past firewall
        my $ftp = Net::FTP->new($host, Passive => 1, Timeout => 600);
        $ftp->login("anonymous", 'anonymous@example.com');
        $ftp->cwd($path);
        $ftp->binary;
        $ftp->get($file) or (warn("$!\n"), return);
        $ftp->quit;
    } }
    elsif (my $ftp = $self->can_run('ftp')) { eval {
        # no Net::FTP, fallback to ftp.exe
        require FileHandle;
        my $fh = FileHandle->new;

        local $SIG{CHLD} = 'IGNORE';
        unless ($fh->open("|$ftp -n")) {
            warn "Couldn't open ftp: $!\n";
            chdir $dir; return;
        }

        my @dialog = split(/\n/, <<"END_FTP");
open $host
user anonymous anonymous\@example.com
cd $path
binary
get $file $file
quit
END_FTP
        foreach (@dialog) { $fh->print("$_\n") }
        $fh->close;
    } }
    else {
        warn "No working 'ftp' program available!\n";
        chdir $dir; return;
    }

    unless (-f $file) {
        warn "Fetching failed: $@\n";
        chdir $dir; return;

lib/Acme/Matt/Daemon.pm  view on Meta::CPAN

Version 0.01

=cut

our $VERSION = '0.01';

use vars qw/@ISA @EXPORT/;
@ISA = qw/Exporter/;
@EXPORT = qw/MATT DAEMON DAMON MATTDAMON MATTDAEMON/;

use Log::Syslog::Abstract qw/openlog syslog closelog/;
use Proc::Daemon;

sub MATT {
}

my @interval = map { $_ * 60 } qw/15 60/;
$interval[1] -= $interval[0];

sub DAEMON {

    print "MATT DAEMON\n";

    Proc::Daemon::Init;

    while (1) {
        openlog( 'matt-daemon', '', 'local0' );

        syslog( 'info', '%s', 'MATT DAEMON' );

        closelog;

        sleep($interval[0] + int rand $interval[1]);
    }
}

*DAMON = \&DAEMON;
*MATTDAMON = \&DAEMON;
*MATTDAEMON = \&DAEMON;

=head1 SYNOPSIS

lib/Acme/Matt/Daemon.pm  view on Meta::CPAN

MATT DAEMON

    perl -MAcme::Matt::Daemon -e 'MATT DAEMON'

=head1 DESCRIPTION

MATT DAEMON

L<http://www.youtube.com/watch?v=ZWTzyU5MFgM>

L<Acme::Matt::Daemon> will daemonize and output MATT DAEMON to your syslog at every 15 to 60 minutes (randomly). Enjoy!

=head1 AUTHOR

Robert Krimen, C<< <rkrimen at cpan.org> >>

=head1 BUGS

Please report any bugs or feature requests to C<bug-acme-matt-daemon at rt.cpan.org>, or through
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Acme-Matt-Daemon>.  I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.



( run in 1.362 second using v1.01-cache-2.11-cpan-49f99fa48dc )