use Encode qw(encode decode);
###PERL_LIB: use lib '/botm/lib/post';
-use botm_common qw(readdatafile writedatafile join_path);
+use botm_common qw(read_data_file write_data_file url_encode url_decode join_path);
###PERL_ENCODING_FILE_IN: use constant ENCODING_FILE_IN => 'UTF-8';
###PERL_ENCODING_FILE_OUT: use constant ENCODING_FILE_OUT => 'utf8';
}
print "options:\n";
-my $a = writedatafile(\*STDOUT, ENCODING_STD_OUT, 0, \%options);
+my $a = write_data_file(\*STDOUT, ENCODING_STD_OUT, 0, \%options);
print "$a\n";
-# foreach my $ind (keys %options) {
- # print $ind.'='.$options{$ind}."\n";
-# }
-# print;
+foreach my $ind (keys %options) {
+ print $ind.'=>'.url_decode($options{$ind})."<\n";
+}
+print;
foreach my $arg (@ARGV) {
print "\nFILE $arg\n";
- my %data = readdatafile($arg, 'utf8', 1);
+ my %data = read_data_file($arg, 'utf8', 1);
foreach my $ind (keys %data) {
print $ind.'='.$data{$ind}."\n";
}
# if ((scalar @ARGV) == 0) {
# print "\nSTDIN\n";
# my $fh;
- # my %data = readdatafile(\*STDIN, 'utf8', 1);
+ # my %data = read_data_file(\*STDIN, 'utf8', 1);
# foreach my $ind (keys %data) {
# print $ind.'='.$data{$ind}."\n";
# }
(my $cmd_options, my $file_data) = @_;
my %post;
- if ($cmd_options->{'subject'}) ne '') {
+ if (($cmd_options->{'subject'}) ne '') {
$post{'subject'} = $cmd_options->{'subject'};
}
- elsif ($file_data->{'subject'}) ne '') {
+ elsif (($file_data->{'subject'}) ne '') {
$post{'subject'} = $file_data->{'subject'};
}
else {
$post{'subject'} = DEFAULT_SUBJECT;
}
- if ($cmd_options->{'username'}) ne '') {
+ if (($cmd_options->{'username'}) ne '') {
$post{'username'} = $cmd_options->{'username'};
}
- elsif ($file_data->{'username'}) ne '') {
+ elsif (($file_data->{'username'}) ne '') {
$post{'username'} = $file_data->{'username'};
}
else {
$post{'username'} = DEFAULT_USERNAME;
}
- if ($cmd_options->{'password'}) ne '') {
+ if (($cmd_options->{'password'}) ne '') {
$post{'password'} = $cmd_options->{'password'};
}
- elsif ($file_data->{'password'}) ne '') {
+ elsif (($file_data->{'password'}) ne '') {
$post{'password'} = $file_data->{'password'};
}
else {
$post{'password'} = DEFAULT_PASSWORD;
}
- if ($cmd_options->{'content'}) ne '') {
+ if (($cmd_options->{'content'}) ne '') {
$post{'content'} = $cmd_options->{'content'};
}
- elsif ($file_data->{'content'}) ne '') {
+ elsif (($file_data->{'content'}) ne '') {
$post{'content'} = $file_data->{'content'};
}
else {
$post{'content'} = '';
}
- if ($cmd_options->{'no-bbcode'}) ne '') {
+ if (($cmd_options->{'no-bbcode'}) ne '') {
$post{'bbcode'} = 0;
}
- elsif ($cmd_options->{'bbcode'}) ne '') {
+ elsif (($cmd_options->{'bbcode'}) ne '') {
$post{'bbcode'} = 1;
}
- elsif ($file_data->{'bbcode'}) ne '') {
+ elsif (($file_data->{'bbcode'}) ne '') {
$post{'bbcode'} = $file_data->{'bbcode'}+0;
}
else {
$post{'bbcode'} = 1;
}
- if ($cmd_options->{'no-smilies'}) ne '') {
+ if (($cmd_options->{'no-smilies'}) ne '') {
$post{'smilies'} = 0;
}
- elsif ($cmd_options->{'smilies'}) ne '') {
+ elsif (($cmd_options->{'smilies'}) ne '') {
$post{'smilies'} = 1;
}
- elsif ($file_data->{'smilies'}) ne '') {
+ elsif (($file_data->{'smilies'}) ne '') {
$post{'smilies'} = $file_data->{'smilies'}+0;
}
else {
$post{'smilies'} = 1;
}
- if ($cmd_options->{'no-urls'}) ne '') {
+ if (($cmd_options->{'no-urls'}) ne '') {
$post{'urls'} = 0;
}
- elsif ($cmd_options->{'urls'}) ne '') {
+ elsif (($cmd_options->{'urls'}) ne '') {
$post{'urls'} = 1;
}
- elsif ($file_data->{'urls'}) ne '') {
+ elsif (($file_data->{'urls'}) ne '') {
$post{'urls'} = $file_data->{'urls'}+0;
}
else {
$post{'urls'} = 1;
}
- if ($cmd_options->{'no-signature'}) ne '') {
+ if (($cmd_options->{'no-signature'}) ne '') {
$post{'signature'} = 0;
}
- elsif ($cmd_options->{'signature'}) ne '') {
+ elsif (($cmd_options->{'signature'}) ne '') {
$post{'signature'} = 1;
}
- elsif ($file_data->{'signature'}) ne '') {
+ elsif (($file_data->{'signature'}) ne '') {
$post{'signature'} = $file_data->{'signature'}+0;
}
else {
$post{'signature'} = 1;
}
- if ($cmd_options->{'no-notify'}) ne '') {
+ if (($cmd_options->{'no-notify'}) ne '') {
$post{'notify'} = 0;
}
- elsif ($cmd_options->{'notify'}) ne '') {
+ elsif (($cmd_options->{'notify'}) ne '') {
$post{'notify'} = 1;
}
- elsif ($file_data->{'notify'}) ne '') {
+ elsif (($file_data->{'notify'}) ne '') {
$post{'notify'} = $file_data->{'notify'}+0;
}
else {
$post{'notify'} = 0;
}
- if ($file_data->{'time'}) ne '') {
+ if (($file_data->{'time'}) ne '') {
$post{'time'} = $file_data->{'time'}+0;
}
else {