The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::TrackBack - A modularized implementation of core TrackBack 1x functionality.

SYNOPSIS

        <!-- a sample receive ping -->
        use Net::TrackBack;
        use CGI qw( :cgi-lib :standard );

        my $q = new CGI;
        my $p = new Net::TrackBack;

        my $foo = $q->Vars;
        $p->receive_ping($p->get_tb_id($q), $foo, \&dump2warn );
        
        sub dump2warn {
                my $data=shift;
                foreach (keys %{ $data }) {     warn "$_ " . $data->{$_} }
        }
        
        <!-- a sample discover pings -->
        use Net::TrackBack;

        my $url = 'http://www.mplode.com/tima/archives/000190.html';
        $p=new Net::TrackBack;
        foreach ($p->discover($url)) { print "$_\n"; }
        if ($p->is_success) { print "A SUCCESS!\n"; }
        elsif ($p->is_error) { print "A FAILURE.\n". $p->message ."\n"; }

        <!-- a sample send ping -->
        use Net::TrackBack;

        $data{ping_url}='http://your/test/trackback.cgi/2ping';
        $data{title}='foo title!';
        $data{url}='http://www.foo.com/tima/';
        $data{excerpt}='foo is the word.';
        $data{blog_name}='Net::TrackBack';

        $p=new Net::TrackBack;
        print qq(Send Ping: $data{url})."\n";
        $p->send_ping(\%data);
        if ($p->is_success) { print "SUCCESS!\n" . $p->message ."\n"; }

DESCRIPTION

This is a fairly rapid "OO modularization" of the TrackBack functionality found in the TrackBack reference implementation and specification. It removes the display and management features found in the reference implementation in addition to its reliance on CGI.pm. I take no credit for the genius of TrackBack. Quite a bit of this modules code was derived from the Standalone TrackBack Implementation. My motivation in developing this module is to make experimentation and implementation of TrackBack functions a bit easier.

I've done a fair amount of testing of this module myself, but for now this module should be considered ALPHA software. In otherwords, the interface may change based on the feedback and usage patterns that emerge once this module circulates for a bit.

Your feedback and suggestions are greatly appreciated. There is still a lot of work to be done. This module is far from completed. See the TO DO section for some brief thoughts.

This modules requires the LWP package.

METHODS

The following methods are available:

  • new

    Constructor for Net::TrackBack. Returns a reference to a Net::TrackBack object.

  • $p->receive_ping($tb_id,%data_in,\&code_ref)

    Processes a hash of data received for a TrackBack ID (identified by $tb_id) and, after some standardized processing passes the data to the routine referenced in code_ref for further processing -- saving the disk, email etc.

  • $p->send_ping(%data_out)

    Takes a hash of elements as defined in the trackBack specification and pings the resource specified in the ping_url element.

  • $p->discover($url)

    Routine that gets a web page specified by $url and extracts all TrackBack pings found. The pings are returned in a simple array.

  • $p->is_success()

    Returns a boolen according to the success of the last operation.

  • $p->is_error()

    Returns a boolen according to the failure of the last operation.

  • $p->message()

    Returns a human-readable message for the last operation.

  • $p->get_tb_id($CGIobj)

    A utility method for those working with CGI.pm. Takes a reference to CGI.pm and extracts the TrackBack ping ID from the incoming request.

SEE ALSO

LWP, http://www.movabletype.org/docs/mttrackback.html

TO DO AND ISSUE

  • discover should probably return an array of hashes.

  • receive_ping does not handle namespaces properly. You're OK if you stick with the standard prefixes.

  • Does not support extended Dublin core elements such as &lt;dc:subject&gt; and so on.

  • Implement TrackBack threading feature?

LICENSE

The software is released under the Artistic License. The terms of the Artistic License are described at http://www.perl.com/language/misc/Artistic.html.

AUTHOR & COPYRIGHT

Except where otherwise noted, Net::TrackBack is Copyright 2003, Timothy Appnel, tima@mplode.com. All rights reserved.