Apache-MONITOR
view release on metacpan or search on metacpan
lib/Apache/MONITOR.pm view on Meta::CPAN
{
require LWP::UserAgent;
@Apache::MONITOR::ISA = qw(LWP::UserAgent);
my $ua = __PACKAGE__->new;
my $args = @_ ? \@_ : \@ARGV;
my ($url,$reply_to,$proxy) = @$args;
$ua->proxy(['http'], $proxy ) if(defined $proxy);
my $req = HTTP::Request->new('MONITOR' => $url );
$req->header('Reply_To' => $reply_to );
#$req->header('Accept' => 'text/plain' );
my $res = $ua->request($req);
if($res->is_success)
{
print $res->as_string();
print "Monitor created at: ",$res->header('Location') , "\n";
}
lib/Apache/MONITOR.pm view on Meta::CPAN
sub UNSUBSCRIBE
{
require LWP::UserAgent;
@Apache::MONITOR::ISA = qw(LWP::UserAgent);
my $ua = __PACKAGE__->new;
my $args = @_ ? \@_ : \@ARGV;
my ($mon_url) = @$args;
my $req = HTTP::Request->new('DELETE' => $mon_url );
my $res = $ua->request($req);
if($res->is_success)
{
print $res->as_string();
#print $res->content;
print "Monitor deleted\n";
}
else
lib/Apache/MONITOR.pm view on Meta::CPAN
# updating record with new lastmod
$uris{$monitored_uri} = "$u $mon_string $modified_time $state";
foreach my $muri (keys %monitors)
{
my $value = $monitors{$muri};
my ($u,$re) = split(/ / , $value);
next unless ($u eq $monitored_uri);
#my $req = HTTP::Request->new('GET' => $monitored_uri);
#my $res = $ua->request($req);
#my $body;
#if($res->is_success)
#{
# $body = $res->content;
#}
#else
#{
# $body = $res->as_string();
#}
lib/Apache/MONITOR.pm view on Meta::CPAN
}
sub poll_to_checksum
{
require LWP::UserAgent;
@Apache::MONITOR::ISA = qw(LWP::UserAgent);
my $ua = __PACKAGE__->new;
my $args = @_ ? \@_ : \@ARGV;
my ($uri) = @$args;
my $req = HTTP::Request->new('GET' => $uri);
my $res = $ua->request($req);
if($res->is_success)
{
my $s = $res->content;
$s =~ s/<meta[^>]+>//gi;
my $cs = cksum($s);
return ($cs,0,'');
}
else
{
( run in 0.389 second using v1.01-cache-2.11-cpan-de7293f3b23 )