| Net-PingFM documentation | Contained in the Net-PingFM distribution. |
Net::PingFM::Service - Class To Describe a ping.fm service
Class to describe a ping.fm service, generaly spat out by Net::PingFM.
Name for this service
id for this service
Trigger for this service, such as '@fb'
Url for this service, such as http://twitter.com
Icon (url) for this service
If we can use the blog method with this service returns 1 (true), otherwise returns 0 (false)
If we can use the microblog method with this service returns 1 (true), otherwise returns 0 (false)
If we can use the status method with this service returns 1 (true), otherwise returns 0 (false)
Whilst these aren't "private" they're not really nessasery or required, but feel free to use them if you want.
List (reference) containing acceptable methods for this service (blog, microblog, status )
my $meths = $srv->methods_hash;
if( $meths->{blog} ){ print 'we can blog'; }
Returns a hash reference where the keys are the method labels (blog, microblog, status) and the values are 1 or 0. A value of 1 indicates that method is available to the service zero indicates that it is not.
Joe Higton
Copyright 2008 Joe Higton
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Net-PingFM documentation | Contained in the Net-PingFM distribution. |
package Net::PingFM::Service; use strict; # For show as moose does this anyway use Moose; use Moose::Util::TypeConstraints;
has 'name' => ( is => 'ro', isa => 'Str', );
has 'id' => ( is => 'ro', isa => 'Str', );
has 'trigger' => ( is => 'ro', isa => 'Str', );
has 'url' => ( is => 'ro', isa => 'Str' );
has 'icon' => ( is => 'ro', isa => 'Str', ); subtype PingFM_method => as 'Str' => where{ $_ =~ / blog | microblog | status /x };
has 'can_blog' => ( is => 'ro', lazy => 1, builder => '_can_blog', ); sub _can_blog{ my $self = shift; return $self->methods_hash->{blog}; }
has 'can_microblog' => ( is => 'ro', lazy => 1, builder => '_can_microblog', ); sub _can_microblog{ my $self = shift; return $self->methods_hash->{microblog}; }
has 'can_status' => ( is => 'ro', lazy => 1, builder => '_can_status', ); sub _can_status{ my $self = shift; return $self->methods_hash->{status}; }
has 'methods' => ( is => 'ro', isa => 'ArrayRef[PingFM_method]', );
has 'methods_hash' => ( is => 'ro', isa => 'HashRef', lazy => 1, builder => '_methods_hash', ); sub _methods_hash{ my $self = shift; my %init = map { $_ => 0 } %Net::PingFM::VALID_POST_METHODS; return { %init, map{ $_ => 1 } @{ $self->methods } }; } no Moose; ;1; __END__