module-starter [options]
Options:
--module=module Module name (required, repeatable)
--distro=name Distribution name (optional)
--dir=dirname Directory name to create new module in (optional)
--builder=module Build with 'ExtUtils::MakeMaker' or 'Module::Build'
--eumm Same as --builder=ExtUtils::MakeMaker
--mb Same as --builder=Module::Build
--mi Same as --builder=Module::Install (discouraged)
--author=name Author's name (taken from getpwuid if not provided)
--email=email Author's email (taken from EMAIL if not provided)
--ignores=type Ignore type files to include (repeatable)
--license=type License under which the module will be distributed
(default is artistic2)
--genlicense Generate LICENSE file according to specified license
--minperl=ver Minimum Perl version required (optional;
default is 5.006)
--fatalize Generate code that causes all warnings to be fatal with:
use warnings FATAL => 'all'
--verbose Print progress messages while working
--force Delete pre-existing files if needed
--help Show this message
$
####
$ pwd
/home/bob/Documents/meditations/castaways
$ ls
$ module-starter --module=translate --author="professor" --email=prof@island.coconut
Added to MANIFEST: Changes
Added to MANIFEST: ignore.txt
Added to MANIFEST: lib/translate.pm
Added to MANIFEST: Makefile.PL
Added to MANIFEST: MANIFEST
Added to MANIFEST: README
Added to MANIFEST: t/00-load.t
Added to MANIFEST: t/manifest.t
Added to MANIFEST: t/pod-coverage.t
Added to MANIFEST: t/pod.t
Added to MANIFEST: xt/boilerplate.t
Created starter directories and files
$ ls
translate
$ cd translate/
$ ls
Changes ignore.txt lib Makefile.PL MANIFEST README t xt
$
####
#!/usr/bin/perl -w
use 5.011;
use WWW::Google::Translate;
use Config::Tiny;
use Data::Dumper;
use open OUT => ':encoding(UTF-8)', ':std';
use Path::Tiny;
my $ini_path = qw( /home/bob/Documents/html_template_data/3.values.ini );
say "ini path is $ini_path";
my $tempfile = Path::Tiny->tempfile(TEMPLATE => 'trans_XXXXXX', suffix => '.txt');
my $string_temp = $tempfile->stringify;
say "save file is $string_temp";
my $sub_hash = "google";
my $Config = Config::Tiny->new;
$Config = Config::Tiny->read( $ini_path, 'utf8' );
#say Dumper $Config;
my $von = 'en';
my $zu = 'ru';
# -> is optional between brackets
my $key = $Config->{$sub_hash}{'api_key_1'};
my $wgt = WWW::Google::Translate->new(
{
key => $key,
default_source => $von,
default_target => $zu,
}
);
my $r = $wgt->translate( { q => 'I wave my private parts at your aunties, you cheesy lot of second hand electric donkey-bottom biters.' } );
my $result = "";
for my $trans_rh ( @{ $r->{data}->{translations} } ) {
$result = $trans_rh->{translatedText};
print $trans_rh->{translatedText}, "\n";
}
say Dumper $r;
my $wgt2 = WWW::Google::Translate->new(
{
key => $key,
default_source => $zu,
default_target => $von,
cache_file => $string_temp,
}
);
my $s = $wgt2->translate( { q => $result} );
for my $trans_rh ( @{ $s->{data}->{translations} } ) {
print $trans_rh->{translatedText}, "\n";
}
say Dumper $s;
say "------";