Skip to content

Commit e87e534

Browse files
author
Geoffrey Broadwell
committed
Merge branch 'master' of https://github.com/perl6/doc
2 parents 64385e5 + 5efa369 commit e87e534

File tree

3 files changed

+80
-1
lines changed

3 files changed

+80
-1
lines changed

lib/Type/IO.pod

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,30 @@ L<umask|http://en.wikipedia.org/wiki/Umask>).
6262
Throws an excpetion of type L<X::IO::Mkdir|/type/X::IO::Mkdir> if the
6363
directory cannot be created.
6464
65+
=head2 sub run
66+
67+
sub run(*@args ($, *@)) returns Proc::Status:D
68+
69+
Runs an external command without involving a shell (if possible). Expects the
70+
command and each of its command line arguments as a list.
71+
72+
The return value is of L<type Proc::Status|/type/Proc::Status>.
73+
74+
run 'systemctl', 'restart', 'apache2'
75+
76+
Arguments are not subject to shell expansions, shell variable interpolation or
77+
other shenanigans. See L<#sub shell> if you want that.
78+
79+
=head2 sub shell
80+
81+
sub shell($cmd) returns Proc::Status:D
82+
83+
Runs a command through the system shell. All shell meta characters are
84+
interpreted by the shell, inluding pipes, redirects, environment variable
85+
substitutions and so on. See L<#sub run> if you don't want that.
86+
87+
The return value is of L<type Proc::Status|/type/Proc::Status>.
88+
89+
shell 'ls -lR | gzip -9 > ls-lR.gz';
90+
6591
=end pod

lib/Type/Metamodel/MROBasedMethodDispatch.pod

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,18 @@ VM-specific sentinel value (typically a low-level NULL value).
2121
2222
If C<:no_fallback> is supplied, fallback methods are not considered.
2323
24+
=head2 method find_method_qualified
25+
26+
method find_method(Metamodel::MROBasedMethodDispatch:D: $obj, $type, $name)
27+
28+
Given a method name and a type, returns the method from that type. This is
29+
used in calls like
30+
31+
self.SomeParentClass::the_method();
32+
2433
=begin comment
2534
26-
TODO: find_method_qualified, publish_method_cache
35+
TODO: publish_method_cache
2736
2837
=end comment
2938

lib/Type/Proc/Status.pod

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
=begin pod
2+
3+
=TITLE class Proc::Status
4+
5+
=SUBTITLE Information about the status of externally run programs.
6+
7+
class Proc::Status { ... }
8+
9+
L<run()|/type/IO#sub run> and L<shell()|/type/IO#sub shell> return a
10+
C<Proc::Status> object:
11+
12+
my $status = run 'false'; # most UNIXes have a /bin/false
13+
say $status.exit; # 1
14+
say $status.signal; # 0 (which means: not killed by a signal)
15+
16+
=head1 Methods
17+
18+
=head2 method exit
19+
20+
method exit(Proc::Status:D:) returns Int:D
21+
22+
Returns the numeric exit code from the program.
23+
24+
=head2 method signal
25+
26+
method signal(Proc::Status:D:) returns Int:D
27+
28+
Returns the numeric signal which caused the program to terminate, or 0 if this
29+
wasn't the case. You can compare that to elements of the C<Signal> enum, for
30+
example:
31+
32+
given $status {
33+
when Signal::SIGSEGV { say "Use a memory-safe language next time!" }
34+
when Signal::SIGPIPE { say "Pipe broken, call a plumber!" }
35+
}
36+
37+
=head2 method pid
38+
39+
method pid(Proc::Status:D:)
40+
41+
Returns the PID (process identifier) from the external program, or an
42+
undefined value if that isn't known.
43+
44+
=end pod

0 commit comments

Comments
 (0)