Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 48abd6c9

Von Sven Schöling vor fast 13 Jahren hinzugefügt

  • ID 48abd6c981f62e880b94e1ad9659d0a4d406912b
  • Vorgänger 5c695f5d
  • Nachfolger 0ab92915

Request Handling aus Form ausgelagert.

Unterschiede anzeigen:

SL/MoreCommon.pm
4 4
our @ISA = qw(Exporter);
5 5

  
6 6
our @EXPORT    = qw(save_form restore_form compare_numbers any cross);
7
our @EXPORT_OK = qw(ary_union ary_intersect ary_diff listify ary_to_hash);
7
our @EXPORT_OK = qw(ary_union ary_intersect ary_diff listify ary_to_hash uri_encode uri_decode uri_encode uri_decode);
8 8

  
9 9
use List::MoreUtils qw(zip);
10 10
use YAML;
......
161 161
  return zip(@indexes, @values);
162 162
}
163 163

  
164
sub uri_encode {
165
  my ($str) = @_;
166

  
167
  $str =  Encode::encode('utf-8-strict', $str) if $::locale->is_utf8;
168
  $str =~ s/([^a-zA-Z0-9_.:-])/sprintf("%%%02x", ord($1))/ge;
169

  
170
  return $str;
171
}
172

  
173
sub uri_decode {
174
  my ($str) = @_;
175

  
176
  $str =~ tr/+/ /;
177
  $str =~ s/\\$//;
178

  
179
  $str =~ s/%([0-9a-fA-Z]{2})/pack("c",hex($1))/eg;
180
  $str =  Encode::decode('utf-8-strict', $str) if $::locale->is_utf8;
181

  
182
  return $str;
183
}
184

  
164 185
1;
165 186

  
166 187
__END__

Auch abrufbar als: Unified diff