CTKlib
view release on metacpan or search on metacpan
lib/CTK/Util.pm view on Meta::CPAN
of the application and rebooting the system.
Files located under /var/cache may be expired in an application specific manner, by the system administrator,
or both. The application must always be able to recover from manual deletion of these files (generally because of
a disk space shortage). No other requirements are made on the data format of the cache directories.
See L<Sys::Path/"cachedir">
Tags: CORE, BASE, FILE
=head3 cdata
$cdatatext = cdata( $text );
Returns a string "<![CDATA[$text]]>" for plain XML documents.
Tags: BASE, FORMAT
=head3 correct_date
$mydate = correct_date( $date );
Returns date in format dd.mm.yyyy or null ('') if $date is wrongly.
lib/CTK/Util.pm view on Meta::CPAN
L</"preparedir">,
L</"save_file">,
L</"scandirs">,
L</"scanfiles">,
L</"touch">
=item B<:FORMAT>
Exports functions:
L</"cdata">,
L</"correct_dig">,
L</"correct_number">,
L</"dformat">,
L</"escape">,
L</"fformat">,
L</"file_lf_normalize">,
L</"file_nl_normalize">,
L</"from_utf8">,
L</"lf_normalize">,
L</"nl_normalize">,
lib/CTK/Util.pm view on Meta::CPAN
prefixdir localstatedir sysconfdir srvdir
sharedir docdir localedir cachedir syslogdir spooldir rundir lockdir sharedstatedir webdir
);
my @est_util = qw(
randomize randchars shuffle isTrueFlag isFalseFlag
);
my @est_encoding = qw(
to_utf8 to_windows1251 to_cp1251 to_base64 from_utf8
);
my @est_format = qw(
escape unescape slash tag tag_create cdata dformat fformat
lf_normalize nl_normalize file_lf_normalize file_nl_normalize
correct_number correct_dig
variant_stf trim
);
my @est_datetime = qw(
current_date current_date_time localtime2date localtime2date_time correct_date date2localtime
datetime2localtime visokos date2dig dig2date date_time2dig dig2date_time basetime
dtf datetimef datef tz_diff
);
my @est_file = qw(
lib/CTK/Util.pm view on Meta::CPAN
sub tag_create {
# < -> < and etc. See tag
my $data_staring = shift;
return '' unless defined($data_staring);
$data_staring =~ s/\'\;/\'/g;
$data_staring =~ s/\<\;/\</g;
$data_staring =~ s/\>\;/\>/g;
$data_staring =~ s/\"\;/\"/g;
return $data_staring;
}
sub cdata {
my $s = shift;
my $ss = to_utf8('<![CDATA[');
my $sf = to_utf8(']]>');
if (defined $s) {
return $ss.$s.$sf;
}
return to_utf8('');
}
sub escape { # Percent-encoding, also known as URL encoding
my $toencode = shift;
t/06-format.t view on Meta::CPAN
# slash
is(slash(0),0, 'Function slash(0)');
is(slash(),"", 'Function slash()');
is(slash('\''),'\\\'', 'Function slash("\'")');
# tag
is(tag(0),0, 'Function tag(0)');
is(tag(),"", 'Function tag()');
is(tag("<>"),"<>", 'Function tag("<>")');
# cdata
is(cdata(0),'<![CDATA[0]]>', 'Function cdata(0)');
is(cdata(),'', 'Function cdata()');
1;
__END__
( run in 0.611 second using v1.01-cache-2.11-cpan-454fe037f31 )