Changeset 255


Ignore:
Timestamp:
May 13, 2006, 1:16:45 PM (14 years ago)
Author:
Dominic Hargreaves
Message:

Add Wiki::Toolkit::Feed::Atom

Location:
wiki-toolkit/trunk
Files:
1 edited
4 copied

Legend:

Unmodified
Added
Removed
  • wiki-toolkit/trunk/MANIFEST

    r254 r255  
    88bin/user-setup-mysql-dbixfts.pl
    99lib/Wiki/Toolkit/Extending.pod
     10lib/Wiki/Toolkit/Feed/Atom.pm
    1011lib/Wiki/Toolkit/Feed/RSS.pm
    1112lib/Wiki/Toolkit/Formatter/Default.pm
     
    5960t/298_feed_rss_recentchanges_add_test_data.t
    6061t/299_feed_rss_recentchanges.t
     62t/300_feed_atom_setup.t
     63t/301_feed_atom_add_test_data.t
     64t/302_feed_atom_recentchanges.t
    6165t/lib/Wiki/Toolkit/Plugin/Bar.pm
    6266t/lib/Wiki/Toolkit/Plugin/Foo.pm
  • wiki-toolkit/trunk/lib/Wiki/Toolkit/Feed/Atom.pm

    r253 r255  
    1 package CGI::Wiki::Plugin::Atom;
     1package Wiki::Toolkit::Feed::Atom;
    22
    33use strict;
     
    2020  my $wiki = $args{wiki};
    2121
    22   unless ($wiki && UNIVERSAL::isa($wiki, 'CGI::Wiki'))
    23   {
    24     croak 'No CGI::Wiki object supplied';
     22  unless ($wiki && UNIVERSAL::isa($wiki, 'Wiki::Toolkit'))
     23  {
     24    croak 'No Wiki::Toolkit object supplied';
    2525  }
    2626 
     
    4040  }
    4141
    42   $self->{timestamp_fmt} = $CGI::Wiki::Store::Database::timestamp_fmt;
     42  $self->{timestamp_fmt} = $Wiki::Toolkit::Store::Database::timestamp_fmt;
    4343  $self->{utc_offset} = strftime "%z", localtime;
    4444  $self->{utc_offset} =~ s/(..)(..)$/$1:$2/;
     
    179179=head1 NAME
    180180
    181   CGI::Wiki::Plugin::Atom - A CGI::Wiki plugin to output RecentChanges RSS.
     181  Wiki::Toolkit::Feed::Atom - A Wiki::Toolkit plugin to output RecentChanges RSS.
    182182
    183183=head1 DESCRIPTION
    184184
    185 This is an alternative access to the recent changes of a CGI::Wiki
     185This is an alternative access to the recent changes of a Wiki::Toolkit
    186186wiki. It outputs the Atom Syndication Format as described at
    187187L<http://www.atomenabled.org/developers/syndication/>.
    188188
    189 This module is a straight port of L<CGI::Wiki::Plugin::RSS::ModWiki>.
     189This module is a straight port of L<Wiki::Toolkit::Feed::RSS>.
    190190
    191191=head1 SYNOPSIS
    192192
    193   use CGI::Wiki;
    194   use CGI::Wiki::Plugin::Atom;
    195 
    196   my $wiki = CGI::Wiki->new( ... );  # See perldoc CGI::Wiki
     193  use Wiki::Toolkit;
     194  use Wiki::Toolkit::Feed::Atom;
     195
     196  my $wiki = Wiki::Toolkit->new( ... );  # See perldoc Wiki::Toolkit
    197197
    198198  # Set up the RSS feeder with the mandatory arguments - see
    199199  # C<new()> below for more, optional, arguments.
    200   my $atom = CGI::Wiki::Plugin::Atom->new(
     200  my $atom = Wiki::Toolkit::Feed::Atom->new(
    201201    wiki                => $wiki,
    202202    site_name           => 'My Wiki',
     
    218218=head2 C<new()>
    219219
    220   my $atom = CGI::Wiki::Plugin::Atom->new(
     220  my $atom = Wiki::Toolkit::Feed::Atom->new(
    221221    # Mandatory arguments:
    222222    wiki                 => $wiki,
     
    233233    # Optional arguments:
    234234    site_description     => 'My wiki about my stuff',
    235     software_name        => $your_software_name,     # e.g. "CGI::Wiki"
     235    software_name        => $your_software_name,     # e.g. "Wiki::Toolkit"
    236236    software_version     => $your_software_version,  # e.g. "0.73"
    237237    software_homepage    => $your_software_homepage, # e.g. "http://search.cpan.org/dist/CGI-Wiki/"
    238238  );
    239239
    240 C<wiki> must be a L<CGI::Wiki> object. C<make_node_url>, if supplied, must
     240C<wiki> must be a L<Wiki::Toolkit> object. C<make_node_url>, if supplied, must
    241241be a coderef.
    242242
     
    309309B<Note:> Many of the fields emitted by the Atom generator are taken
    310310from the node metadata. The form of this metadata is I<not> mandated
    311 by L<CGI::Wiki>. Your wiki application should make sure to store some or
     311by L<Wiki::Toolkit>. Your wiki application should make sure to store some or
    312312all of the following metadata when calling C<write_node>:
    313313
     
    336336=over 4
    337337
    338 =item * L<CGI::Wiki>
     338=item * L<Wiki::Toolkit>
    339339
    340340=item * L<http://www.atomenabled.org/developers/syndication/>
     
    344344=head1 MAINTAINER
    345345
    346 Earle Martin <EMARTIN@cpan.org>.
     346The Wiki::Toolkit team, http://www.wiki-toolkit.org/.
    347347
    348348=head1 COPYRIGHT AND LICENSE
    349349
    350 Copyright 2006 Earle Martin.
     350Copyright 2006 Earle Martin and the Wiki::Toolkit team.
    351351
    352352This module is free software; you can redistribute it and/or modify it
     
    355355=head1 THANKS
    356356
    357 Kake Pugh for originally writing CGI::Wiki::Plugin::RSS::ModWiki and indeed
    358 CGI::Wiki itself.
     357Kake Pugh for originally writing Wiki::Toolkit::Feed::RSS and indeed
     358Wiki::Toolkit itself.
    359359
    360360=cut
  • wiki-toolkit/trunk/t/300_feed_atom_setup.t

    r253 r255  
    11use strict;
    22use Test::More tests => 1;
    3 use CGI::Wiki;
    4 use CGI::Wiki::TestConfig::Utilities;
     3use Wiki::Toolkit;
     4use Wiki::Toolkit::TestConfig::Utilities;
    55
    66# Reinitialise every configured storage backend.
    7 CGI::Wiki::TestConfig::Utilities->reinitialise_stores;
     7Wiki::Toolkit::TestConfig::Utilities->reinitialise_stores;
    88
    99pass( "Reinitialised stores" );
  • wiki-toolkit/trunk/t/301_feed_atom_add_test_data.t

    r253 r255  
    11use strict;
    22
    3 use CGI::Wiki::TestConfig::Utilities;
    4 use CGI::Wiki;
     3use Wiki::Toolkit::TestConfig::Utilities;
     4use Wiki::Toolkit;
    55
    6 use Test::More tests => $CGI::Wiki::TestConfig::Utilities::num_stores;
     6use Test::More tests => $Wiki::Toolkit::TestConfig::Utilities::num_stores;
    77
    88# Add test data to the stores.
    9 my %stores = CGI::Wiki::TestConfig::Utilities->stores;
     9my %stores = Wiki::Toolkit::TestConfig::Utilities->stores;
    1010
    1111my ($store_name, $store);
     
    1717      print "#\n##### TEST CONFIG: Store: $store_name\n#\n";
    1818
    19       my $wiki = CGI::Wiki->new( store => $store );
     19      my $wiki = Wiki::Toolkit->new( store => $store );
    2020
    2121      $wiki->write_node( "Old Node",
  • wiki-toolkit/trunk/t/302_feed_atom_recentchanges.t

    r253 r255  
    11use strict;
    2 use CGI::Wiki::TestConfig::Utilities;
    3 use CGI::Wiki;
     2use Wiki::Toolkit::TestConfig::Utilities;
     3use Wiki::Toolkit;
    44use URI::Escape;
    55
    66use Test::More tests =>
    7   (3 + 11 * $CGI::Wiki::TestConfig::Utilities::num_stores);
     7  (3 + 11 * $Wiki::Toolkit::TestConfig::Utilities::num_stores);
    88
    9 use_ok( "CGI::Wiki::Plugin::Atom" );
     9use_ok( "Wiki::Toolkit::Feed::Atom" );
    1010
    11 eval { my $atom = CGI::Wiki::Plugin::Atom->new; };
     11eval { my $atom = Wiki::Toolkit::Feed::Atom->new; };
    1212ok( $@, "new croaks if no wiki object supplied" );
    1313
    1414eval {
    15         my $atom = CGI::Wiki::Plugin::Atom->new( wiki => "foo" );
     15        my $atom = Wiki::Toolkit::Feed::Atom->new( wiki => "foo" );
    1616     };
    1717ok( $@, "new croaks if something that isn't a wiki object supplied" );
    1818
    19 my %stores = CGI::Wiki::TestConfig::Utilities->stores;
     19my %stores = Wiki::Toolkit::TestConfig::Utilities->stores;
    2020
    2121my ($store_name, $store);
     
    2727      print "#\n##### TEST CONFIG: Store: $store_name\n#\n";
    2828
    29       my $wiki = CGI::Wiki->new( store => $store );
     29      my $wiki = Wiki::Toolkit->new( store => $store );
    3030      my %default_config = (
    3131              wiki => $wiki,
    32               site_name => "CGI::Wiki Test Site",
     32              site_name => "Wiki::Toolkit Test Site",
    3333              make_node_url => sub {
    3434                                     my $id = uri_escape($_[0]);
     
    4141      );
    4242      my $atom = eval {
    43           CGI::Wiki::Plugin::Atom->new( %default_config, site_url => "http://example.com/kakeswiki/" );
     43          Wiki::Toolkit::Feed::Atom->new( %default_config, site_url => "http://example.com/kakeswiki/" );
    4444      };
    4545      is( $@, "",
    4646         "'new' doesn't croak if wiki object and mandatory parameters supplied"
    4747      );
    48       isa_ok( $atom, "CGI::Wiki::Plugin::Atom" );
     48      isa_ok( $atom, "Wiki::Toolkit::Feed::Atom" );
    4949
    5050      my $feed = eval { $atom->recent_changes; };
Note: See TracChangeset for help on using the changeset viewer.