|
|
@ -49,6 +49,7 @@ sub _content_save { |
|
|
|
|
|
|
|
|
|
|
|
unless (ref $content) { |
|
|
|
unless (ref $content) { |
|
|
|
my $asset = Mojo::Asset::File->new; |
|
|
|
my $asset = Mojo::Asset::File->new; |
|
|
|
|
|
|
|
utf8::encode($content); |
|
|
|
$asset->add_chunk($content); |
|
|
|
$asset->add_chunk($content); |
|
|
|
$content = $asset; # wrap plaintext to Mojo::Asset |
|
|
|
$content = $asset; # wrap plaintext to Mojo::Asset |
|
|
|
} |
|
|
|
} |
|
|
@ -65,8 +66,10 @@ sub _content_load { |
|
|
|
die("paste content not found\n") unless (-f $path); |
|
|
|
die("paste content not found\n") unless (-f $path); |
|
|
|
my $asset = Mojo::Asset::File->new(path => $path); |
|
|
|
my $asset = Mojo::Asset::File->new(path => $path); |
|
|
|
$asset->cleanup(0); |
|
|
|
$asset->cleanup(0); |
|
|
|
|
|
|
|
my $content = $asset->slurp; |
|
|
|
|
|
|
|
utf8::decode($content); |
|
|
|
|
|
|
|
|
|
|
|
return $asset->slurp; |
|
|
|
return $content; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
sub create { |
|
|
|
sub create { |
|
|
|