2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml">
5 <title>ExtUtils::Packlist - manage .packlist files
</title>
6 <meta http-equiv=
"content-type" content=
"text/html; charset=utf-8" />
7 <link rev=
"made" href=
"mailto:" />
10 <body style=
"background-color: white">
11 <table border=
"0" width=
"100%" cellspacing=
"0" cellpadding=
"3">
12 <tr><td class=
"block" style=
"background-color: #cccccc" valign=
"middle">
13 <big><strong><span class=
"block"> ExtUtils::Packlist - manage .packlist files
</span></strong></big>
17 <p><a name=
"__index__"></a></p>
22 <li><a href=
"#name">NAME
</a></li>
23 <li><a href=
"#synopsis">SYNOPSIS
</a></li>
24 <li><a href=
"#description">DESCRIPTION
</a></li>
25 <li><a href=
"#usage">USAGE
</a></li>
26 <li><a href=
"#functions">FUNCTIONS
</a></li>
27 <li><a href=
"#example">EXAMPLE
</a></li>
28 <li><a href=
"#author">AUTHOR
</a></li>
35 <h1><a name=
"name">NAME
</a></h1>
36 <p>ExtUtils::Packlist - manage .packlist files
</p>
40 <h1><a name=
"synopsis">SYNOPSIS
</a></h1>
42 use ExtUtils::Packlist;
43 my ($pl) = ExtUtils::Packlist-
>new('.packlist');
44 $pl-
>read('/an/old/.packlist');
45 my @missing_files = $pl-
>validate();
46 $pl-
>write('/a/new/.packlist');
</pre>
48 $pl-
>{'/some/file/name'}++;
50 $pl-
>{'/some/other/file/name'} = { type =
> 'file',
51 from =
> '/some/file' };
</pre>
55 <h1><a name=
"description">DESCRIPTION
</a></h1>
56 <p>ExtUtils::Packlist provides a standard way to manage .packlist files.
57 Functions are provided to read and write .packlist files. The original
58 .packlist format is a simple list of absolute pathnames, one per line. In
59 addition, this package supports an extended format, where as well as a filename
60 each line may contain a list of attributes in the form of a space separated
61 list of key=value pairs. This is used by the installperl script to
62 differentiate between files and links, for example.
</p>
66 <h1><a name=
"usage">USAGE
</a></h1>
67 <p>The hash reference returned by the
<a href=
"#item_new"><code>new()
</code></a> function can be used to examine and
68 modify the contents of the .packlist. Items may be added/deleted from the
69 .packlist by modifying the hash. If the value associated with a hash key is a
70 scalar, the entry written to the .packlist by any subsequent
<a href=
"#item_write"><code>write()
</code></a> will be a
71 simple filename. If the value is a hash, the entry written will be the
72 filename followed by the key=value pairs from the hash. Reading back the
73 .packlist will recreate the original entries.
</p>
77 <h1><a name=
"functions">FUNCTIONS
</a></h1>
79 <dt><strong><a name=
"item_new"><code>new()
</code></a></strong>
82 <p>This takes an optional parameter, the name of a .packlist. If the file exists,
83 it will be opened and the contents of the file will be read. The
<a href=
"#item_new"><code>new()
</code></a> method
84 returns a reference to a hash. This hash holds an entry for each line in the
85 .packlist. In the case of old-style .packlists, the value associated with each
86 key is undef. In the case of new-style .packlists, the value associated with
87 each key is a hash containing the key=value pairs following the filename in the
91 <dt><strong><a name=
"item_read"><code>read()
</code></a></strong>
94 <p>This takes an optional parameter, the name of the .packlist to be read. If
95 no file is specified, the .packlist specified to
<a href=
"#item_new"><code>new()
</code></a> will be read. If the
96 .packlist does not exist, Carp::croak will be called.
</p>
99 <dt><strong><a name=
"item_write"><code>write()
</code></a></strong>
102 <p>This takes an optional parameter, the name of the .packlist to be written. If
103 no file is specified, the .packlist specified to
<a href=
"#item_new"><code>new()
</code></a> will be overwritten.
</p>
106 <dt><strong><a name=
"item_validate"><code>validate()
</code></a></strong>
109 <p>This checks that every file listed in the .packlist actually exists. If an
110 argument which evaluates to true is given, any missing files will be removed
111 from the internal hash. The return value is a list of the missing files, which
112 will be empty if they all exist.
</p>
115 <dt><strong><a name=
"item_packlist_file"><code>packlist_file()
</code></a></strong>
118 <p>This returns the name of the associated .packlist file
</p>
125 <h1><a name=
"example">EXAMPLE
</a></h1>
126 <p>Here's
<code>modrm
</code>, a little utility to cleanly remove an installed module.
</p>
128 #!/usr/local/bin/perl -w
</pre>
132 use ExtUtils::Packlist;
133 use ExtUtils::Installed;
</pre>
137 my $dh = IO::Dir-
>new($dir) || return(
0);
138 my @count = $dh-
>read();
140 return(@count ==
2 ?
1 :
0);
143 # Find all the installed packages
144 print(
"Finding all installed modules...\n
");
145 my $installed = ExtUtils::Installed-
>new();
</pre>
147 foreach my $module (grep(!/^Perl$/, $installed-
>modules())) {
148 my $version = $installed-
>version($module) ||
"???
";
149 print(
"Found module $module Version $version\n
");
150 print(
"Do you want to delete $module? [n]
");
151 my $r =
<STDIN
>; chomp($r);
152 if ($r
&& $r =~ /^y/i) {
153 # Remove all the files
154 foreach my $file (sort($installed-
>files($module))) {
155 print(
"rm $file\n
");
158 my $pf = $installed-
>packlist($module)-
>packlist_file();
159 print(
"rm $pf\n
");
161 foreach my $dir (sort($installed-
>directory_tree($module))) {
162 if (emptydir($dir)) {
163 print(
"rmdir $dir\n
");
172 <h1><a name=
"author">AUTHOR
</a></h1>
173 <p>Alan Burlison
<<a href=
"mailto:Alan.Burlison@uk.sun.com">Alan.Burlison@uk.sun.com
</a>></p>
174 <table border=
"0" width=
"100%" cellspacing=
"0" cellpadding=
"3">
175 <tr><td class=
"block" style=
"background-color: #cccccc" valign=
"middle">
176 <big><strong><span class=
"block"> ExtUtils::Packlist - manage .packlist files
</span></strong></big>