in reply to Re^5: Which internal DSL are there in Perl? (Domain Specific Languages - Part 1)
in thread Which internal DSL are there in Perl? (Domain Specific Languages - Part 1)
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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Which internal DSL are there in Perl? (Domain Specific Languages - Part 1)
by LanX (Saint) on Aug 06, 2017 at 13:32 UTC |