Koha-Contrib-Tamil
view release on metacpan or search on metacpan
bin/koha-cloud view on Meta::CPAN
#!/usr/bin/perl
package Main;
$Main::VERSION = '0.074';
# PODNAME: koha-cloud
# ABSTRACT: Creates HTML keywords clouds from Koha Zebra Indexes
use Modern::Perl;
use Carp;
use YAML::Syck;
use Pod::Usage;
use Getopt::Long;
use Fatal qw( open );
use Koha::Contrib::Tamil::Koha;
use Koha::Contrib::Tamil::Zebra::Clouder;
my ($verbose, $help, $conf) = (0, 0, '');
GetOptions(
'verbose' => \$verbose,
'help' => \$help,
'conf=s' => \$conf,
);
sub usage {
pod2usage( -verbose => 2 );
exit;
}
sub run() {
usage() if $help || !$conf;
my @clouds;
say "Reading configuration file: $conf" if $verbose;
eval {
@clouds = LoadFile( $conf );
};
croak "Unable to read configuration file: $conf\n" if $@;
for my $cloud ( @clouds ) {
print "Create a cloud\n",
" Koha conf file: ", $cloud->{KohaConf} ? $cloud->{KohaConf} : "default", "\n",
" Zebra Index: ", $cloud->{ZebraIndex}, "\n",
" Koha Keyword: ", $cloud->{KohaIndex}, "\n",
" Count: ", $cloud->{Count}, "\n",
" Withcss: ", $cloud->{Withcss}, "\n",
" Output: ", $cloud->{Output}, "\n",
if $verbose;
# Set Koha context if KohaConf is present
my $k;
if ( $cloud->{KohaConf} ) {
$k = Koha::Contrib::Tamil::Koha->new( conf => $cloud->{KohaConf} );
}
else {
$k = Koha::Contrib::Tamil::Koha->new();
}
# Create output file
open my $fh, ">", $cloud->{Output};
my $clouder = Koha::Contrib::Tamil::Zebra::Clouder->new(
koha => $k,
index => $cloud->{ZebraIndex},
verbose => $verbose,
);
$clouder->run( $cloud->{Count} );
( run in 1.561 second using v1.01-cache-2.11-cpan-97f6503c9c8 )