Changeset 354

Show
Ignore:
Timestamp:
11/10/06 19:53:16 (5 years ago)
Author:
nick
Message:

Add setup and first test

Location:
wiki-toolkit-plugin-ping
Files:
1 added
1 modified

Legend:

Unmodified
Added
Removed
  • wiki-toolkit-plugin-ping/lib/Wiki/Toolkit/Plugin/Ping.pm

    r353 r354  
    99use LWP; 
    1010 
     11 
     12 
    1113sub new { 
    1214    my $class = shift; 
     15    my %services = @_; 
    1316 
     17    my $self = {}; 
     18    bless $self, $class; 
     19 
     20    # Check the services 
     21    foreach my $service (keys %services) { 
     22        my $url = $services{$service}; 
     23 
     24        # Make valid 
     25        unless($url =~ /^http:\/\//) { 
     26            $url = "http://".$url; 
     27            $services{$service} = $url; 
     28        } 
     29        unless($url =~ /\$url/) { 
     30            die("For $service, URL '$url' didn't contain \$url anywhere\n"); 
     31        } 
     32    } 
     33 
     34    # Save 
     35    $self->{services} = \%services; 
     36 
     37    # Done setup 
     38    return $self; 
    1439} 
    1540 
    16411; 
     42__END__ 
     43 
     44=head1 NAME 
     45 
     46Wiki::Toolkit::Plugin::Ping - "ping" various services when nodes are written 
     47 
     48=head1 SYNOPSIS 
     49 
     50  use Wiki::Toolkit::Plugin::Ping; 
     51  my $ping = Wiki::Toolkit::Plugin::Ping->new(  
     52                    "geourl" => 'http://geourl.org/ping?p=$url' 
     53  ); 
     54  $wiki->register_pugin( plugin => $ping ); 
     55 
     56=head1 DESCRIPTIOn 
     57 
     58A plug-in for Wiki::Toolkit sites, which will "ping" various external services 
     59when a node is written. A list of the services to ping, and where in their 
     60URLs to add the URL of the node, are supplied when the plugin is created. 
     61 
     62=head1 AUTHOR 
     63 
     64The Wiki::Toolkit team (http://www.wiki-toolkit.org/) 
     65 
     66=head1 COPYRIGHT 
     67 
     68     Copyright (C) 2003-2004 I. P. Williams (ivorw_openguides [at] xemaps {dot} com). 
     69     Copyright (C) 2006 the Wiki::Toolkit team (http://www.wiki-toolkit.org/) 
     70     All Rights Reserved. 
     71 
     72This module is free software; you can redistribute it and/or modify it 
     73under the same terms as Perl itself. 
     74 
     75=head1 SEE ALSO 
     76 
     77L<Wiki::Toolkit>, L<Wiki::Toolkit::Plugin>, L<OpenGuides> 
     78 
     79=cut