line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alien::Tidyp;
|
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
71441
|
use warnings;
|
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
140
|
|
4
|
3
|
|
|
3
|
|
16
|
use strict;
|
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
285
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
2301
|
use Alien::Tidyp::ConfigData;
|
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
179
|
|
7
|
3
|
|
|
3
|
|
3338
|
use File::ShareDir qw(dist_dir);
|
|
3
|
|
|
|
|
24778
|
|
|
3
|
|
|
|
|
280
|
|
8
|
3
|
|
|
3
|
|
2940
|
use File::Spec::Functions qw(catdir catfile rel2abs);
|
|
3
|
|
|
|
|
2748
|
|
|
3
|
|
|
|
|
1161
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Alien::Tidyp - Building, finding and using tidyp library - L
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = 'v1.4.7';
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 VERSION
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Version 1.4.7 of Alien::Tidyp uses I sources v1.04.
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
B This module is not a perl binding for I library; it is just a helper module.
|
25
|
|
|
|
|
|
|
The real perl binding is implemented by e.g L module, which is able to
|
26
|
|
|
|
|
|
|
use Alien::Tidyp to locate I library on your system (or build it from source codes).
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Alien::Tidyp tries (in given order) during its installation:
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=over
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=item * Locate an already installed I + ask user whether to use the already installed
|
33
|
|
|
|
|
|
|
I or whether to build I from sources
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=item * Via env variable TIDYP_DIR you can specify where the build script should look
|
36
|
|
|
|
|
|
|
for the already installed I (directories $TIDYP_DIR/lib and $TIDYP_DIR/include/tidyp
|
37
|
|
|
|
|
|
|
are expected to exist)
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=item * When not using the already installed I build process continues with
|
40
|
|
|
|
|
|
|
the following steps
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=item * Download I source code tarball
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item * Build I binaries from source codes (note: static libraries are build in this case)
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item * Install binaries and dev files (*.h, *.a) into I directory of Alien::Tidyp
|
47
|
|
|
|
|
|
|
distribution - I directory is usually something like this: /usr/lib/perl5/site_perl/5.10/auto/share/dist/Alien-Tidyp
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=back
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Later on you can use Alien::Tidyp in your module that needs to link with
|
52
|
|
|
|
|
|
|
I like this:
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# Sample Makefile.pl
|
55
|
|
|
|
|
|
|
use ExtUtils::MakeMaker;
|
56
|
|
|
|
|
|
|
use Alien::Tidyp;
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
WriteMakefile(
|
59
|
|
|
|
|
|
|
NAME => 'Any::Tidyp::Module',
|
60
|
|
|
|
|
|
|
VERSION_FROM => 'lib/Any/Tidyp/Module.pm',
|
61
|
|
|
|
|
|
|
LIBS => Alien::Tidyp->config('LIBS'),
|
62
|
|
|
|
|
|
|
INC => Alien::Tidyp->config('INC'),
|
63
|
|
|
|
|
|
|
# + additional params
|
64
|
|
|
|
|
|
|
);
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
B As Alien::Tidyp builds static libraries the modules using Alien::Tidyp (e.g. L)
|
67
|
|
|
|
|
|
|
need to have Alien::Tidyp just for building, not for later use. In other words Alien:Tidyp is just "build dependency"
|
68
|
|
|
|
|
|
|
not "run-time dependency".
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 Build.PL options
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 --srctarball=
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This option might come handy if you are not connected to the Internet. You can use it like:
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Build.PL --srctarball=/path/to/file/tidyp-1.04.tar.gz
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
or:
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Build.PL --srctarball=http://any.server.com/path/to/tidyp-1.04.tar.gz
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
IMPORTANT: The file should always be exactly the same source code tarball as specified in the end of Build.PL - see
|
83
|
|
|
|
|
|
|
source code (SHA1 checksum of the tarball is checked).
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 METHODS
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 config()
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This function is the main public interface to this module.
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Alien::Tidyp->config('LIBS');
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Returns a string like: '-L/path/to/tidyp/dir/lib -ltidyp'
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Alien::Tidyp->config('INC');
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Returns a string like: '-I/path/to/tidyp/dir/include/tidyp'
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Alien::Tidyp->config('PREFIX');
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Returns a string like: '/path/to/tidyp/dir' (note: if using the already installed
|
102
|
|
|
|
|
|
|
tidyp config('PREFIX') returns undef)
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 AUTHOR
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
KMX, Ekmx at cpan.orgE
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 BUGS
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Please report any bugs or feature requests to Ebug-Alien-Tidyp at rt.cpan.orgE, or through
|
111
|
|
|
|
|
|
|
the web interface at L.
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Please notice that the source code of tidyp library has a different license than module itself.
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head2 Alien::Tidyp perl module
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Copyright (c) 2010 KMX.
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it
|
122
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published
|
123
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License.
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information.
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 Source code of tidyp library
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Copyright (c) 1998-2003 World Wide Web Consortium
|
130
|
|
|
|
|
|
|
(Massachusetts Institute of Technology, European Research
|
131
|
|
|
|
|
|
|
Consortium for Informatics and Mathematics, Keio University).
|
132
|
|
|
|
|
|
|
All Rights Reserved.
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
This software and documentation is provided "as is," and
|
135
|
|
|
|
|
|
|
the copyright holders and contributing author(s) make no
|
136
|
|
|
|
|
|
|
representations or warranties, express or implied, including
|
137
|
|
|
|
|
|
|
but not limited to, warranties of merchantability or fitness
|
138
|
|
|
|
|
|
|
for any particular purpose or that the use of the software or
|
139
|
|
|
|
|
|
|
documentation will not infringe any third party patents,
|
140
|
|
|
|
|
|
|
copyrights, trademarks or other rights.
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
The copyright holders and contributing author(s) will not be held
|
143
|
|
|
|
|
|
|
liable for any direct, indirect, special or consequential damages
|
144
|
|
|
|
|
|
|
arising out of any use of the software or documentation, even if
|
145
|
|
|
|
|
|
|
advised of the possibility of such damage.
|
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Permission is hereby granted to use, copy, modify, and distribute
|
148
|
|
|
|
|
|
|
this source code, or portions hereof, documentation and executables,
|
149
|
|
|
|
|
|
|
for any purpose, without fee, subject to the following restrictions:
|
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
1. The origin of this source code must not be misrepresented.
|
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
2. Altered versions must be plainly marked as such and must not be misrepresented as being the original source.
|
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
3. This Copyright notice may not be removed or altered from any source or altered source distribution.
|
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
The copyright holders and contributing author(s) specifically
|
158
|
|
|
|
|
|
|
permit, without fee, and encourage the use of this source code
|
159
|
|
|
|
|
|
|
as a component for supporting the Hypertext Markup Language in
|
160
|
|
|
|
|
|
|
commercial products. If you use this source code in a product,
|
161
|
|
|
|
|
|
|
acknowledgment is not required but would be appreciated.
|
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=cut
|
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
sub config
|
166
|
|
|
|
|
|
|
{
|
167
|
10
|
|
|
10
|
1
|
15190
|
my ($package, $param) = @_;
|
168
|
10
|
50
|
|
|
|
52
|
return unless ($param =~ /[a-z0-9_]*/i);
|
169
|
10
|
|
|
|
|
43
|
my $subdir = Alien::Tidyp::ConfigData->config('share_subdir');
|
170
|
10
|
50
|
|
|
|
31
|
unless ($subdir) {
|
171
|
|
|
|
|
|
|
#we are using tidyp already installed on your system not compiled by Alien::Tidyp
|
172
|
|
|
|
|
|
|
#therefore no additinal magic needed
|
173
|
0
|
|
|
|
|
0
|
return Alien::Tidyp::ConfigData->config('config')->{$param};
|
174
|
|
|
|
|
|
|
}
|
175
|
10
|
|
|
|
|
32
|
my $share_dir = dist_dir('Alien-Tidyp');
|
176
|
10
|
|
|
|
|
1076
|
my $real_prefix = catdir($share_dir, $subdir);
|
177
|
10
|
|
|
|
|
34
|
my $val = Alien::Tidyp::ConfigData->config('config')->{$param};
|
178
|
10
|
50
|
|
|
|
26
|
return unless $val;
|
179
|
10
|
|
|
|
|
39
|
$val =~ s/\@PrEfIx\@/$real_prefix/g; # handle @PrEfIx@ replacement
|
180
|
10
|
|
|
|
|
114
|
return $val;
|
181
|
|
|
|
|
|
|
}
|
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
1;
|