Dokuwiki-RPC-XML-Client
view release on metacpan or search on metacpan
scripts/dokuwiki-client view on Meta::CPAN
#! /usr/bin/perl
use Dokuwiki::RPC::XML::Client;
use Modern::Perl;
use Net::Netrc;
require YAML;
no warnings qw( once qw );
=head1 SYNOPSIS
dokuwiki-client is as cli wrapper to the XML::RPC perl client.
dokuwiki-client show getVersion
# prints the dokuwiki version
dokuwiki-client show getPageHTML page:in:your:namespace
# show the rendered version of page:in:your:namespace
dokuwiki-client ls your:namespace
# list the ids of pages in your:namespace
=head1 Configure
configure a machine (the name isn't related to the dokuwiki base url) to store
the credentials
machine personnal.wiki
login me
password Ih4v3S3cr3ts
then, setup 2 environement variables
export DOKUWIKI_CLIENT_BASE=http://my.wiki.example.com
export DOKUWIKI_CLIENT_MACHINE=personal.wiki
=head1 Available subcommand
=cut
my $wiki = Dokuwiki::RPC::XML::Client->reach( $ENV{DOKUWIKI_CLIENT_BASE} || die );
my $credentials = Net::Netrc->lookup( $ENV{DOKUWIKI_CLIENT_MACHINE} || die )
or die "please add a fake $ENV{DW_MACHINE} machine in your ~/.netrc";
my ( $l, $p ) = $credentials->lpa;
$wiki->login( $l, $p ) or die;
=head2 call
call an XML::RPC method and dump the result as a YAML in stdout
dokuwiki-client call getPagelist your:namespace
=cut
sub call {
my $method = shift;
say YAML::Dump $wiki->$method( @_ );
}
=head2 show
call an XML::RPC method and print the result in stdout
dokuwiki-client show getVersion
( run in 1.304 second using v1.01-cache-2.11-cpan-39bf76dae61 )