The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

PMLTQ::Base - Base class for PMLTQ inspired by Mojo::Base and Mojo::Base::XS

VERSION

version 1.0.1

SYNOPSIS

  package Cat;
  use PMLTQ::Base -base;

  has name => 'Nyan';
  has [qw(age weight)] => 4;

  package Tiger;
  use PMLTQ::Base 'Cat';

  has friend  => sub { Cat->new };
  has stripes => 42;

  package main;
  use PMLTQ::Base -strict;

  my $mew = Cat->new(name => 'Longcat');
  say $mew->age;
  say $mew->age(3)->weight(5)->age;

DESCRIPTION

PMLTQ::Base is a simple base class for PMLTQ project. It works the same way as Mojo::Base. The following is taken from Mojo::Base documentation:

  # Automatically enables "strict", "warnings", "utf8" and Perl 5.10 features
  use PMLTQ::Base -strict;
  use PMLTQ::Base -base;
  use PMLTQ::Base 'SomeBaseClass';

All three forms save a lot of typing.

  # use PMLTQ::Base -strict;
  use strict;
  use warnings;
  use utf8;
  use feature ':5.10';
  use IO::Handle ();

  # use PMLTQ::Base -base;
  use strict;
  use warnings;
  use utf8;
  use feature ':5.10';
  use IO::Handle ();
  use PMLTQ::Base;
  push @ISA, 'PMLTQ::Base';
  sub has { PMLTQ::Base::attr(__PACKAGE__, @_) }

  # use PMLTQ::Base 'SomeBaseClass';
  use strict;
  use warnings;
  use utf8;
  use feature ':5.10';
  use IO::Handle ();
  require SomeBaseClass;
  push @ISA, 'SomeBaseClass';
  use Mojo::Base;
  sub has { Mojo::Base::attr(__PACKAGE__, @_) }

SEE ALSO

Mojo::Base, Mojo::Base::XS.

AUTHORS

  • Petr Pajas <pajas@ufal.mff.cuni.cz>

  • Jan Štěpánek <stepanek@ufal.mff.cuni.cz>

  • Michal Sedlák <sedlak@ufal.mff.cuni.cz>

  • Matyáš Kopp <matyas.kopp@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Institute of Formal and Applied Linguistics (http://ufal.mff.cuni.cz).

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.