| 1 | package Faker::Plugin::ColorName; | ||
| 2 | |||
| 3 | use 5.014; | ||
| 4 | |||
| 5 | use strict; | ||
| 6 | use warnings; | ||
| 7 | |||
| 8 | use registry; | ||
| 9 | use routines; | ||
| 10 | |||
| 11 | use Data::Object::Class; | ||
| 12 | use Data::Object::ClassHas; | ||
| 13 | |||
| 14 | extends 'Data::Object::Plugin'; | ||
| 15 | |||
| 16 | our $VERSION = '1.03'; # VERSION | ||
| 17 | |||
| 18 | # ATTRIBUTES | ||
| 19 | |||
| 20 | has 'faker' => ( | ||
| 21 | is => 'ro', | ||
| 22 | isa => 'ConsumerOf["Faker::Maker"]', | ||
| 23 | req => 1, | ||
| 24 | ); | ||
| 25 | |||
| 26 | # METHODS | ||
| 27 | |||
| 28 | method execute() { | ||
| 29 | my $faker = $self->faker; | ||
| 30 | |||
| 31 | return $faker->process(['color', 'name']); | ||
| 32 | } | ||
| 33 | |||
| 34 | 1; | ||
| 35 | |||
| 36 | =encoding utf8 | ||
| 37 | |||
| 38 | =head1 NAME | ||
| 39 | |||
| 40 | Faker::Plugin::ColorName | ||
| 41 | |||
| 42 | =cut | ||
| 43 | |||
| 44 | =head1 ABSTRACT | ||
| 45 | |||
| 46 | Color Name Plugin for Faker | ||
| 47 | |||
| 48 | =cut | ||
| 49 | |||
| 50 | =head1 SYNOPSIS | ||
| 51 | |||
| 52 | package main; | ||
| 53 | |||
| 54 | use Faker; | ||
| 55 | use Faker::Plugin::ColorName; | ||
| 56 | |||
| 57 | my $f = Faker->new; | ||
| 58 | my $p = Faker::Plugin::ColorName->new(faker => $f); | ||
| 59 | |||
| 60 | my $plugin = $p; | ||
| 61 | |||
| 62 | =cut | ||
| 63 | |||
| 64 | =head1 DESCRIPTION | ||
| 65 | |||
| 66 | This package provides methods for generating fake color name data. | ||
| 67 | |||
| 68 | =cut | ||
| 69 | |||
| 70 | =head1 INHERITS | ||
| 71 | |||
| 72 | This package inherits behaviors from: | ||
| 73 | |||
| 74 | L<Data::Object::Plugin> | ||
| 75 | |||
| 76 | =cut | ||
| 77 | |||
| 78 | =head1 LIBRARIES | ||
| 79 | |||
| 80 | This package uses type constraints from: | ||
| 81 | |||
| 82 | L<Types::Standard> | ||
| 83 | |||
| 84 | =cut | ||
| 85 | |||
| 86 | =head1 ATTRIBUTES | ||
| 87 | |||
| 88 | This package has the following attributes: | ||
| 89 | |||
| 90 | =cut | ||
| 91 | |||
| 92 | =head2 faker | ||
| 93 | |||
| 94 | faker(ConsumerOf["Faker::Maker"]) | ||
| 95 | |||
| 96 | This attribute is read-only, accepts C<(ConsumerOf["Faker::Maker"])> values, and is required. | ||
| 97 | |||
| 98 | =cut | ||
| 99 | |||
| 100 | =head1 METHODS | ||
| 101 | |||
| 102 | This package implements the following methods: | ||
| 103 | |||
| 104 | =cut | ||
| 105 | |||
| 106 | =head2 execute | ||
| 107 | |||
| 108 | execute() : Str | ||
| 109 | |||
| 110 | The execute method returns a random fake color name. | ||
| 111 | |||
| 112 | =over 4 | ||
| 113 | |||
| 114 | =item execute example #1 | ||
| 115 | |||
| 116 | # given: synopsis | ||
| 117 | |||
| 118 | $p->execute; | ||
| 119 | |||
| 120 | =back | ||
| 121 | |||
| 122 | =cut | ||
| 123 | |||
| 124 | =head1 AUTHOR | ||
| 125 | |||
| 126 | Al Newkirk, C<awncorp@cpan.org> | ||
| 127 | |||
| 128 | =head1 LICENSE | ||
| 129 | |||
| 130 | Copyright (C) 2011-2019, Al Newkirk, et al. | ||
| 131 | |||
| 132 | This is free software; you can redistribute it and/or modify it under the terms | ||
| 133 | of the The Apache License, Version 2.0, as elucidated in the L<"license | ||
| 134 | file"|https://github.com/iamalnewkirk/faker/blob/master/LICENSE>. | ||
| 135 | |||
| 136 | =head1 ACKNOWLEDGEMENTS | ||
| 137 | |||
| 138 | Parts of this library were inspired by the following implementations: | ||
| 139 | |||
| 140 | L<PHP Faker|https://github.com/fzaninotto/Faker> | ||
| 141 | |||
| 142 | L<Ruby Faker|https://github.com/stympy/faker> | ||
| 143 | |||
| 144 | L<Python Faker|https://github.com/joke2k/faker> | ||
| 145 | |||
| 146 | L<JS Faker|https://github.com/Marak/faker.js> | ||
| 147 | |||
| 148 | L<Elixir Faker|https://github.com/elixirs/faker> | ||
| 149 | |||
| 150 | =head1 PROJECT | ||
| 151 | |||
| 152 | L<Wiki|https://github.com/iamalnewkirk/faker/wiki> | ||
| 153 | |||
| 154 | L<Project|https://github.com/iamalnewkirk/faker> | ||
| 155 | |||
| 156 | L<Initiatives|https://github.com/iamalnewkirk/faker/projects> | ||
| 157 | |||
| 158 | L<Milestones|https://github.com/iamalnewkirk/faker/milestones> | ||
| 159 | |||
| 160 | L<Contributing|https://github.com/iamalnewkirk/faker/blob/master/CONTRIBUTE.md> | ||
| 161 | |||
| 162 | L<Issues|https://github.com/iamalnewkirk/faker/issues> | ||
| 163 | |||
| 164 | =cut |