| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Alien::VideoLAN::LibVLC; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 49189 | use warnings; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 35 |  | 
| 4 | 1 |  |  | 1 |  | 6 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 38 |  | 
| 5 | 1 |  |  | 1 |  | 449 | use ExtUtils::PkgConfig; | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | =head1 NAME | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | Alien::VideoLAN::LibVLC - Find installed libvlc. | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | =head1 VERSION | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | Version 0.04 | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | =cut | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | our $VERSION = '0.04'; | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | sub _find { | 
| 20 |  |  |  |  |  |  | my $self = shift; | 
| 21 |  |  |  |  |  |  | my $lib = shift; | 
| 22 |  |  |  |  |  |  | my %a = @_; | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | my $version = $a{version}; | 
| 25 |  |  |  |  |  |  | $version = '' unless defined $version; | 
| 26 |  |  |  |  |  |  | my %p; | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | if ($a{suppress_error_message}) { | 
| 29 |  |  |  |  |  |  | my $str; | 
| 30 |  |  |  |  |  |  | open my $fh, '>', \$str; | 
| 31 |  |  |  |  |  |  | local *STDERR = $fh; | 
| 32 |  |  |  |  |  |  | %p = ExtUtils::PkgConfig->find("$lib $version"); | 
| 33 |  |  |  |  |  |  | } else { | 
| 34 |  |  |  |  |  |  | %p = ExtUtils::PkgConfig->find("$lib $version"); | 
| 35 |  |  |  |  |  |  | } | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | my @cflags = grep { $_ ne '' } split /\s/, $p{cflags}; | 
| 38 |  |  |  |  |  |  | $p{cflags} = \@cflags; | 
| 39 |  |  |  |  |  |  | my @ldflags = grep { $_ ne '' } split /\s/, $p{libs}; | 
| 40 |  |  |  |  |  |  | delete $p{libs}; | 
| 41 |  |  |  |  |  |  | $p{ldflags} = \@ldflags; | 
| 42 |  |  |  |  |  |  | $p{version} = $p{modversion}; | 
| 43 |  |  |  |  |  |  | delete $p{modversion}; | 
| 44 |  |  |  |  |  |  | return %p; | 
| 45 |  |  |  |  |  |  | } | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | use Alien::VideoLAN::LibVLC; | 
| 50 |  |  |  |  |  |  | my %x = Alien::VideoLAN::LibVLC->find_libvlc(); | 
| 51 |  |  |  |  |  |  | print $x{version}; | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | my %y = Alien::VideoLAN::LibVLC->find_libvlc(version => '>= 1.1.9'); | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | =head1 METHODS | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | =head2 C | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | Alien::VideoLAN::LibVLC->find_libvlc(); | 
| 60 |  |  |  |  |  |  | Alien::VideoLAN::LibVLC->find_libvlc(version => '>= 1.1.9'); | 
| 61 |  |  |  |  |  |  | Alien::VideoLAN::LibVLC->find_libvlc(version => '= 1.1.10', | 
| 62 |  |  |  |  |  |  | suppress_error_message => 1); | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | Finds installed libvlc. | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | If C parameter is specified, required version is needed. | 
| 67 |  |  |  |  |  |  | Check documentation of C for format of version. | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | If C parameter is specified and is true, | 
| 70 |  |  |  |  |  |  | nothing will be put to STDERR if libvlc is not found. | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  | Returns hash with following fields: | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | =over 4 | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | =item * B | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | a string with version. | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | =item * B | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | arrayref of strings, e.g. C<['-I/foo/bar']> | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | =item * B | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | arrayref of strings, e.g. C<['-L/foo/baz', '-lvlc']> | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | =back | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | If libvlc of specified version isn't found, croaks. | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | =cut | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | sub find_libvlc { | 
| 95 |  |  |  |  |  |  | my $self = shift; | 
| 96 |  |  |  |  |  |  | my %a = @_; | 
| 97 |  |  |  |  |  |  | return $self->_find('libvlc', %a); | 
| 98 |  |  |  |  |  |  | } | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | =head1 AUTHOR | 
| 101 |  |  |  |  |  |  |  | 
| 102 |  |  |  |  |  |  | Alexey Sokolov, C<<  >> | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  | =head1 BUGS | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  | Please report any bugs or feature requests to C, or through | 
| 107 |  |  |  |  |  |  | the web interface at L.  I will be notified, and then you'll | 
| 108 |  |  |  |  |  |  | automatically be notified of progress on your bug as I make changes. | 
| 109 |  |  |  |  |  |  |  | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  |  | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | =head1 SUPPORT | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | You can find documentation for this module with the perldoc command. | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | perldoc Alien::VideoLAN::LibVLC | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | You can also look for information at: | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | =over 4 | 
| 123 |  |  |  |  |  |  |  | 
| 124 |  |  |  |  |  |  | =item * RT: CPAN's request tracker | 
| 125 |  |  |  |  |  |  |  | 
| 126 |  |  |  |  |  |  | L | 
| 127 |  |  |  |  |  |  |  | 
| 128 |  |  |  |  |  |  | =item * AnnoCPAN: Annotated CPAN documentation | 
| 129 |  |  |  |  |  |  |  | 
| 130 |  |  |  |  |  |  | L | 
| 131 |  |  |  |  |  |  |  | 
| 132 |  |  |  |  |  |  | =item * CPAN Ratings | 
| 133 |  |  |  |  |  |  |  | 
| 134 |  |  |  |  |  |  | L | 
| 135 |  |  |  |  |  |  |  | 
| 136 |  |  |  |  |  |  | =item * Search CPAN | 
| 137 |  |  |  |  |  |  |  | 
| 138 |  |  |  |  |  |  | L | 
| 139 |  |  |  |  |  |  |  | 
| 140 |  |  |  |  |  |  | =back | 
| 141 |  |  |  |  |  |  |  | 
| 142 |  |  |  |  |  |  |  | 
| 143 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 144 |  |  |  |  |  |  |  | 
| 145 |  |  |  |  |  |  | L | 
| 146 |  |  |  |  |  |  |  | 
| 147 |  |  |  |  |  |  | L | 
| 148 |  |  |  |  |  |  |  | 
| 149 |  |  |  |  |  |  | L | 
| 150 |  |  |  |  |  |  |  | 
| 151 |  |  |  |  |  |  | =head1 LICENSE AND COPYRIGHT | 
| 152 |  |  |  |  |  |  |  | 
| 153 |  |  |  |  |  |  | Copyright 2011 Alexey Sokolov. | 
| 154 |  |  |  |  |  |  |  | 
| 155 |  |  |  |  |  |  | This program is free software; you can redistribute it and/or modify it | 
| 156 |  |  |  |  |  |  | under the terms of either: the GNU General Public License as published | 
| 157 |  |  |  |  |  |  | by the Free Software Foundation; or the Artistic License. | 
| 158 |  |  |  |  |  |  |  | 
| 159 |  |  |  |  |  |  | See http://dev.perl.org/licenses/ for more information. | 
| 160 |  |  |  |  |  |  |  | 
| 161 |  |  |  |  |  |  |  | 
| 162 |  |  |  |  |  |  | =cut | 
| 163 |  |  |  |  |  |  |  | 
| 164 |  |  |  |  |  |  | 1; # End of Alien::VideoLAN::LibVLC |