Permalink
Browse files

use utf8; fix code for packages

  • Loading branch information...
1 parent 59d1aa1 commit fa0bcd5235783ba6e47162c71826f9c0dd3ab4e7 @zag committed Oct 24, 2011
Showing with 7 additions and 2 deletions.
  1. +2 −0 Changes
  2. +5 −2 lib/Plosurin.pm
View
@@ -1,5 +1,7 @@
Revision history for Plosurin.
+ * use utf8 pragma
+ * fix generate code for perl5 packages
0.02 20 Oct 2011
* impove {import} with 'rule' opt
* some perl6 syntactic sugar
View
@@ -213,6 +213,7 @@ class Plosurin {
# this is a generated code
# Plosurin ver. $VERSION
package $!package;
+use utf8;
";
for @templates -> $tmpl {
my $sub_name = $!package ~ '::' ~ ($tmpl.namespace ~ $tmpl.name).subst(rx/\./, '_', :g);
@@ -221,11 +222,13 @@ package $!package;
for $/.ast.values -> $cnt {
$body ~= $cnt.export_perl()
}
+ #escape \!
$output ~= "sub $sub_name \{
- return q!$body!;
+ return q!" ~ $body.subst(rx/\!/,'\!',:g) ~ "!;
\}
";
- }
+ }
+ $output ~= "\n 'Made by plosurin';";
return $output;
}
}

0 comments on commit fa0bcd5

Please sign in to comment.