Toolforge::MixNMatch::Object::Catalog - Mix'n'match catalog datatype.
use Toolforge::MixNMatch::Object::Catalog; my $obj = Toolforge::MixNMatch::Object::Catalog->new(%params); my $count = $obj->count; my $type = $obj->type; my $year_months = $obj->year_months; my $users = $obj->users;
This datatype is base class for Mix'n'match catalog.
new
my $obj = Toolforge::MixNMatch::Object::Catalog->new(%params);
Constructor.
Returns instance of object.
count
Count number of records in catalog. Parameter is required.
type
Catalog type in sense of Wikidata instance. Example is 'Q5' for human. Parameter is required.
year_months
Year/months statistics. Reference to array with Toolforge::MixNMatch::Object::YearMonth instances. Default value is [].
users
Users statistics. Reference to array with Toolforge::MixNMatch::Object::User instances. Default value is [].
my $count = $obj->count;
Get count.
Returns number.
my $type = $obj->type;
Get type.
Returns string.
my $year_months = $obj->year_months;
Get year/months statistics.
Returns reference to array with Toolforge::MixNMatch::Object::YearMonth instances.
my $users = $obj->users;
Get users statistics.
Returns reference to array with Toolforge::MixNMatch::Object::User instances.
new(): From Mo::utils::check_required(): Parameter 'count' is required. Parameter 'type' is required. From Mo::utils::check_array_object(): Parameter 'users' must be a array. Parameter 'year_months' must be a array. User isn't 'Toolforge::MixNMatch::Object::Catalog::User' object. Year/month isn't 'Toolforge::MixNMatch::Object::Catalog::YearMonth' object.
use strict; use warnings; use Toolforge::MixNMatch::Object::Catalog; use Toolforge::MixNMatch::Object::User; use Toolforge::MixNMatch::Object::YearMonth; # Object. my $obj = Toolforge::MixNMatch::Object::Catalog->new( 'count' => 10, 'type' => 'Q5', 'users' => [ Toolforge::MixNMatch::Object::User->new( 'count' => 6, 'uid' => 1, 'username' => 'Skim', ), Toolforge::MixNMatch::Object::User->new( 'count' => 4, 'uid' => 2, 'username' => 'Foo', ), ], 'year_months' => [ Toolforge::MixNMatch::Object::YearMonth->new( 'count' => 2, 'month' => 9, 'year' => 2020, ), Toolforge::MixNMatch::Object::YearMonth->new( 'count' => 8, 'month' => 10, 'year' => 2020, ), ], ); # Get count. my $count = $obj->count; # Get type. my $type = $obj->type; # Get year months stats. my $year_months_ar = $obj->year_months; # Get users. my $users_ar = $obj->users; # Print out. print "Count: $count\n"; print "Type: $type\n"; print "Number of month/year statistics: ".(scalar @{$year_months_ar})."\n"; print "Number of users: ".(scalar @{$users_ar})."\n"; # Output: # Count: 10 # Type: Q5 # Number of month/year statistics: 2 # Number of users: 2
Mo, Mo::utils.
Toolforge Mix'n'match tool objects.
https://github.com/michal-josef-spacek/Toolforge-MixNMatch-Object
Michal Josef Špaček mailto:skim@cpan.org
http://skim.cz
© Michal Josef Špaček 2020
BSD 2-Clause License
0.01
To install Toolforge::MixNMatch::Object, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Toolforge::MixNMatch::Object
CPAN shell
perl -MCPAN -e shell install Toolforge::MixNMatch::Object
For more information on module installation, please visit the detailed CPAN module installation guide.