You basically can export the whole DSL logic and anything else to "Page" and reuse the package multiple times.
package Pack; use strict; use warnings; sub bla { warn ((caller(0))[3]); } use Import2Package 'DTD' => 'Page'; package Page { Page->bla(); }
exec "perl import2package.pl" unless caller(); use strict; use warnings; package Import2Package; sub import { my ($self, $dtd, $pack) =@_; my $super = (caller())[0]; no strict 'refs'; push @{"${pack}::ISA"}, $super; } 1;
Pack::bla at import2package.pl line 7.
of course TIMTOWTDI.
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
In reply to Re^6: Which internal DSL are there in Perl? (Domain Specific Languages - Part 1)
by LanX
in thread Which internal DSL are there in Perl? (Domain Specific Languages - Part 1)
by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |