X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FLaTeX%2FTikZ%2FInterface.pm;fp=lib%2FLaTeX%2FTikZ%2FInterface.pm;h=91342abfc1e70464c586497d2b2d0cc0bcf910b5;hb=5adf00c880491bac3bd793a07431cf161c03643f;hp=0000000000000000000000000000000000000000;hpb=e955781895f97b6ff7ec50270466d459c992e4e1;p=perl%2Fmodules%2FLaTeX-TikZ.git diff --git a/lib/LaTeX/TikZ/Interface.pm b/lib/LaTeX/TikZ/Interface.pm new file mode 100644 index 0000000..91342ab --- /dev/null +++ b/lib/LaTeX/TikZ/Interface.pm @@ -0,0 +1,104 @@ +package LaTeX::TikZ::Interface; + +use strict; +use warnings; + +=head1 NAME + +LaTeX::TikZ::Interface - LaTeX::TikZ public interface register and loader. + +=head1 VERSION + +Version 0.01 + +=cut + +our $VERSION = '0.01'; + +use Sub::Name (); + +sub import { + shift; + + register(@_); +} + +sub register { + while (@_ >= 2) { + my ($name, $code) = splice @_, 0, 2; + + unless (defined $name and $name =~ /^[a-z_][a-z0-9_]+$/i) { + require Carp; + Carp::confess('Invalid interface name'); + } + + if (do { no strict 'refs'; defined &{__PACKAGE__."::$name"} }) { + require Carp; + Carp::confess("'$name' is already defined in the interface"); + } + + unless (defined $code and ref $code eq 'CODE') { + require Carp; + Carp::confess('Invalid code reference'); + } + + Sub::Name::subname($name => $code); + + { + no strict 'refs'; + *{__PACKAGE__.'::'.$name} = $code; + } + } + + return; +} + +sub load { + require LaTeX::TikZ::Formatter; # formatter + + require LaTeX::TikZ::Set::Raw; # raw + + require LaTeX::TikZ::Set::Path; # path + require LaTeX::TikZ::Set::Sequence; # seq + + require LaTeX::TikZ::Set::Point; # point + require LaTeX::TikZ::Set::Line; # line + require LaTeX::TikZ::Set::Rectangle; # rectangle + require LaTeX::TikZ::Set::Circle; # circle + + require LaTeX::TikZ::Mod::Raw; # raw_mod + + require LaTeX::TikZ::Mod::Clip; # clip + require LaTeX::TikZ::Mod::Layer; # layer + + require LaTeX::TikZ::Mod::Width; # width + require LaTeX::TikZ::Mod::Color; # color + require LaTeX::TikZ::Mod::Fill; # fill +} + +=head1 AUTHOR + +Vincent Pit, C<< >>, L. + +You can contact me by mail or on C (vincent). + +=head1 BUGS + +Please report any bugs or feature requests to C, or through the web interface at L. +I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. + +=head1 SUPPORT + +You can find documentation for this module with the perldoc command. + + perldoc LaTeX::TikZ + +=head1 COPYRIGHT & LICENSE + +Copyright 2010 Vincent Pit, all rights reserved. + +This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. + +=cut + +1; # End of LaTeX::TikZ::Interface