| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Alien::FreeImage; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 2 |  |  | 2 |  | 38063 | use warnings; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 112 |  | 
| 4 | 2 |  |  | 2 |  | 14 | use strict; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 50 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 2 |  |  | 2 |  | 794 | use Alien::FreeImage::ConfigData; | 
|  | 2 |  |  |  |  | 7 |  | 
|  | 2 |  |  |  |  | 70 |  | 
| 7 | 2 |  |  | 2 |  | 1014 | use File::ShareDir qw(dist_dir); | 
|  | 2 |  |  |  |  | 12049 |  | 
|  | 2 |  |  |  |  | 157 |  | 
| 8 | 2 |  |  | 2 |  | 996 | use File::Spec::Functions qw(catdir); | 
|  | 2 |  |  |  |  | 1619 |  | 
|  | 2 |  |  |  |  | 470 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | =head1 NAME | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | Alien::FreeImage - Building freeimage library L | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | =cut | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | our $VERSION = '1.000_2'; | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | This module is not a perl binding for I library; it is just a helper module that makes dev files (*.h, *.a) | 
| 21 |  |  |  |  |  |  | available for linking by other modules. | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | Alien::FreeImage installation comprise of these steps: | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | =over | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | =item * Build B static library (*.a) from source codes (that are bundled with this module) | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | =item * Install dev files (*.h, *.a) into I directory of Alien::FreeImage distribution | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | =back | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | Later on you can use Alien::FreeImage in your module that needs to link with I like this: | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | # Sample Makefile.PL | 
| 36 |  |  |  |  |  |  | use ExtUtils::MakeMaker; | 
| 37 |  |  |  |  |  |  | use Alien::FreeImage; | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | WriteMakefile( | 
| 40 |  |  |  |  |  |  | NAME         => 'Any::FreeImage::Module', | 
| 41 |  |  |  |  |  |  | VERSION_FROM => 'lib/Any/FreeImage/Module.pm', | 
| 42 |  |  |  |  |  |  | LIBS         => Alien::FreeImage->config('LIBS'), | 
| 43 |  |  |  |  |  |  | INC          => Alien::FreeImage->config('INC'), | 
| 44 |  |  |  |  |  |  | # + additional params | 
| 45 |  |  |  |  |  |  | ); | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | =head1 METHODS | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | =head2 config() | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | This function is the main public interface to this module. | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | Alien::FreeImage->config('LIBS'); | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | Returns a string like: '-L/path/to/freeimage/dir -lfreeimage' | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | Alien::FreeImage->config('INC'); | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | Returns a string like: '-I/path/to/freeimage/dir' | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | Alien::FreeImage->config('PREFIX'); | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | Returns a string like: '/path/to/freeimage/dir' | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | =head1 LICENSE | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | =head1 COPYRIGHT | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | 2014+ KMX Ekmx@cpan.orgE | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | =cut | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | sub config | 
| 76 |  |  |  |  |  |  | { | 
| 77 | 8 |  |  | 8 | 1 | 583 | my ($package, $param) = @_; | 
| 78 | 8 | 50 |  |  |  | 38 | return unless ($param =~ /[a-z0-9_]*/i); | 
| 79 | 8 |  |  |  |  | 29 | my $subdir = Alien::FreeImage::ConfigData->config('share_subdir'); | 
| 80 | 8 |  |  |  |  | 28 | my $share_dir = dist_dir('Alien-FreeImage'); | 
| 81 | 8 |  |  |  |  | 644 | my $real_prefix = catdir($share_dir, $subdir); | 
| 82 | 8 |  |  |  |  | 27 | my $val = Alien::FreeImage::ConfigData->config('config')->{$param}; | 
| 83 | 8 | 50 |  |  |  | 23 | return unless $val; | 
| 84 | 8 |  |  |  |  | 32 | $val =~ s/\@PrEfIx\@/$real_prefix/g; # handle @PrEfIx@ replacement | 
| 85 | 8 |  |  |  |  | 65 | return $val; | 
| 86 |  |  |  |  |  |  | } | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | 1; |