| 1 | # ABSTRACT: Role for blog posts | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | package HiD::Role::IsPost; | ||||||||||||||||||||||||||||
| 5 | 19 | our $AUTHORITY = 'cpan:GENEHACK'; | |||||||||||||||||||||||||||
| 6 | 19 | $HiD::Role::IsPost::VERSION = '1.96'; | |||||||||||||||||||||||||||
| 7 | 19 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 19 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 19 | ▶ | use 5.014; # strict, unicode_strings | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 19 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 19 | ▶ | use autodie; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 19 | ▶ | use warnings qw/ FATAL utf8 /; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 19 | ▶ | use open qw/ :std :utf8 /; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 19 | ▶ | use charnames qw/ :full /; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 19 | ▶ | use DateTime; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 19 | ▶ | use Date::Parse qw/ str2time /; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 19 | ▶ | use HiD::Types; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 19 | has author => ( | |||||||||||||||||||||||||||
| 24 | is => 'ro' , | ||||||||||||||||||||||||||||
| 25 | isa => 'Str' , | ||||||||||||||||||||||||||||
| 26 | lazy => 1 , | ||||||||||||||||||||||||||||
| 27 | builder => '_build_author' , | ||||||||||||||||||||||||||||
| 28 | ); | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | sub _build_author { | ||||||||||||||||||||||||||||
| 31 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_build_author: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 0 | my $author = $self->get_metadata( 'author' ); | |||||||||||||||||||||||||||
| 34 | 0 | ▶ | return $author if defined $author; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 0 | my $default_author = $self->get_config( 'default_author' ); | |||||||||||||||||||||||||||
| 37 | 0 | ▶ | return $default_author if defined $default_author; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | die "Need author for " . $self->basename . "\n" | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | has categories => ( | ||||||||||||||||||||||||||||
| 44 | is => 'ro' , | ||||||||||||||||||||||||||||
| 45 | isa => 'ArrayRef' , | ||||||||||||||||||||||||||||
| 46 | lazy => 1 , | ||||||||||||||||||||||||||||
| 47 | default => sub { | ||||||||||||||||||||||||||||
| 48 | 19 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 19 | ▶ | if ( my $category = $self->get_metadata( 'category' )) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 51 | 1 | return [ $category ]; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | elsif ( my $categories = $self->get_metadata( 'categories' )) { | ||||||||||||||||||||||||||||
| 54 | 2 | ▶ | if ( ref $categories ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | 1 | return [ @$categories ]; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | else { | ||||||||||||||||||||||||||||
| 58 | 1 | my @categories = split /\s/ , $categories; | |||||||||||||||||||||||||||
| 59 | 1 | return [ @categories ]; | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | 16 | else { return [] } | |||||||||||||||||||||||||||
| 63 | }, | ||||||||||||||||||||||||||||
| 64 | 19 | ); | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | has date => ( | ||||||||||||||||||||||||||||
| 68 | is => 'ro' , | ||||||||||||||||||||||||||||
| 69 | isa => 'DateTime' , | ||||||||||||||||||||||||||||
| 70 | lazy => 1, | ||||||||||||||||||||||||||||
| 71 | handles => { | ||||||||||||||||||||||||||||
| 72 | day => 'day' , | ||||||||||||||||||||||||||||
| 73 | month => 'month' , | ||||||||||||||||||||||||||||
| 74 | strftime => 'strftime' , | ||||||||||||||||||||||||||||
| 75 | year => 'year' , | ||||||||||||||||||||||||||||
| 76 | }, | ||||||||||||||||||||||||||||
| 77 | default => sub { | ||||||||||||||||||||||||||||
| 78 | 33 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.8
| |||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 33 | ▶ | if ( $self->get_config( 'publish_drafts' )){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 81 | 0 | ▶ | return DateTime->now if $self->is_draft; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 33 | my( $year , $month , $day ); | |||||||||||||||||||||||||||
| 85 | 33 | ▶ | if ( my $date = $self->get_metadata( 'date' )) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | 6 | return DateTime->from_epoch( | |||||||||||||||||||||||||||
| 87 | epoch => str2time( $date ), | ||||||||||||||||||||||||||||
| 88 | time_zone => 'local' , | ||||||||||||||||||||||||||||
| 89 | ); | ||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | else { | ||||||||||||||||||||||||||||
| 92 | 27 | ( $year , $month , $day ) = $self->input_filename | |||||||||||||||||||||||||||
| 93 | =~ m|^.*?/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})-|; | ||||||||||||||||||||||||||||
| 94 | 27 | return DateTime->new( | |||||||||||||||||||||||||||
| 95 | year => $year , | ||||||||||||||||||||||||||||
| 96 | month => $month , | ||||||||||||||||||||||||||||
| 97 | day => $day , | ||||||||||||||||||||||||||||
| 98 | time_zone => 'UTC' , | ||||||||||||||||||||||||||||
| 99 | ); | ||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | }, | ||||||||||||||||||||||||||||
| 102 | 19 | ); | |||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 19 | has description => ( | |||||||||||||||||||||||||||
| 106 | is => 'ro' , | ||||||||||||||||||||||||||||
| 107 | isa => 'Maybe[Str]' , | ||||||||||||||||||||||||||||
| 108 | lazy => 1 , | ||||||||||||||||||||||||||||
| 109 | builder => '_build_description' , | ||||||||||||||||||||||||||||
| 110 | ); | ||||||||||||||||||||||||||||
| 111 | 0 | ▶ | sub _build_description { shift->get_metadata( 'description' ) } | ||||||||||||||||||||||||||
|
Subroutine
_build_description: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | 19 | has excerpt => ( | |||||||||||||||||||||||||||
| 115 | is => 'ro', | ||||||||||||||||||||||||||||
| 116 | isa => 'Str', | ||||||||||||||||||||||||||||
| 117 | lazy => 1, | ||||||||||||||||||||||||||||
| 118 | builder => '_build_excerpt', | ||||||||||||||||||||||||||||
| 119 | ); | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | sub _build_excerpt { | ||||||||||||||||||||||||||||
| 122 | 10 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_build_excerpt: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 10 | my $content = $self->content; | |||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 10 | ▶ | return unless defined $content; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | 10 | my $sep = $self->hid->excerpt_separator; | |||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | 10 | ▶ | if($content =~ /^$sep/mp) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 131 | 1 | return ${^PREMATCH}; | |||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | 9 | return $content; | |||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | has tags => ( | ||||||||||||||||||||||||||||
| 139 | is => 'ro' , | ||||||||||||||||||||||||||||
| 140 | isa => 'ArrayRef', | ||||||||||||||||||||||||||||
| 141 | traits => [ qw/ Array / ] , | ||||||||||||||||||||||||||||
| 142 | handles => { join_tags => 'join' } , | ||||||||||||||||||||||||||||
| 143 | default => sub { | ||||||||||||||||||||||||||||
| 144 | 57 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | 57 | ▶ | if ( my $tag = $self->get_metadata( 'tag' )) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 147 | 2 | return [ $tag ]; | |||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||
| 149 | elsif ( my $tags = $self->get_metadata( 'tags' )) { | ||||||||||||||||||||||||||||
| 150 | 2 | ▶ | if ( ref $tags ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 151 | 1 | return [ @$tags ]; | |||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||
| 153 | else { | ||||||||||||||||||||||||||||
| 154 | 1 | my @tags = split /\s/ , $tags; | |||||||||||||||||||||||||||
| 155 | 1 | return [ @tags ]; | |||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||
| 158 | 53 | else { return [] } | |||||||||||||||||||||||||||
| 159 | } , | ||||||||||||||||||||||||||||
| 160 | 19 | ); | |||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 19 | has title => ( | |||||||||||||||||||||||||||
| 164 | is => 'ro' , | ||||||||||||||||||||||||||||
| 165 | isa => 'Str' , | ||||||||||||||||||||||||||||
| 166 | lazy => 1 , | ||||||||||||||||||||||||||||
| 167 | builder => '_build_title' , | ||||||||||||||||||||||||||||
| 168 | ); | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | sub _build_title { | ||||||||||||||||||||||||||||
| 171 | 10 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_build_title: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | 10 | my $title = $self->get_metadata( 'title' ); | |||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 10 | ▶ | return $self->basename unless defined $title; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | 10 | ▶ | return ( ref $title ) ? $$title : $title; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | 19 | has twitter_handles => ( | |||||||||||||||||||||||||||
| 182 | is => 'ro' , | ||||||||||||||||||||||||||||
| 183 | isa => 'ArrayRef[Str]' , | ||||||||||||||||||||||||||||
| 184 | lazy => 1 , | ||||||||||||||||||||||||||||
| 185 | builder => '_build_twitter_handles' , | ||||||||||||||||||||||||||||
| 186 | traits => [ 'Array' ], | ||||||||||||||||||||||||||||
| 187 | handles => { | ||||||||||||||||||||||||||||
| 188 | has_twitter_handles => 'count', | ||||||||||||||||||||||||||||
| 189 | all_twitter_handles => 'elements', | ||||||||||||||||||||||||||||
| 190 | }, | ||||||||||||||||||||||||||||
| 191 | ); | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | sub _build_twitter_handles { | ||||||||||||||||||||||||||||
| 194 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_build_twitter_handles: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | 3 | my $t = $self->get_metadata('twitter'); | |||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | 3 | ▶ | return ref $t ? $t : [ $t ? $t : () ]; | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 3 | ▶ | sub twitter { ($_[0]->all_twitter_handles)[0] } | ||||||||||||||||||||||||||
|
Subroutine
twitter: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | around BUILDARGS => sub { | ||||||||||||||||||||||||||||
| 206 | 57 | ▶ | my $orig = shift; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=18.0
| |||||||||||||||||||||||||||||
| 207 | 57 | my $class = shift; | |||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | 57 | ▶ | my %args = ( ref $_[0] and ref $_[0] eq 'HASH' ) ? %{ $_[0] } : @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $_[0] and ref $_[0] eq "HASH"
MC/DC50%1/2
ref $_[0] and ref $_[0] eq "HASH"
ref $_[0]
ref $_[0] eq "HASH"
Truth table66%2/3
A and B
A= ref $_[0]B= ref $_[0] eq "HASH"
| |||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | 57 | ▶ | if ( my $input = $args{input_filename} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 212 | 57 | ▶ | if ( my $source = $args{source} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 213 | 10 | $input =~ s|$source/?||; | |||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | 57 | ▶ | if ( my( $cat ) = $input =~ m|^(.+?)/?_posts/| ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 217 | 5 | $args{categories} = [ split '/' , $cat ]; | |||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 57 | return $class->$orig( \%args ); | |||||||||||||||||||||||||||
| 222 | 19 | }; | |||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||
| 225 | 0 | ▶ | sub all_tags { shift->join_tags(',') } | ||||||||||||||||||||||||||
|
Subroutine
all_tags: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 19 | my $drafts_dir; | |||||||||||||||||||||||||||
| 229 | sub is_draft { | ||||||||||||||||||||||||||||
| 230 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
is_draft: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | 0 | ▶ | $drafts_dir //= $self->get_config( 'drafts_dir' ); | ||||||||||||||||||||||||||
|
Condition0%0/3
$drafts_dir //= $self->get_config("drafts_dir")
MC/DC0%0/2
$drafts_dir //= $self->get_config("drafts_dir")
$drafts_dir
$self->get_config("drafts_dir")
Truth table0%0/3
A //= B
A= $drafts_dirB= $self->get_config("drafts_dir")
| |||||||||||||||||||||||||||||
| 233 | 0 | ▶ | return ( $self->input_filename =~ /^$drafts_dir/ ) ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | 19 | ▶ | no Moose::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 237 | 19 | 1; | |||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | __END__ | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | =pod | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | =encoding UTF-8 | ||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | =head1 NAME | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | HiD::Role::IsPost - Role for blog posts | ||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | package HiD::ThingThatIsAPost; | ||||||||||||||||||||||||||||
| 252 | use Moose; | ||||||||||||||||||||||||||||
| 253 | with 'HiD::Role::IsPost'; | ||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | ... | ||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||
| 257 | 1; | ||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | This role is consumed by objects that are blog posts and provides blog | ||||||||||||||||||||||||||||
| 262 | post-specific attributes and methods. | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | =head1 ATTRIBUTES | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | =head2 author | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | =head2 categories | ||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | =head2 date | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | DateTime object for this post. | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | =head2 description | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | A one-line synopsis of the post (used, e.g., for metadata information used by | ||||||||||||||||||||||||||||
| 277 | Open Graph) | ||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | =head2 excerpt | ||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | It is generally useful to summarize or lead a post with a "read more" tag | ||||||||||||||||||||||||||||
| 282 | added to the end of the post. This is ideal for a blog where we might not | ||||||||||||||||||||||||||||
| 283 | want to list the full post on the front page. | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | =head2 tags | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | =head2 title | ||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | =head2 twitter_handles | ||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | Returns an arrayref of the twitter handles passed via | ||||||||||||||||||||||||||||
| 292 | the C<twitter> parameter. | ||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | =head1 METHODS | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | =head2 has_twitter_handles | ||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | Returns c<true> if the post has any twitter handles associated with it, C<false> | ||||||||||||||||||||||||||||
| 299 | otherwise. | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | =head2 all_twitter_handles | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | Returns the list of the twitter handles associated with the post. | ||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | =head2 twitter | ||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | DEPRECATED: use <twitter_handles> instead. | ||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | Returns the first twitter handle given to C<twitter>. | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | =head2 all_tags | ||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | Returns all tags for this post, joined together with commas | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | =head2 is_draft | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | Returns a boolean value indicating whether this post is coming from the drafts | ||||||||||||||||||||||||||||
| 318 | folder or not. | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | =head1 VERSION | ||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | version 1.96 | ||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | John SJ Anderson <genehack@genehack.org> | ||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | This software is copyright (c) 2015 by John SJ Anderson. | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 333 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||
| 335 | =cut | ||||||||||||||||||||||||||||