• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

lib/PerlIO/via/H03-May-2022-327135

t/H30-Jul-2015-196125

Build.PLH A D30-Jul-201554 43

ChangesH A D30-Jul-20152 KiB6845

LICENSEH A D30-Jul-201517.9 KiB380292

MANIFESTH A D30-Jul-2015272 1615

META.ymlH A D30-Jul-2015807 3332

Makefile.PLH A D30-Jul-20153.3 KiB12488

READMEH A D30-Jul-2015409 167

README.podH A D30-Jul-20151.9 KiB10362

dist.iniH A D30-Jul-20151.1 KiB7056

README

1
2
3This archive contains the distribution PerlIO-via-Timeout,
4version 0.32:
5
6  a PerlIO layer that adds read & write timeout to a handle
7
8This software is copyright (c) 2013 by Damien "dams" Krotkine.
9
10This is free software; you can redistribute it and/or modify it under
11the same terms as the Perl 5 programming language system itself.
12
13
14This README file was generated by Dist::Zilla::Plugin::Readme v5.032.
15
16

README.pod

1=pod
2
3=head1 NAME
4
5PerlIO::via::Timeout - a PerlIO layer that adds read & write timeout to a handle
6
7=head1 SYNOPSIS
8
9  use Errno qw(ETIMEDOUT);
10  use PerlIO::via::Timeout qw(:all);
11  open my $fh, '<:via(Timeout)', 'foo.html';
12
13  # set the timeout layer to be 0.5 second read timeout
14  read_timeout($fh, 0.5);
15
16  my $line = <$fh>;
17  if ($line == undef && 0+$! == ETIMEDOUT) {
18    # timed out
19    ...
20  }
21
22=head1 DESCRIPTION
23
24This package implements a PerlIO layer, that adds read / write timeout. This
25can be useful to avoid blocking while accessing a handle (file, socket, ...),
26and fail after some time.
27
28=head1 FUNCTIONS
29
30=head2 read_timeout
31
32  # set a read timeout of 2.5 seconds
33  read_timeout($fh, 2.5);
34  # get the current read timeout
35  my $secs = read_timeout($fh);
36
37Getter / setter of the read timeout value.
38
39=head2 write_timeout
40
41  # set a write timeout of 2.5 seconds
42  timeout_layer($fh)->write_timeout(2.5);
43  # get the current write timeout
44  my $secs = timeout_layer($fh)->write_timeout();
45
46Getter / setter of the write timeout value.
47
48=head2 enable_timeout
49
50  enable_timeout($fh);
51
52Equivalent to setting timeout_enabled to 1
53
54=head2 disable_timeout
55
56  timeout_layer($fh)->disable_timeout();
57
58Equivalent to setting timeout_enabled to 0
59
60=head2 timeout_enabled
61
62  # disable timeout
63  timeout_enabled($fh, 0);
64  # enable timeout
65  timeout_enabled($fh, 1);
66  # get the current status
67  my $is_enabled = timeout_enabled($fh);
68
69Getter / setter of the timeout enabled flag.
70
71=head1 SEE ALSO
72
73=over
74
75=item L<PerlIO::via>
76
77=back
78
79=head1 THANKS TO
80
81=over
82
83=item Vincent Pit
84
85=item Christian Hansen
86
87=item Leon Timmmermans
88
89=back
90
91=head1 AUTHOR
92
93Damien "dams" Krotkine
94
95=head1 COPYRIGHT AND LICENSE
96
97This software is copyright (c) 2013 by Damien "dams" Krotkine.
98
99This is free software; you can redistribute it and/or modify it under
100the same terms as the Perl 5 programming language system itself.
101
102=cut
103