Commit | Line | Data |
4276ccb4 |
1 | |
2 | package Moose::Compiler::Perl6; |
3 | use Moose; |
4 | |
5 | our $VERSION = '0.01'; |
6 | |
7 | with 'Moose::Compiler::Engine'; |
8 | |
9 | sub compile_class { |
10 | my ($self, $meta) = @_; |
11 | my $o = ''; |
12 | $o .= ('class ' . $meta->name . "-" . $meta->version . " {\n"); |
13 | $o .= ("\n"); |
14 | foreach my $attr_name ($meta->get_attribute_list) { |
15 | my $attr = $meta->get_attribute($attr_name); |
16 | my @options; |
17 | push @options => ("is " . $attr->_is_metadata . "") |
18 | if $attr->_is_metadata; |
19 | push @options => ("does " . $attr->_does_metadata . "") |
20 | if $attr->_does_metadata; |
21 | $o .= (" has " . ($attr->_isa_metadata ? ($attr->_isa_metadata . " ") : '') |
22 | . "\$" . $attr->name . " " . (join " " => @options) . ";\n"); |
23 | } |
24 | $o .= ("\n"); |
25 | $o .= ("}\n"); |
26 | return $o; |
27 | } |
28 | |
29 | 1; |
30 | |
31 | __END__ |
32 | |
33 | =pod |
34 | |
35 | =head1 NAME |
36 | |
37 | Moose::Compiler::Perl6 - A Moose compiler engine for compiling to Perl 6 |
38 | |
39 | =head1 DESCRIPTION |
40 | |
41 | =head1 METHODS |
42 | |
43 | =over 4 |
44 | |
45 | =item B<meta> |
46 | |
47 | This will return the metaclass associated with the given role. |
48 | |
49 | =item B<compile_class> |
50 | |
51 | =back |
52 | |
53 | =head1 BUGS |
54 | |
55 | All complex software has bugs lurking in it, and this module is no |
56 | exception. If you find a bug please either email me, or add the bug |
57 | to cpan-RT. |
58 | |
59 | =head1 AUTHOR |
60 | |
61 | Stevan Little E<lt>stevan@iinteractive.comE<gt> |
62 | |
63 | =head1 COPYRIGHT AND LICENSE |
64 | |
65 | Copyright 2006 by Infinity Interactive, Inc. |
66 | |
67 | L<http://www.iinteractive.com> |
68 | |
69 | This library is free software; you can redistribute it and/or modify |
70 | it under the same terms as Perl itself. |
71 | |
72 | =cut |