Game-CharacterSheetGenerator

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

            "ExtUtils::MakeMaker" : "6.52",
            "File::ShareDir::Install" : "0"
         }
      },
      "runtime" : {
         "requires" : {
            "Encode::Locale" : "0",
            "File::ShareDir" : "0",
            "File::Slurper" : "0",
            "I18N::AcceptLanguage" : "0",
            "Modern::Perl" : "1.20180701",
            "Mojolicious" : "0",
            "XML::LibXML" : "0",
            "perl" : "5.026000",
            "strict" : "0",
            "warnings" : "0"
         }
      }
   },
   "release_status" : "stable",
   "resources" : {

META.yml  view on Meta::CPAN

name: Game-CharacterSheetGenerator
no_index:
  directory:
    - t
    - inc
requires:
  Encode::Locale: '0'
  File::ShareDir: '0'
  File::Slurper: '0'
  I18N::AcceptLanguage: '0'
  Modern::Perl: '1.20180701'
  Mojolicious: '0'
  XML::LibXML: '0'
  perl: '5.026000'
  strict: '0'
  warnings: '0'
resources:
  repository: https://alexschroeder.ch/cgit/character-sheet-generator
version: 1.03
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'

Makefile.PL  view on Meta::CPAN

use File::ShareDir::Install;

install_share 'share';

WriteMakefile(
  NAME             => 'Game::CharacterSheetGenerator',
  VERSION_FROM     => 'lib/Game/CharacterSheetGenerator.pm',
  ABSTRACT_FROM    => 'lib/Game/CharacterSheetGenerator.pm',
  AUTHOR           => 'Alex Schroeder',
  LICENSE          => 'agpl_3',
  MIN_PERL_VERSION => '5.26.0', # Modern::Perl '2018'
  EXE_FILES        => [
    'script/character-sheet-generator',
  ],
  PREREQ_PM => {
    'strict' => 0,
    'warnings' => 0,
    'Modern::Perl' => 1.20180701,
    'Mojolicious' => 0,
    'I18N::AcceptLanguage' => 0,
    'Encode::Locale' => 0,
    'File::ShareDir' => 0,
    'File::Slurper' => 0,
    'XML::LibXML' => 0,
  },
  CONFIGURE_REQUIRES => {
    'ExtUtils::MakeMaker' => '6.52',
    'File::ShareDir::Install' => 0,

lib/Game/CharacterSheetGenerator.pm  view on Meta::CPAN

Mojolicious framework. This class in particular uses L<Mojolicious::Lite>.

See L<Mojolicious::Guides> for more information.

=cut

package Game::CharacterSheetGenerator;

our $VERSION = 1.03;

use Modern::Perl;
use Game::CharacterSheetGenerator::ElfNames qw(elf_name);
use Game::CharacterSheetGenerator::DwarfNames qw(dwarf_name);
use Game::CharacterSheetGenerator::HalflingNames qw(halfling_name);
use Game::CharacterSheetGenerator::HumanNames qw(human_name);
use Mojolicious::Lite;
use Mojo::UserAgent;
use Mojo::Log;
use File::ShareDir "dist_dir";
use I18N::AcceptLanguage;
use XML::LibXML;

lib/Game/CharacterSheetGenerator/Command/multiple.pm  view on Meta::CPAN

```
character-sheet-generator multiple en class=elf
```

C<help> prints the man page.

=cut

package Game::CharacterSheetGenerator::Command::multiple;

use Modern::Perl '2018';
use Mojo::Base 'Mojolicious::Command';
use Game::CharacterSheetGenerator;
use Pod::Simple::Text;
use Role::Tiny;
use Encode::Locale;
use Encode;

binmode(STDOUT, ':utf8');

has description => 'Print a bunch of characters to STDOUT';

lib/Game/CharacterSheetGenerator/Command/random.pm  view on Meta::CPAN

character-sheet-generator random en text class=elf
character-sheet-generator random en text class=elf name=Alex
```

C<help> prints the man page.

=cut

package Game::CharacterSheetGenerator::Command::random;

use Modern::Perl '2018';
use Mojo::Base 'Mojolicious::Command';
use Game::CharacterSheetGenerator;
use Pod::Simple::Text;
use Role::Tiny;
use Encode::Locale;
use Encode;

binmode(STDOUT, ':utf8');

has description => 'Print a random character sheet to STDOUT';

lib/Game/CharacterSheetGenerator/Command/stats.pm  view on Meta::CPAN

```
character-sheet-generator stats en 50 class=elf
```

C<help> prints the man page.

=cut

package Game::CharacterSheetGenerator::Command::stats;

use Modern::Perl '2018';
use Mojo::Base 'Mojolicious::Command';
use Game::CharacterSheetGenerator;
use Pod::Simple::Text;
use Role::Tiny;
use Encode::Locale;
use Encode;

binmode(STDOUT, ':utf8');

has description => 'Print stats for random characters to STDOUT';

lib/Game/CharacterSheetGenerator/DwarfNames.pm  view on Meta::CPAN

=head1 DESCRIPTION

This package has one function that returns a dwarf name and a gender. The gender
returned is "M", "F", or "?".

If a name is provided, the gender is returned.

=cut

package Game::CharacterSheetGenerator::DwarfNames;
use Modern::Perl;
use utf8;

require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(dwarf_name);

sub one {
  my $i = int(rand(scalar @_));
  return $_[$i];
}

lib/Game/CharacterSheetGenerator/ElfNames.pm  view on Meta::CPAN

=head1 DESCRIPTION

This package has one function that returns a elf name and a gender. The gender
returned is "M", "F", or "?".

If a name is provided, the gender is returned.

=cut

package Game::CharacterSheetGenerator::ElfNames;
use Modern::Perl;
use utf8;

require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(elf_name);

sub one {
  my $i = int(rand(scalar @_));
  return $_[$i];
}

lib/Game/CharacterSheetGenerator/HalflingNames.pm  view on Meta::CPAN

=head1 DESCRIPTION

This package has one function that returns a halfling name and a gender. The gender
returned is "M", "F", or "?".

If a name is provided, the gender is returned.

=cut

package Game::CharacterSheetGenerator::HalflingNames;
use Modern::Perl;
use utf8;

require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(halfling_name);

sub one {
  my $i = int(rand(scalar @_));
  return $_[$i];
}

lib/Game/CharacterSheetGenerator/HumanNames.pm  view on Meta::CPAN

=head1 DESCRIPTION

This package has one function that returns a human name and a gender. The gender
returned is "M", "F", or "?".

If a name is provided, the gender is returned.

=cut

package Game::CharacterSheetGenerator::HumanNames;
use Modern::Perl;
use utf8;

require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(human_name);

sub one {
  my $i = int(rand(scalar @_));
  return $_[$i];
}

t/characters.t  view on Meta::CPAN

# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.

use Modern::Perl;
use Test::More;
use Test::Mojo;

my $t = Test::Mojo->new('Game::CharacterSheetGenerator');
$t->app->log->level('warn');

$t->get_ok('/characters/en')
    ->status_is(200)
    ->text_is(h1 => 'A Bunch of Characters')
    ->content_like(qr/backpack/);

t/charsheet.t  view on Meta::CPAN

# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.

use Modern::Perl;
use Test::More;
use Test::Mojo;

my $t = Test::Mojo->new('Game::CharacterSheetGenerator');
$t->app->config("face_generator_url", undef);
$t->app->log->level('warn');

$t->get_ok('/char/en?name=Markus&charsheet=Charakterblatt.svg')
    ->status_is(200)
    ->header_is('Content-Type' => 'image/svg+xml');

t/legacy.t  view on Meta::CPAN

# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.

use Modern::Perl;
use Test::More;
use Test::Mojo;

my $t = Test::Mojo->new('Game::CharacterSheetGenerator');
$t->app->log->level('warn');

# old edit links

$t->get_ok('/link/en?name=Aurora;str=9')
    ->status_is(302)

t/random-de.t  view on Meta::CPAN

# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.

use Modern::Perl;
use Test::More;
use Test::Mojo;
use utf8;

my $t = Test::Mojo->new('Game::CharacterSheetGenerator');
$t->app->config("face_generator_url", undef);
$t->app->log->level('warn');

# typical use case: request a random character
$t->get_ok('/' => {'Accept-Language' => 'de'})

t/random-en.t  view on Meta::CPAN

# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.

use Modern::Perl;
use Test::More;
use Test::Mojo;

my $t = Test::Mojo->new('Game::CharacterSheetGenerator');
$t->app->config("face_generator_url", undef);
$t->app->log->level('warn');

# start with an english root
$t->get_ok('/' => {'Accept-Language' => 'en'})
    ->status_is(302)

t/show.t  view on Meta::CPAN

# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.

use Modern::Perl;
use Test::More;
use Test::Mojo;

my $t = Test::Mojo->new('Game::CharacterSheetGenerator');
$t->app->log->level('warn');

$t->get_ok('/show')
    ->status_is(200)
    ->text_is('text#str' => 'str');

t/stats.t  view on Meta::CPAN

# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.

use Modern::Perl;
use Test::More;
use Test::Mojo;

my $t = Test::Mojo->new('Game::CharacterSheetGenerator');
$t->app->log->level('warn');

$t->get_ok('/stats/en/100')
    ->status_is(200)
    ->content_like(qr/backpack  100\n/);

t/translation.t  view on Meta::CPAN

# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.

package Game::CharacterSheetGenerator;
use Modern::Perl;
use Test::More;
use FindBin;

my $file = "$FindBin::Bin/../lib/Game/CharacterSheetGenerator.pm";
require $file;
open(my $fh, '<:utf8', $file) or die "Cannot read $file\n";
undef $/;
my $source = <$fh>;
my $translations = translations();
my %data;

t/zero.t  view on Meta::CPAN

# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.

use Modern::Perl;
use Test::More;
use Test::Mojo;

my $t = Test::Mojo->new('Game::CharacterSheetGenerator');
$t->app->log->level('warn');

$t->get_ok('/char/en?ac=0')
    ->status_is(200)
    ->header_is('Content-Type' => 'image/svg+xml')
    ->text_is('text#ac tspan' => '0', 'ac zero is shown');



( run in 0.355 second using v1.01-cache-2.11-cpan-4d50c553e7e )