<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<!--
This file was generated by Devel::Cover Version 1.26
Devel::Cover is copyright 2001-2012, Paul Johnson (paul@pjcj.net)
Devel::Cover is free. It is licensed under the same terms as Perl itself.
The latest version of Devel::Cover should be available from my homepage:
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
<meta http-equiv="Content-Language" content="en-us"></meta>
<link rel="stylesheet" type="text/css" href="cover.css"></link>
<link rel="stylesheet" type="text/css" href="cover.css"></link>
<title>File Coverage: lib/Yukki/Types.pm</title>
</head>
<body>
<h1>File Coverage</h1>
<table>
<tr><td class="h" align="right">File:</td><td align="left">lib/Yukki/Types.pm</td></tr>
<tr><td class="h" align="right">Coverage:</td><td align="left" class="c3">100.0%</td></tr>
</table>
<div><br/></div>
<table>
<tr><th>line</th><th>stmt</th><th>bran</th><th>cond</th><th>sub</th><th>pod</th><th>time</th><th>code</th></tr>
<tr><td class="h">1</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">package Yukki::Types;</td></tr>
<tr><td class="h">2</td><td colspan="7"></td></tr><tr><td class="h">3</td><td><div class="c3">6</div><div class="c3">6</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-Types-pm--subroutine.html#L3">6</a></div></td><td></td><td><div>37</div><div>16</div></td><td class="s">use v5.24;</td></tr>
<tr><td class="h">4</td><td><div class="c3">6</div><div class="c3">6</div><div class="c3">6</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-Types-pm--subroutine.html#L4">6</a></div></td><td></td><td><div>18</div><div>6</div><div>20</div></td><td class="s">use utf8;</td></tr>
<tr><td class="h">5</td><td colspan="7"></td></tr><tr><td class="h">6</td><td><div class="c3">6</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-Types-pm--subroutine.html#L6">6</a></div></td><td></td><td><div>135</div></td><td class="s">use Type::Library -base, -declare => qw(</td></tr>
<tr><td class="h">7</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> LoginName AccessLevel</td></tr>
<tr><td class="h">8</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> NavigationLinks NavigationMenuMap</td></tr>
<tr><td class="h">9</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> BaseURL BaseURLEnum BreadcrumbLinks RepositoryMap</td></tr>
<tr><td class="h">10</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> PluginConfig PluginList</td></tr>
<tr><td class="h">11</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> PrivilegesMap</td></tr>
<tr><td class="h">12</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> EmailAddress YukkiSettings</td></tr>
<tr><td class="h">13</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> YukkiWebSettings YukkiSettingsAnonymous</td></tr>
<tr><td class="h">14</td><td><div class="c3">6</div><div class="c3">6</div></td><td></td><td></td><td></td><td></td><td><div>8</div><div>32</div></td><td class="s">);</td></tr>
<tr><td class="h">15</td><td><div class="c3">6</div><div class="c3">6</div><div class="c3">6</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-Types-pm--subroutine.html#L15">6</a></div></td><td></td><td><div>6622</div><div>9</div><div>18</div></td><td class="s">use Type::Utils qw( declare as where message coerce enum from via class_type );</td></tr>
<tr><td class="h">16</td><td colspan="7"></td></tr><tr><td class="h">17</td><td><div class="c3">6</div><div class="c3">6</div><div class="c3">6</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-Types-pm--subroutine.html#L17">6</a></div></td><td></td><td><div>3712</div><div>9</div><div>19</div></td><td class="s">use Types::Standard qw( Str Int ArrayRef Maybe HashRef Dict );</td></tr>
<tr><td class="h">18</td><td><div class="c3">6</div><div class="c3">6</div><div class="c3">6</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-Types-pm--subroutine.html#L18">6</a></div></td><td></td><td><div>5500</div><div>155354</div><div>39</div></td><td class="s">use Types::URI qw( Uri );</td></tr>
<tr><td class="h">19</td><td colspan="7"></td></tr><tr><td class="h">20</td><td><div class="c3">6</div><div class="c3">6</div><div class="c3">6</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-Types-pm--subroutine.html#L20">6</a></div></td><td></td><td><div>3228</div><div>22378</div><div>178</div></td><td class="s">use Email::Address;</td></tr>
<tr><td class="h">21</td><td><div class="c3">6</div><div class="c3">6</div><div class="c3">6</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-Types-pm--subroutine.html#L21">6</a></div></td><td></td><td><div>35</div><div>9</div><div>339</div></td><td class="s">use List::Util qw( first all );</td></tr>
<tr><td class="h">22</td><td colspan="7"></td></tr><tr><td class="h">23</td><td><div class="c3">6</div><div class="c3">6</div><div class="c3">6</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-Types-pm--subroutine.html#L23">6</a></div></td><td></td><td><div>1051</div><div>7130</div><div>33</div></td><td class="s">use namespace::clean;</td></tr>
<tr><td class="h">24</td><td colspan="7"></td></tr><tr><td class="h">25</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"># ABSTRACT: standard types for use in Yukki</td></tr>
<tr><td class="h">26</td><td colspan="7"></td></tr><tr><td class="h">27 - 44</td><td colspan="6"></td><td class="s"><pre>=head1 SYNOPSIS
use Yukki::Types qw( LoginName AccessLevel );
has login_name => ( isa => LoginName );
has access_level => ( isa => AccessLevel );
=head1 DESCRIPTION
A standard type library for Yukki.
=head1 TYPES
=head2 LoginName
This is a valid login name. Login names may only contain letters and numbers, as of this writing.
=cut</pre></td></tr>
<tr><td class="h">45</td><td colspan="7"></td></tr><tr><td class="h">46</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">declare LoginName,</td></tr>
<tr><td class="h">47</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> as Str,</td></tr>
<tr><td class="h">48</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> where { /^[a-zA-Z0-9_-]{3,20}$/ },</td></tr>
<tr><td class="h">49</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> message { "login name $_ must only contain letters and numbers" };</td></tr>
<tr><td class="h">50</td><td colspan="7"></td></tr><tr><td class="h">51 - 59</td><td colspan="6"></td><td class="s"><pre>=head2 AccessLevel
This is a valid access level. This includes any of the following values:
read
write
none
=cut</pre></td></tr>
<tr><td class="h">60</td><td colspan="7"></td></tr><tr><td class="h">61</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">enum AccessLevel, [qw( read write none )];</td></tr>
<tr><td class="h">62</td><td colspan="7"></td></tr><tr><td class="h">63 - 73</td><td colspan="6"></td><td class="s"><pre>=head2 NavigationLinks
This is an array of hashes formatted like:
{
label => 'Label',
href => '/link/to/somewhere',
sort => 40,
}
=cut</pre></td></tr>
<tr><td class="h">74</td><td colspan="7"></td></tr><tr><td class="h">75</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">declare NavigationLinks,</td></tr>
<tr><td class="h">76</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> as ArrayRef[</td></tr>
<tr><td class="h">77</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> Dict[</td></tr>
<tr><td class="h">78</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> label => Str,</td></tr>
<tr><td class="h">79</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> href => Str|Uri,</td></tr>
<tr><td class="h">80</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> sort => Maybe[Int],</td></tr>
<tr><td class="h">81</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> ],</td></tr>
<tr><td class="h">82</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> ];</td></tr>
<tr><td class="h">83</td><td colspan="7"></td></tr><tr><td class="h">84 - 88</td><td colspan="6"></td><td class="s"><pre>=head2 NavigationMenuMap
This is a hash of L</NavigationLinks>.
=cut</pre></td></tr>
<tr><td class="h">89</td><td colspan="7"></td></tr><tr><td class="h">90</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">declare NavigationMenuMap,</td></tr>
<tr><td class="h">91</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> as HashRef[ NavigationLinks ];</td></tr>
<tr><td class="h">92</td><td colspan="7"></td></tr><tr><td class="h">93 - 97</td><td colspan="6"></td><td class="s"><pre>=head2 BaseURL
This is either an absolute URL or the words C<SCRIPT_NAME> or C<REWRITE>.
=cut</pre></td></tr>
<tr><td class="h">98</td><td colspan="7"></td></tr><tr><td class="h">99</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">enum BaseURLEnum, [qw( SCRIPT_NAME REWRITE )];</td></tr>
<tr><td class="h">100</td><td colspan="7"></td></tr><tr><td class="h">101</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">declare BaseURL, as BaseURLEnum|Uri;</td></tr>
<tr><td class="h">102</td><td colspan="7"></td></tr><tr><td class="h">103</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">coerce BaseURL,</td></tr>
<tr><td class="h">104</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> from Str,</td></tr>
<tr><td class="h">105</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> via {</td></tr>
<tr><td class="h">106</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> $_ !~ /^(?:SCRIPT_NAME|REWRITE)$/</td></tr>
<tr><td class="h">107</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> && URI->new($_)</td></tr>
<tr><td class="h">108</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> };</td></tr>
<tr><td class="h">109</td><td colspan="7"></td></tr><tr><td class="h">110 - 119</td><td colspan="6"></td><td class="s"><pre>=head2 BreadcrumbLinks
This is an array of hashes formatted like:
{
label => 'Label',
href => '/link/to/somewhere',
}
=cut</pre></td></tr>
<tr><td class="h">120</td><td colspan="7"></td></tr><tr><td class="h">121</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">declare BreadcrumbLinks,</td></tr>
<tr><td class="h">122</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> as ArrayRef[</td></tr>
<tr><td class="h">123</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> Dict[</td></tr>
<tr><td class="h">124</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> label => Str,</td></tr>
<tr><td class="h">125</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> href => Str,</td></tr>
<tr><td class="h">126</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> ],</td></tr>
<tr><td class="h">127</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> ];</td></tr>
<tr><td class="h">128</td><td colspan="7"></td></tr><tr><td class="h">129 - 133</td><td colspan="6"></td><td class="s"><pre>=head2 RepositoryMap
This is a hash of L<Yukki::Settings::Repository> objects.
=cut</pre></td></tr>
<tr><td class="h">134</td><td colspan="7"></td></tr><tr><td class="h">135</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">my $Repository = class_type 'Yukki::Settings::Repository';</td></tr>
<tr><td class="h">136</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">declare RepositoryMap,</td></tr>
<tr><td class="h">137</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> as HashRef[$Repository];</td></tr>
<tr><td class="h">138</td><td colspan="7"></td></tr><tr><td class="h">139</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">coerce RepositoryMap,</td></tr>
<tr><td class="h">140</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> from HashRef,</td></tr>
<tr><td class="h">141</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> via {</td></tr>
<tr><td class="h">142</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> my $source = $_;</td></tr>
<tr><td class="h">143</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> +{</td></tr>
<tr><td class="h">144</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> map { $_ => Yukki::Settings::Repository->new($source->{$_}) }</td></tr>
<tr><td class="h">145</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> keys %$source</td></tr>
<tr><td class="h">146</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">147</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> };</td></tr>
<tr><td class="h">148</td><td colspan="7"></td></tr><tr><td class="h">149 - 153</td><td colspan="6"></td><td class="s"><pre>=head2 PrivilegeMap
This is a hash of L<Yukki::Settings::Privileges> objects.
=cut</pre></td></tr>
<tr><td class="h">154</td><td colspan="7"></td></tr><tr><td class="h">155</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">my $Privileges = class_type 'Yukki::Settings::Privileges';</td></tr>
<tr><td class="h">156</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">declare PrivilegesMap,</td></tr>
<tr><td class="h">157</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> as HashRef[$Privileges];</td></tr>
<tr><td class="h">158</td><td colspan="7"></td></tr><tr><td class="h">159</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">coerce PrivilegesMap,</td></tr>
<tr><td class="h">160</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> from HashRef,</td></tr>
<tr><td class="h">161</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> via {</td></tr>
<tr><td class="h">162</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> my $source = $_;</td></tr>
<tr><td class="h">163</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> +{</td></tr>
<tr><td class="h">164</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> map { $_ => Yukki::Settings::Privileges->new($source->{$_}) }</td></tr>
<tr><td class="h">165</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> keys %$source</td></tr>
<tr><td class="h">166</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">167</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> };</td></tr>
<tr><td class="h">168</td><td colspan="7"></td></tr><tr><td class="h">169 - 173</td><td colspan="6"></td><td class="s"><pre>=head2 PluginConfig
A plugin configuration is an array of hashes. Each hash must have at least one key named "module" defined.
=cut</pre></td></tr>
<tr><td class="h">174</td><td colspan="7"></td></tr><tr><td class="h">175</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">declare PluginConfig,</td></tr>
<tr><td class="h">176</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> as ArrayRef[HashRef],</td></tr>
<tr><td class="h">177</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> where { all { defined $_->{module} } @$_ };</td></tr>
<tr><td class="h">178</td><td colspan="7"></td></tr><tr><td class="h">179 - 183</td><td colspan="6"></td><td class="s"><pre>=head2 PluginList
A plugin list is a loaded set of plugin objects.
=cut</pre></td></tr>
<tr><td class="h">184</td><td colspan="7"></td></tr><tr><td class="h">185</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">my $Plugin = class_type 'Yukki::Web::Plugin';</td></tr>
<tr><td class="h">186</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">declare PluginList,</td></tr>
<tr><td class="h">187</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> as ArrayRef[$Plugin],</td></tr>
<tr><td class="h">188</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> message {</td></tr>
<tr><td class="h">189</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> return 'It is not an array of objects.' unless ref $_ eq 'ARRAY';</td></tr>
<tr><td class="h">190</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> my $bad = first { not blessed $_ or not $_->isa('Yukki::Web::Plugin') }</td></tr>
<tr><td class="h">191</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> @$_;</td></tr>
<tr><td class="h">192</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> $bad = blessed $bad if blessed $bad;</td></tr>
<tr><td class="h">193</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> return "It contains $bad, which is not a Yukki::Web::Plugin.";</td></tr>
<tr><td class="h">194</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> };</td></tr>
<tr><td class="h">195</td><td colspan="7"></td></tr><tr><td class="h">196 - 204</td><td colspan="6"></td><td class="s"><pre>=head1 COERCIONS
In addition to the types above, these coercions are provided for other types.
=head2 EmailAddress
Coerces a C<Str> into an L<Email::Address>.
=cut</pre></td></tr>
<tr><td class="h">205</td><td colspan="7"></td></tr><tr><td class="h">206</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">class_type EmailAddress, { class => 'Email::Address' };</td></tr>
<tr><td class="h">207</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">coerce EmailAddress,</td></tr>
<tr><td class="h">208</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> from Str,</td></tr>
<tr><td class="h">209</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> via { (Email::Address->parse($_))[0] };</td></tr>
<tr><td class="h">210</td><td colspan="7"></td></tr><tr><td class="h">211 - 215</td><td colspan="6"></td><td class="s"><pre>=head2 YukkiSettings
Coerces a C<HashRef> into this object by passing the value to the constructor.
=cut</pre></td></tr>
<tr><td class="h">216</td><td colspan="7"></td></tr><tr><td class="h">217</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">class_type YukkiSettings, { class => 'Yukki::Settings' };</td></tr>
<tr><td class="h">218</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">coerce YukkiSettings,</td></tr>
<tr><td class="h">219</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> from HashRef,</td></tr>
<tr><td class="h">220</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> via { Yukki::Settings->new($_) };</td></tr>
<tr><td class="h">221</td><td colspan="7"></td></tr><tr><td class="h">222 - 226</td><td colspan="6"></td><td class="s"><pre>=head2 YukkiWebSettings
Coerces a C<HashRef> into a L<Yukki::Web::Settings>.
=cut</pre></td></tr>
<tr><td class="h">227</td><td colspan="7"></td></tr><tr><td class="h">228</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">class_type YukkiWebSettings, { class => 'Yukki::Web::Settings' };</td></tr>
<tr><td class="h">229</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">coerce YukkiWebSettings,</td></tr>
<tr><td class="h">230</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> from HashRef,</td></tr>
<tr><td class="h">231</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> via { Yukki::Web::Settings->new($_) };</td></tr>
<tr><td class="h">232</td><td colspan="7"></td></tr><tr><td class="h">233 - 237</td><td colspan="6"></td><td class="s"><pre>=head2 YukkiSettingsAnonymous
Coerces a C<HashRef> into this object by passing the value to the constructor.
=cut</pre></td></tr>
<tr><td class="h">238</td><td colspan="7"></td></tr><tr><td class="h">239</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">class_type YukkiSettingsAnonymous, { class => 'Yukki::Settings::Anonymous' };</td></tr>
<tr><td class="h">240</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">coerce YukkiSettingsAnonymous,</td></tr>
<tr><td class="h">241</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> from HashRef,</td></tr>
<tr><td class="h">242</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> via { Yukki::Settings::Anonymous->new($_) };</td></tr>
<tr><td class="h">243</td><td colspan="7"></td></tr><tr><td class="h">244</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">1;</td></tr>
</table>
</body>
</html>