Peertube-dl/lib/Peertube/DL/Utils.pm

22 lines
369 B
Perl
Raw Normal View History

2020-12-26 06:18:43 +01:00
package Peertube::DL::Utils;
use strict;
use warnings;
use feature 'say';
use URI::Encode;
sub uri_encode {
2021-01-04 04:38:21 +01:00
if (wantarray) {
return map { URI::Encode::uri_encode($_) =~ s/ /+/rg } @_;
} else {
return URI::Encode::uri_encode( $_[0] ) =~ s/ /+/rg;
}
2020-12-26 06:18:43 +01:00
}
sub uri_decode {
return map { URI::Encode::uri_decode($_) =~ s/\+/ /rg } @_;
}
1;