# Blosxom Plugin: cpan_module_tag
# Author: Dean Wilson 
# Version: 0.1 (20050602)
# Plugin Homepage: http://www.unixdaemon.net/blosxom_plugins.html#cpan_module_tag
# License: GPL
# Documentation: Please see the end of this file.

package cpan_module_tag;

sub start {
  1;
}


sub story {
  my ($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_;

  $$body_ref =~ s!<cpan\s+"([^"]+)"\s*/?>!<a href="http://search.cpan.org/perldoc?$1">$1</a>!sg;
  $$body_ref =~ s!<a\s+href="cpan:([^"]+)"\s*/?>!<a href="http://search.cpan.org/perldoc?$1">$1</a>!gs;
  $$body_ref =~ s!<cpan>([^>]*)</cpan>!<a href="http://search.cpan.org/perldoc?$1">$1</a>!sg;

  1;
}

1;

__END__

=head1 NAME

Blosxom Plugin: cpan_module_tag

=head1 SYNOPSIS


This extension allows you to link to CPAN modules in your blog posts without performing the
tedious steps of looking up the module, getting the URL, putting it in an
<a href=""> etc.

You can specify a link to a module using any of the following shortcuts:

 <cpan "Data::Transactional">
 <a href="cpan:Net::Random">
 <cpan>Tie::Scalar::Decay</cpan>

And it will be translated in to a full <a href=""> that points to the
module on CPAN.

=head1 VERSION

0.1

=head1 AUTHOR

Dean Wilson 

=head1 LICENSE

GPL

=cut
