From: Vincent Pit Date: Sun, 18 Jul 2010 17:15:42 +0000 (+0200) Subject: Register Tikz->formatter in the API X-Git-Tag: v0.01~45 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=9e8367c3ac993eb5733ab8a1b517d037f8d9b8f4;p=perl%2Fmodules%2FLaTeX-TikZ.git Register Tikz->formatter in the API So that we no longer have to load LaTeX::TikZ::Formatter manually. --- diff --git a/lib/LaTeX/TikZ/API.pm b/lib/LaTeX/TikZ/API.pm index 02724e4..46fe198 100644 --- a/lib/LaTeX/TikZ/API.pm +++ b/lib/LaTeX/TikZ/API.pm @@ -54,6 +54,8 @@ sub register { } sub load { + require LaTeX::TikZ::Formatter; # formatter + require LaTeX::TikZ::Set::Raw; # raw require LaTeX::TikZ::Set::Path; # path diff --git a/lib/LaTeX/TikZ/Formatter.pm b/lib/LaTeX/TikZ/Formatter.pm index 18abe13..d349ed3 100644 --- a/lib/LaTeX/TikZ/Formatter.pm +++ b/lib/LaTeX/TikZ/Formatter.pm @@ -159,6 +159,12 @@ sub thickness { 0.8 * $width * ($tikz->scale / 5); } +use LaTeX::TikZ::API formatter => sub { + shift; + + __PACKAGE__->new(@_); +}; + __PACKAGE__->meta->make_immutable; =head1 AUTHOR diff --git a/t/10-set.t b/t/10-set.t index f21f587..f8d4dee 100644 --- a/t/10-set.t +++ b/t/10-set.t @@ -6,9 +6,8 @@ use warnings; use Test::More tests => 12 + 2 * 7; use LaTeX::TikZ; -use LaTeX::TikZ::Formatter; -my $tikz = LaTeX::TikZ::Formatter->new( +my $tikz = Tikz->formatter( format => '%d', ); diff --git a/t/20-mod.t b/t/20-mod.t index 38ab3fe..a47106e 100644 --- a/t/20-mod.t +++ b/t/20-mod.t @@ -6,9 +6,8 @@ use warnings; use Test::More tests => 14 + 2 * 18; use LaTeX::TikZ; -use LaTeX::TikZ::Formatter; -my $tikz = LaTeX::TikZ::Formatter->new( +my $tikz = Tikz->formatter( format => '%d', );