X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FLaTeX%2FTikZ%2FSet%2FRaw.pm;h=ee61e8f0612b66dcf05ca77b356f1842db567ec1;hb=e6c6fbca8df4f8df7bbce2eb98dd260ed51d9141;hp=169569f9aab93d9ccaf34eb5c38478ba0a5738e9;hpb=5adf00c880491bac3bd793a07431cf161c03643f;p=perl%2Fmodules%2FLaTeX-TikZ.git diff --git a/lib/LaTeX/TikZ/Set/Raw.pm b/lib/LaTeX/TikZ/Set/Raw.pm index 169569f..ee61e8f 100644 --- a/lib/LaTeX/TikZ/Set/Raw.pm +++ b/lib/LaTeX/TikZ/Set/Raw.pm @@ -15,23 +15,55 @@ Version 0.01 our $VERSION = '0.01'; +use LaTeX::TikZ::Interface; +use LaTeX::TikZ::Functor; + use Any::Moose; +=head1 RELATIONSHIPS + +This class consumes the L role, and as such implements the L method. + +=cut + with 'LaTeX::TikZ::Set::Op'; +=head1 ATTRIBUTES + +=head2 C + +The bare string the raw mod is made of. + +=cut + has 'content' => ( is => 'ro', isa => 'Str', required => 1, ); +=head1 METHODS + +=head2 C + +=cut + sub path { $_[0]->content } -use LaTeX::TikZ::Interface raw => sub { - shift; +LaTeX::TikZ::Interface->register( + raw => sub { + shift; + + __PACKAGE__->new(content => join ' ', @_); + }, +); - __PACKAGE__->new(content => join ' ', @_); -}; +LaTeX::TikZ::Functor->default_rule( + (__PACKAGE__) => sub { + my ($functor, $set, @args) = @_; + $set->new(content => $set->content); + } +); __PACKAGE__->meta->make_immutable;