Subject: | Unicode handling |
Add following method:
sub json_octets {
my $self = shift;
my %params = %$self;
delete $params{expiration} unless defined $params{expiration};
return encode_json(\%params);
} ## end sub json_octets
Modify base64 method:
sub base64 { return _encode_base64($_[0]->json_octets()); }
Additionally, it is possible to avoid newlines straight from MIME::Base64:
sub _encode_base64 {
require MIME::Base64;
no warnings 'redefine';
*_encode_base64 = sub {MIME::Base64::encode_base64($_[0], '')};
goto \&_encode_base64;
}