blib/lib/CatalystX/FacebookURI.pm

filter: Statementstmt 62.5% 10 / 16 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 66.6% 2 / 3 Podpod n/a totaltotal 40.0% 12 / 30 CC 4 SCAR 26.1
CC
4
Cov
42%
__ANON__
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 13.7
↑ Summary
1 package CatalystX::FacebookURI;
2 2 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use URI::http;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 requires 'facebook';
5  
6 2 our $VERSION = '0.02';
7  
8 =head1 NAME
9  
10 CatalystX::FacebookURI - Automatically compose uri_for URIs to be within your Facebook application
11  
12 =head1 VERSION
13  
14 Version 0.02
15  
16 =head1 SYNOPSIS
17  
18 Quick summary of what the module does.
19  
20 Perhaps a little code snippet.
21  
22 package MyApp;
23 use Moose;
24 BEGIN {
25 extends 'Catalyst';
26  
27 use Catalyst::Runtime 5.80;
28 use Catalyst qw(
29 ...
30 Facebook
31 );
32 with 'CatalystX::FacebookURI';
33 }
34  
35 __PACKAGE__->config(
36 facebook => {
37 api_key => 'my_key',
38 secret => 'my_s33krit',
39 name => 'myapp' # Used as app name in URIs
40 }
41 );
42 ...
43  
44 my $uri = $c->uri_for('/some/path'); # returns http://apps.facebook.com/myapp/some/path
45  
46 =cut
47  
48 0 ▶after prepare_path => sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
49 0 my $c = shift;
50 0 my $is_ajax = $c->req->param('fb_sig_is_ajax');
51 0 my $is_frame = $c->facebook->canvas->in_frame();
52 0 my $is_canvas = $c->facebook->canvas->in_fb_canvas();
53  
54 0 my $app_name = $c->config->{facebook}{name};
55  
56 0 ▶ $c->req->base(URI->new("http://apps.facebook.com/$app_name/"))
Branch: 1 branch
BranchTrueFalseTotal
if $is_ajax or $is_frame or $is_canvas 0 0 0
Condition0%0/6
$is_ajax or $is_frame or $is_canvas
l!l&&r!l&&!r
000
$is_ajax or $is_frame
l!l&&r!l&&!r
000
MC/DC0%0/3
$is_ajax or $is_frame or $is_canvas
$is_ajax $is_frame $is_canvas
Truth table0%0/4
A or B or C
A= $is_ajaxB= $is_frameC= $is_canvas
ABCresult
1XX1
01X1
0011
0000
57 if $is_ajax or $is_frame or $is_canvas;
58 2 };
59  
60  
61 =head1 AUTHOR
62  
63 Michael Nachbaur, C<< <mike at nachbaur.com> >>
64  
65 =head1 BUGS
66  
67 Please report any bugs or feature requests to C<bug-catalystx-facebookuri at rt.cpan.org>, or through
68 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CatalystX-FacebookURI>. I will be notified, and then you'll
69 automatically be notified of progress on your bug as I make changes.
70  
71 This project is available via Git at http://github.com/NachoMan/CatalystX-FacebookURI
72  
73  
74 =head1 SUPPORT
75  
76 You can find documentation for this module with the perldoc command.
77  
78 perldoc CatalystX::FacebookURI
79  
80  
81 You can also look for information at:
82  
83 =over 4
84  
85 =item * RT: CPAN's request tracker
86  
87 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=CatalystX-FacebookURI>
88  
89 =item * AnnoCPAN: Annotated CPAN documentation
90  
91 L<http://annocpan.org/dist/CatalystX-FacebookURI>
92  
93 =item * CPAN Ratings
94  
95 L<http://cpanratings.perl.org/d/CatalystX-FacebookURI>
96  
97 =item * Search CPAN
98  
99 L<http://search.cpan.org/dist/CatalystX-FacebookURI/>
100  
101 =back
102  
103 =head1 COPYRIGHT & LICENSE
104  
105 Copyright 2010 Michael Nachbaur.
106  
107 This program is free software; you can redistribute it and/or modify it
108 under the terms of either: the GNU General Public License as published
109 by the Free Software Foundation; or the Artistic License.
110  
111 See http://dev.perl.org/licenses/ for more information.
112  
113  
114 =cut
115  
116 2 1; # End of CatalystX::FacebookURI
↑ Summary