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