#!/usr/bin/perl # restwiki : convert a Wiki content to JSON format use strict; use warnings; use Getopt::Std; use JSON; use open ':locale'; sub HELP_MESSAGE { print STDERR <<"EOM"; usage : $0 [-c comment] [files...] -c : comment EOM exit 0; } our ($opt_c); getopts('c:') or HELP_MESSAGE(); ################################################# my $ref; { local $/; # enable slurp mode $ref->{wiki_page}->{text} = <>; } $ref->{wiki_page}->{comments} = $opt_c if $opt_c; print to_json($ref); exit 0;