Faker/Plugin/ColorHexCode.pm

filter: Statementstmt 100% 17 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 100% 23 / 23 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Faker/Plugin/AddressLongitude.pm ↑ Summary Faker/Plugin/ColorRgbColorsetCss.pm »
1 package Faker::Plugin::ColorHexCode;
2  
3 5 ▶use 5.018;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 5 ▶use Venus::Class 'base';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 5 base 'Faker::Plugin';
11  
12 # VERSION
13  
14 5 our $VERSION = '1.19';
15  
16 # METHODS
17  
18 19 ▶sub execute {
Subroutine execute: called CC=1 SCAR=0.0
Pod documented
19 19 my ($self, $data) = @_;
20  
21 19 my $number = $self->faker->random->range(1, 16777215);
22  
23 19 return '#' . sprintf('%06s', sprintf('%02x', $number));
24 }
25  
26 5 1;
27  
28  
29  
30 =head1 NAME
31  
32 Faker::Plugin::ColorHexCode - Color Hex Code
33  
34 =cut
35  
36 =head1 ABSTRACT
37  
38 Color Hex Code for Faker
39  
40 =cut
41  
42 =head1 VERSION
43  
44 1.19
45  
46 =cut
47  
48 =head1 SYNOPSIS
49  
50 package main;
51  
52 use Faker::Plugin::ColorHexCode;
53  
54 my $plugin = Faker::Plugin::ColorHexCode->new;
55  
56 # bless(..., "Faker::Plugin::ColorHexCode")
57  
58 =cut
59  
60 =head1 DESCRIPTION
61  
62 This package provides methods for generating fake data for color hex code.
63  
64 =encoding utf8
65  
66 =cut
67  
68 =head1 INHERITS
69  
70 This package inherits behaviors from:
71  
72 L<Faker::Plugin>
73  
74 =cut
75  
76 =head1 METHODS
77  
78 This package provides the following methods:
79  
80 =cut
81  
82 =head2 execute
83  
84 execute(HashRef $data) (Str)
85  
86 The execute method returns a returns a random fake color hex code.
87  
88 I<Since C<1.10>>
89  
90 =over 4
91  
92 =item execute example 1
93  
94 package main;
95  
96 use Faker::Plugin::ColorHexCode;
97  
98 my $plugin = Faker::Plugin::ColorHexCode->new;
99  
100 # bless(..., "Faker::Plugin::ColorHexCode")
101  
102 # my $result = $plugin->execute;
103  
104 # "#57bb49";
105  
106 # my $result = $plugin->execute;
107  
108 # "#6c1e68";
109  
110 # my $result = $plugin->execute;
111  
112 # "#db3fb2";
113  
114 =back
115  
116 =cut
117  
118 =head2 new
119  
120 new(HashRef $data) (Plugin)
121  
122 The new method returns a new instance of the class.
123  
124 I<Since C<1.10>>
125  
126 =over 4
127  
128 =item new example 1
129  
130 package main;
131  
132 use Faker::Plugin::ColorHexCode;
133  
134 my $plugin = Faker::Plugin::ColorHexCode->new;
135  
136 # bless(..., "Faker::Plugin::ColorHexCode")
137  
138 =back
139  
140 =cut
141  
142 =head1 AUTHORS
143  
144 Awncorp, C<awncorp@cpan.org>
145  
146 =cut
147  
148 =head1 LICENSE
149  
150 Copyright (C) 2000, Al Newkirk.
151  
152 This program is free software, you can redistribute it and/or modify it under
153 the terms of the Apache license version 2.0.
154  
155 =cut
« Faker/Plugin/AddressLongitude.pm ↑ Summary Faker/Plugin/ColorRgbColorsetCss.pm »