Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Expliclity box/unbox P6 strings as per moritz++ advice

  • Loading branch information...
commit 9d546c61e19944d9b60ebe7d67152e003f8042ec 1 parent 71ed9fc
@snarkyboojum authored
Showing with 7 additions and 5 deletions.
  1. +7 −5 lib/MIME/Base64.pm6
View
12 lib/MIME/Base64.pm6
@@ -1,25 +1,27 @@
-class MIME::Base64:auth<cpan:SNARKY>:ver<1.0> {
+class MIME::Base64:auth<cpan:SNARKY>:ver<1.1> {
# load the MIME Base64 Parrot library to do all the hard work for us
pir::load_bytecode('MIME/Base64.pbc');
method encode_base64(Str $str) {
- my $encoded-str = Q:PIR {
+ my $encoded-str = nqp::p6box_s Q:PIR {
.local pmc encode
encode = get_root_global ['parrot'; 'MIME'; 'Base64'], 'encode_base64'
$P0 = find_lex '$str'
- %r = encode($P0)
+ $S0 = repr_unbox_str $P0
+ %r = encode($S0)
};
return $encoded-str;
}
method decode_base64(Str $str) {
- my $decoded-str = Q:PIR {
+ my $decoded-str = nqp::p6box_s Q:PIR {
.local pmc decode
decode = get_root_global ['parrot'; 'MIME'; 'Base64'], 'decode_base64'
$P0 = find_lex '$str'
- %r = decode($P0)
+ $S0 = repr_unbox_str $P0
+ %r = decode($S0)
};
return $decoded-str;
Please sign in to comment.
Something went wrong with that request. Please try again.