Re: [PATCH] Warning on pararameterless 'use IO' and doc update
[p5sagit/p5-mst-13.2.git] / ext / IO / IO.pm
1 #
2
3 package IO;
4
5 use XSLoader ();
6 use Carp;
7
8 $VERSION = "1.20";
9 XSLoader::load 'IO', $VERSION;
10
11 sub import {
12     shift;
13     warnings::warn('all', qq|parameterless "use IO" deprecated|)
14         if defined &warnings::warn && warnings::enabled('all');
15     my @l = @_ ? @_ : qw(Handle Seekable File Pipe Socket Dir);
16
17     eval join("", map { "require IO::" . (/(\w+)/)[0] . ";\n" } @l)
18         or croak $@;
19 }
20
21 1;
22
23 __END__
24
25 =head1 NAME
26
27 IO - load various IO modules
28
29 =head1 SYNOPSIS
30
31     use IO qw(Handle File);  # loads IO modules, here IO::Handle, IO::File
32     use IO;                  # DEPRECATED
33
34 =head1 DESCRIPTION
35
36 C<IO> provides a simple mechanism to load several of the IO modules
37 in one go.  The IO modules belonging to the core are:
38
39       IO::Handle
40       IO::Seekable
41       IO::File
42       IO::Pipe
43       IO::Socket
44       IO::Dir
45       IO::Select
46       IO::Poll
47
48 Some other IO modules don't belong to the perl core but can be loaded
49 as well if they have been installed from CPAN.  You can discover which
50 ones exist by searching for "^IO::" on http://search.cpan.org.
51
52 For more information on any of these modules, please see its respective
53 documentation.
54
55 =head1 DEPRECATED
56
57     use IO;                # loads all the modules listed below
58
59 The loaded modules are IO::Handle, IO::Seekable, IO::File, IO::Pipe,
60 IO::Socket, IO::Dir.  You should instead explicitly import the IO
61 modules you want.
62
63 =cut
64