| 1 | package SPVM::UV::StdioContainer; | ||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 | 1; | ||
| 6 | |||
| 7 | =encoding utf8 | ||
| 8 | |||
| 9 | =head1 Name | ||
| 10 | |||
| 11 | L<SPVM::UV::StdioContainer|SPVM::UV::StdioContainer> - libuv Stdio Container | ||
| 12 | |||
| 13 | =head1 Description | ||
| 14 | |||
| 15 | C<UV::StdioContainer> class in L<SPVM> represents a stdio container used in L<libuv|https://libuv.org/> process spawning. See L<uv_stdio_container_t|https://docs.libuv.org/en/v1.x/process.html#c.uv_stdio_container_t>. | ||
| 16 | |||
| 17 | =head1 Usage | ||
| 18 | |||
| 19 | use UV::StdioContainer; | ||
| 20 | use UV::Constant as UV_C; | ||
| 21 | |||
| 22 | my $container = UV::StdioContainer->new; | ||
| 23 | $container->set_flags(UV_C->UV_INHERIT_FD); | ||
| 24 | $container->set_fd(0); | ||
| 25 | |||
| 26 | =head1 Fields | ||
| 27 | |||
| 28 | =head2 stream | ||
| 29 | |||
| 30 | C<has stream : L<UV::Handle::Stream|SPVM::UV::Handle::Stream>;> | ||
| 31 | |||
| 32 | A stream associated with this stdio container. | ||
| 33 | |||
| 34 | =head1 Class Methods | ||
| 35 | |||
| 36 | =head2 new | ||
| 37 | |||
| 38 | C<static method new : L<UV::StdioContainer|SPVM::UV::StdioContainer> ();> | ||
| 39 | |||
| 40 | Creates a new L<libuv stdio container|https://docs.libuv.org/en/v1.x/process.html#c.uv_stdio_container_t>. | ||
| 41 | |||
| 42 | =head1 Instance Methods | ||
| 43 | |||
| 44 | =head2 flags | ||
| 45 | |||
| 46 | C<method flags : int ();> | ||
| 47 | |||
| 48 | Gets the flags of the container. See L<uv_stdio_flags|https://docs.libuv.org/en/v1.x/process.html#c.uv_stdio_flags>. | ||
| 49 | |||
| 50 | =head2 set_flags | ||
| 51 | |||
| 52 | C<method set_flags : void ($flags : int);> | ||
| 53 | |||
| 54 | Sets the flags of the container. | ||
| 55 | |||
| 56 | =head2 stream | ||
| 57 | |||
| 58 | C<method stream : L<UV::Handle::Stream|SPVM::UV::Handle::Stream> ();> | ||
| 59 | |||
| 60 | Gets the stream of the container. | ||
| 61 | |||
| 62 | Exceptions: | ||
| 63 | |||
| 64 | If flags is not C<UV_CREATE_PIPE> or C<UV_INHERIT_STREAM>, an exception is thrown. | ||
| 65 | |||
| 66 | =head2 set_stream | ||
| 67 | |||
| 68 | C<method set_stream : void ($stream : L<UV::Handle::Stream|SPVM::UV::Handle::Stream>);> | ||
| 69 | |||
| 70 | Sets the stream of the container. | ||
| 71 | |||
| 72 | Exceptions: | ||
| 73 | |||
| 74 | If flags is not C<UV_CREATE_PIPE> or C<UV_INHERIT_STREAM>, an exception is thrown. | ||
| 75 | |||
| 76 | =head2 fd | ||
| 77 | |||
| 78 | C<method fd : int ();> | ||
| 79 | |||
| 80 | Gets the file descriptor of the container. | ||
| 81 | |||
| 82 | Exceptions: | ||
| 83 | |||
| 84 | If flags is not C<UV_INHERIT_FD>, an exception is thrown. | ||
| 85 | |||
| 86 | =head2 set_fd | ||
| 87 | |||
| 88 | C<method set_fd : void ($fd : int);> | ||
| 89 | |||
| 90 | Sets the file descriptor of the container. | ||
| 91 | |||
| 92 | Exceptions: | ||
| 93 | |||
| 94 | If flags is not C<UV_INHERIT_FD>, an exception is thrown. | ||
| 95 | |||
| 96 | =head2 DESTROY | ||
| 97 | |||
| 98 | C<method DESTROY : void ();> | ||
| 99 | |||
| 100 | Destroys the container and releases its resources. | ||
| 101 | |||
| 102 | =head1 Repository | ||
| 103 | |||
| 104 | Yuki Kimoto C<kimoto.yuki@gmail.com> | ||
| 105 | |||
| 106 | =head1 Copyright & License | ||
| 107 | |||
| 108 | Copyright (c) 2026 Yuki Kimoto | ||
| 109 | |||
| 110 | MIT License |