1Task::Weaken(3) User Contributed Perl Documentation Task::Weaken(3)
2
3
4
6 Task::Weaken - Ensure that a platform has weaken support
7
9 One recurring problem in modules that use Scalar::Util's "weaken"
10 function is that it is not present in the pure-perl variant.
11
12 While this isn't necesarily always a problem in a straight CPAN-based
13 Perl environment, some operating system distributions only include the
14 pure-Perl versions, don't include the XS version, and so weaken is then
15 "missing" from the platform, despite passing a dependency on
16 Scalar::Util successfully.
17
18 Most notably this is RedHat Linux at time of writing, but other come
19 and go and do the same thing, hence "recurring problem".
20
21 The normal solution is to manually write tests in each distribution to
22 ensure that "weaken" is available.
23
24 This restores the functionality testing to a dependency you do once in
25 your Makefile.PL, rather than something you have to write extra tests
26 for each time you write a module.
27
28 It should also help make the package auto-generators for the various
29 operating systems play more nicely, because it introduces a dependency
30 that they have to have a proper weaken in order to work.
31
32 How this Task works
33 Part of the problem seems to stem from the fact that some distributions
34 continue to include modules even if they fail some of their tests.
35
36 To get around that for this module, it will do a few dirty tricks.
37
38 If Scalar::Util is not available at all, it will issue a normal
39 dependency on the module. However, if Scalar::Util is relatively new (
40 it is >= 1.19 ) and the module does not have weaken, the install will
41 bail out altogether with a long error encouraging the user to seek
42 support from their vendor (this problem happens most often in vendor-
43 packaged Perl versions).
44
45 This distribution also contains tests to ensure that weaken is
46 available using more normal methods.
47
48 So if your module uses "weaken", you can just add the following to your
49 Module::Install-based Makefile.PL (or equivalent).
50
51 requires 'Task::Weaken' => 0;
52
54 Adam Kennedy <adamk@cpan.org>, <http://ali.as/>
55
57 Task, Scalar::Util, <http://ali.as/>
58
60 Copyright 2006 - 2007 Adam Kennedy.
61
62 This program is free software; you can redistribute it and/or modify it
63 under the same terms as Perl itself.
64
65 The full text of the license can be found in the LICENSE file included
66 with this module.
67
68
69
70perl v5.12.0 2007-11-14 Task::Weaken(3)