Makefile.PL
README
lib/LaTeX/TikZ.pm
-lib/LaTeX/TikZ/API.pm
lib/LaTeX/TikZ/Formatter.pm
+lib/LaTeX/TikZ/Interface.pm
lib/LaTeX/TikZ/Mod.pm
lib/LaTeX/TikZ/Mod/Clip.pm
lib/LaTeX/TikZ/Mod/Color.pm
our $VERSION = '0.01';
-use LaTeX::TikZ::API;
+use LaTeX::TikZ::Interface;
sub import {
shift;
}
my $pkg = caller;
- my $const = sub () { 'LaTeX::TikZ::API' };
+ my $const = sub () { 'LaTeX::TikZ::Interface' };
{
no strict 'refs';
*{$pkg . '::' . $name} = $const;
}
- LaTeX::TikZ::API->load;
+ LaTeX::TikZ::Interface->load;
return;
}
0.8 * $width * ($tikz->scale / 5);
}
-use LaTeX::TikZ::API formatter => sub {
+use LaTeX::TikZ::Interface formatter => sub {
shift;
__PACKAGE__->new(@_);
-package LaTeX::TikZ::API;
+package LaTeX::TikZ::Interface;
use strict;
use warnings;
=head1 NAME
-LaTeX::TikZ::API - LaTeX::TikZ public API register and loader.
+LaTeX::TikZ::Interface - LaTeX::TikZ public interface register and loader.
=head1 VERSION
=cut
-1; # End of LaTeX::TikZ::API
+1; # End of LaTeX::TikZ::Interface
)
}
-use LaTeX::TikZ::API clip => sub {
+use LaTeX::TikZ::Interface clip => sub {
shift;
__PACKAGE__->new(clip => $_[0]);
sub apply { 'color=' . $_[0]->color }
-use LaTeX::TikZ::API color => sub {
+use LaTeX::TikZ::Interface color => sub {
shift;
__PACKAGE__->new(color => $_[0]);
sub apply { 'fill=' . $_[0]->color }
-use LaTeX::TikZ::API fill => sub {
+use LaTeX::TikZ::Interface fill => sub {
shift;
__PACKAGE__->new(color => $_[0]);
)
}
-use LaTeX::TikZ::API layer => sub {
+use LaTeX::TikZ::Interface layer => sub {
shift;
my $name = shift;
sub apply { $_[0]->content }
-use LaTeX::TikZ::API raw_mod => sub {
+use LaTeX::TikZ::Interface raw_mod => sub {
shift;
__PACKAGE__->new(content => $_[0]);
sub apply { sprintf 'line width=%0.1fpt', $_[1]->thickness($_[0]->width) }
-use LaTeX::TikZ::API width => sub {
+use LaTeX::TikZ::Interface width => sub {
shift;
__PACKAGE__->new(width => $_[0]);
$set->center->path(@_) . ' circle (' . $tikz->len($set->radius) . ')';
}
-use LaTeX::TikZ::API circle => sub {
+use LaTeX::TikZ::Interface circle => sub {
shift;
__PACKAGE__->new(center => $_[0], radius => $_[1]);
$set->from->path(@_) . ' -- ' . $set->to->path(@_);
}
-use LaTeX::TikZ::API line => sub {
+use LaTeX::TikZ::Interface line => sub {
shift;
__PACKAGE__->new(from => $_[0], to => $_[1]);
join ' ', map $_->path(@_), $set->ops;
}
-use LaTeX::TikZ::API path => sub {
+use LaTeX::TikZ::Interface path => sub {
shift;
__PACKAGE__->new(ops => \@_);
'(' . $tikz->len($p->Re) . ',' . $tikz->len($p->Im) . ')';
}
-use LaTeX::TikZ::API point => sub {
+use LaTeX::TikZ::Interface point => sub {
shift;
__PACKAGE__->new(point => $_[0]);
sub path { $_[0]->content }
-use LaTeX::TikZ::API raw => sub {
+use LaTeX::TikZ::Interface raw => sub {
shift;
__PACKAGE__->new(content => join ' ', @_);
$class->$orig(@_);
};
-use LaTeX::TikZ::API rectangle => sub {
+use LaTeX::TikZ::Interface rectangle => sub {
shift;
my ($p, $q) = @_;
$set->kids;
}
-use LaTeX::TikZ::API seq => sub {
+use LaTeX::TikZ::Interface seq => sub {
shift;
__PACKAGE__->new(kids => \@_);
BEGIN {
use_ok( 'LaTeX::TikZ' );
- use_ok( 'LaTeX::TikZ::API' );
use_ok( 'LaTeX::TikZ::Formatter' );
+ use_ok( 'LaTeX::TikZ::Interface' );
use_ok( 'LaTeX::TikZ::Mod' );
use_ok( 'LaTeX::TikZ::Mod::Clip' );
use_ok( 'LaTeX::TikZ::Mod::Color' );
ok(Tikz->can($_), "Tikz evaluates to something that ->can($_)");
}
-require LaTeX::TikZ::API;
+require LaTeX::TikZ::Interface;
for my $name (undef, ':)') {
eval {
- LaTeX::TikZ::API->import(
+ LaTeX::TikZ::Interface->import(
$name => sub { },
);
};
}
eval {
- LaTeX::TikZ::API->import(
+ LaTeX::TikZ::Interface->import(
'raw' => sub { },
);
};
for my $code (undef, [ ]) {
eval {
- LaTeX::TikZ::API->import(
+ LaTeX::TikZ::Interface->import(
'foo' => $code,
);
};
}
eval {
- LaTeX::TikZ::API->import(
+ LaTeX::TikZ::Interface->import(
'foo' => sub { @_ },
);
};
is_deeply [ Tikz->foo('hello') ], [ Tikz, 'hello' ], 'Tikz->foo works';
eval {
- LaTeX::TikZ::API->import(
+ LaTeX::TikZ::Interface->import(
'bar' => sub { @_ },
'baz' => undef,
);