xref: /openbsd-src/gnu/usr.bin/perl/dist/IO/IO.pm (revision 3d61058aa5c692477b6d18acfbbdb653a9930ff9)
1b39c5158Smillert#
2b39c5158Smillert
3b39c5158Smillertpackage IO;
4b39c5158Smillert
5b39c5158Smillertuse XSLoader ();
6b39c5158Smillertuse Carp;
7b39c5158Smillertuse strict;
8b39c5158Smillertuse warnings;
9b39c5158Smillert
10*3d61058aSafresh1our $VERSION = "1.55";
11b39c5158SmillertXSLoader::load 'IO', $VERSION;
12b39c5158Smillert
13b39c5158Smillertsub import {
14b39c5158Smillert    shift;
15b39c5158Smillert
16b39c5158Smillert    warnings::warnif('deprecated', qq{Parameterless "use IO" deprecated})
17b39c5158Smillert        if @_ == 0 ;
18b39c5158Smillert
19b39c5158Smillert    my @l = @_ ? @_ : qw(Handle Seekable File Pipe Socket Dir);
20b39c5158Smillert
210b7734b3Safresh1    local @INC = @INC;
220b7734b3Safresh1    pop @INC if $INC[-1] eq '.';
23b39c5158Smillert    eval join("", map { "require IO::" . (/(\w+)/)[0] . ";\n" } @l)
24b39c5158Smillert	or croak $@;
25b39c5158Smillert}
26b39c5158Smillert
27b39c5158Smillert1;
28b39c5158Smillert
29b39c5158Smillert__END__
30b39c5158Smillert
31b39c5158Smillert=head1 NAME
32b39c5158Smillert
33b39c5158SmillertIO - load various IO modules
34b39c5158Smillert
35b39c5158Smillert=head1 SYNOPSIS
36b39c5158Smillert
37b39c5158Smillert   use IO qw(Handle File); # loads IO modules, here IO::Handle, IO::File
38b39c5158Smillert   use IO;                 # DEPRECATED
39b39c5158Smillert
40b39c5158Smillert=head1 DESCRIPTION
41b39c5158Smillert
42b39c5158SmillertC<IO> provides a simple mechanism to load several of the IO modules
43b39c5158Smillertin one go.  The IO modules belonging to the core are:
44b39c5158Smillert
45b39c5158Smillert      IO::Handle
46b39c5158Smillert      IO::Seekable
47b39c5158Smillert      IO::File
48b39c5158Smillert      IO::Pipe
49b39c5158Smillert      IO::Socket
50b39c5158Smillert      IO::Dir
51b39c5158Smillert      IO::Select
52b39c5158Smillert      IO::Poll
53b39c5158Smillert
54b39c5158SmillertSome other IO modules don't belong to the perl core but can be loaded
55b39c5158Smillertas well if they have been installed from CPAN.  You can discover which
56eac174f2Safresh1ones exist with this query:  L<https://metacpan.org/search?q=IO%3A%3A>.
57b39c5158Smillert
58b39c5158SmillertFor more information on any of these modules, please see its respective
59b39c5158Smillertdocumentation.
60b39c5158Smillert
61b39c5158Smillert=head1 DEPRECATED
62b39c5158Smillert
63b39c5158Smillert    use IO;                # loads all the modules listed below
64b39c5158Smillert
65b39c5158SmillertThe loaded modules are IO::Handle, IO::Seekable, IO::File, IO::Pipe,
66b39c5158SmillertIO::Socket, IO::Dir.  You should instead explicitly import the IO
67b39c5158Smillertmodules you want.
68b39c5158Smillert
69b39c5158Smillert=cut
70b39c5158Smillert
71