Sys/IO/Stat.pm untested

filter: Statementstmt n/a Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a SCAR -
1 package SPVM::Sys::IO::Stat;
2  
3 1;
4  
5 =head1 Name
6  
7 SPVM::Sys::IO::Stat - struct stat in the C language
8  
9 =head1 Description
10  
11 Sys::IO::Stat class in L<SPVM> represents C<struct stat> in the C language, and has utility methods for the structure.
12  
13 =head1 Usage
14  
15 use Sys::IO::Stat;
16
17 my $file = "foo.txt";
18 my $stat = Sys::IO::Stat->new;
19
20 Sys::IO::Stat->stat($file, $stat);
21
22 Sys::IO::Stat->lstat($file, $stat);
23
24 my $st_mode = $stat->mode;
25
26 my $st_size = $stat->size;
27  
28 =head1 Details
29  
30 This class is a pointer class. The pointer the instance has is set to a C<struct stat> object.
31  
32 =head1 Class Methods
33  
34 =head2 new
35  
36 C<static method new : L<Sys::IO::Stat|SPVM::Sys::IO::Stat> ();>
37  
38 Creates a new L<Sys::IO::Stat|SPVM::Sys::IO::Stat> object.
39  
40 =head2 stat
41  
42 C<static method stat : int ($path : string, $stat : L<Sys::IO::Stat|SPVM::Sys::IO::Stat>);>
43  
44 Calls the L<stat|https://linux.die.net/man/2/stat> function and returns its return value.
45  
46 Exceptions:
47  
48 $path must be defined. Otherwise an exception is thrown.
49  
50 $stat must be defined. Otherwise an exception is thrown.
51  
52 If the stat function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
53  
54 =head2 lstat
55  
56 C<static method lstat : int ($path : string, $stat : L<Sys::IO::Stat|SPVM::Sys::IO::Stat>);>
57  
58 Calls the L<lstat|https://linux.die.net/man/2/lstat> function and returns its return value.
59  
60 Exceptions:
61  
62 $path must be defined. Otherwise an exception is thrown.
63  
64 $stat must be defined. Otherwise an exception is thrown.
65  
66 If the lstat function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
67  
68 =head2 fstat
69  
70 C<static method fstat : int ($fd : int, $stat : L<Sys::IO::Stat|SPVM::Sys::IO::Stat>);>
71  
72 Calls the L<fstat|https://linux.die.net/man/2/fstat> function and returns its return value.
73  
74 Exceptions:
75  
76 The C<$stat> is a L<Sys::IO::Stat|SPVM::Sys::IO::Stat> object.
77  
78 $stat must be defined. Otherwise an exception is thrown.
79  
80 If the stat function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
81  
82 =head1 Instance Methods
83  
84 =head2 DESTROY
85  
86 C<method DESTROY : void ();>
87  
88 The destructor.
89  
90 =head2 st_dev
91  
92 C<method st_dev : int ();>
93  
94 Returns C<st_dev>.
95  
96 =head2 st_ino
97  
98 C<method st_ino : int ();>
99  
100 Returns C<st_ino>.
101  
102 =head2 st_mode
103  
104 C<method st_mode : int ();>
105  
106 Returns C<st_mode>.
107  
108 =head2 st_nlink
109  
110 C<method st_nlink : int ();>
111  
112 Returns C<st_nlink>.
113  
114 =head2 st_uid
115  
116 C<method st_uid : int ();>
117  
118 Returns C<st_uid>.
119  
120 =head2 st_gid
121  
122 C<method st_gid : int ();>
123  
124 Returns C<st_gid>.
125  
126 =head2 st_rdev
127  
128 C<method st_rdev : int ();>
129  
130 Returns C<st_rdev>.
131  
132 =head2 st_size
133  
134 C<method st_size : long ();>
135  
136 Returns C<st_size>.
137  
138 =head2 st_blksize
139  
140 C<method st_blksize : long ();>
141  
142 Returns C<st_blksize>.
143  
144 =head2 st_blocks
145  
146 C<method st_blocks : long ();>
147  
148 Returns C<st_blocks>.
149  
150 =head2 st_mtime
151  
152 C<method st_mtime : long ();>
153  
154 Returns C<st_mtime>.
155  
156 =head2 st_atime
157  
158 C<method st_atime : long ();>
159  
160 Returns C<st_atime>.
161  
162 =head2 st_ctime
163  
164 C<method st_ctime : long ();>
165  
166 Returns C<st_ctime>.
167  
168 =head2 st_mtim_tv_nsec
169  
170 C<method st_mtim_tv_nsec : long ();>
171  
172 Returns C<st_mtim.tv_nsec>.
173  
174 =head2 st_atim_tv_nsec
175  
176 C<method st_atim_tv_nsec : long ();>
177  
178 Returns C<st_atim.tv_nsec>.
179  
180 =head2 st_ctim_tv_nsec
181  
182 C<method st_ctim_tv_nsec : long ();>
183  
184 Returns C<st_ctim.tv_nsec>.
185  
186 =head2 A
187  
188 C<method A : double ();>
189  
190 The implementation of L<Sys#A|SPVM::Sys/"A"> method.
191  
192 =head2 C
193  
194 C<method C : double ();>
195  
196 The implementation of L<Sys#C|SPVM::Sys/"C"> method.
197  
198 =head2 M
199  
200 C<method M : double ();>
201  
202 The implementation of L<Sys#M|SPVM::Sys/"M"> method.
203  
204 =head2 O
205  
206 C<method O : int ();>
207  
208 The implementation of L<Sys#O|SPVM::Sys/"O"> method.
209  
210 =head2 S
211  
212 C<method S : int ();>
213  
214 The implementation of L<Sys#S|SPVM::Sys/"S"> method.
215  
216 =head2 b
217  
218 C<method b : int ();>
219  
220 The implementation of L<Sys#b|SPVM::Sys/"b"> method.
221  
222 =head2 c
223  
224 C<method c : int ();>
225  
226 The implementation of L<Sys#c|SPVM::Sys/"c"> method.
227  
228 =head2 d
229  
230 C<method d : int ();>
231  
232 The implementation of L<Sys#d|SPVM::Sys/"d"> method.
233  
234 =head2 e
235  
236 C<method e : int ();>
237  
238 The implementation of L<Sys#e|SPVM::Sys/"e"> method.
239  
240 =head2 f
241  
242 C<method f : int ();>
243  
244 The implementation of L<Sys#f|SPVM::Sys/"f"> method.
245  
246 =head2 g
247  
248 C<method g : int ();>
249  
250 The implementation of L<Sys#g|SPVM::Sys/"g"> method.
251  
252 =head2 k
253  
254 C<method k : int ();>
255  
256 The implementation of L<Sys#k|SPVM::Sys/"k"> method.
257  
258 =head2 l
259  
260 C<method l : int ();>
261  
262 The implementation of L<Sys#l|SPVM::Sys/"l"> method.
263  
264 =head2 o
265  
266 C<method o : int ();>
267  
268 The implementation of L<Sys#o|SPVM::Sys/"o"> method.
269  
270 =head2 p
271  
272 C<method p : int ();>
273  
274 The implementation of L<Sys#p|SPVM::Sys/"p"> method.
275  
276 =head2 s
277  
278 C<method s : long ();>
279  
280 The implementation of L<Sys#s|SPVM::Sys/"s"> method.
281  
282 =head2 u
283  
284 C<method u : int ();>
285  
286 The implementation of L<Sys#u|SPVM::Sys/"u"> method.
287  
288 =head2 z
289  
290 C<method z : int ();>
291  
292 The implementation of L<Sys#z|SPVM::Sys/"z"> method.
293  
294 =head2 r
295  
296 C<method r : int ();>
297  
298 The implementation of L<Sys#r|SPVM::Sys/"r"> method.
299  
300 =head2 w
301  
302 C<method w : int ();>
303  
304 The implementation of the L<Sys#w|SPVM::Sys/"w"> method.
305  
306 =head2 x
307  
308 C<method x : int ();>
309  
310 The implementation of L<Sys#x|SPVM::Sys/"x"> method.
311  
312 =head2 R
313  
314 C<method R : int ();>
315  
316 The implementation of L<Sys#R|SPVM::Sys/"R"> method.
317  
318 =head2 W
319  
320 C<method W : int ();>
321  
322 The implementation of L<Sys#W|SPVM::Sys/"W"> method.
323  
324 =head2 X
325  
326 C<method X : int ();>
327  
328 The implementation of L<Sys#X|SPVM::Sys/"X"> method.
329  
330 =head1 dev
331  
332 C<method dev : long ();>
333  
334 Same as L</"st_dev">.
335  
336 =head1 ino
337  
338 C<method ino : long ();>
339  
340 Same as L</"st_ino">.
341  
342 =head1 mode
343  
344 C<method mode : int ();>
345  
346 Same as L</"st_mode">.
347  
348 =head1 nlink
349  
350 C<method nlink : long ();>
351  
352 Same as L</"st_nlink">.
353  
354 =head1 uid
355  
356 C<method uid : int ();>
357  
358 Same as L</"st_uid">.
359  
360 =head1 gid
361  
362 C<method gid : int ();>
363  
364 Same as L</"st_gid">.
365  
366 =head1 rdev
367  
368 C<method rdev : long ();>
369  
370 Same as L</"st_rdev">.
371  
372 =head1 size
373  
374 C<method size : long ();>
375  
376 Same as L</"st_size">.
377  
378 =head1 blksize
379  
380 C<method blksize : long ();>
381  
382 Same as L</"st_blksize">.
383  
384 =head1 blocks
385  
386 C<method blocks : long ();>
387  
388 Same as L</"st_blocks">.
389  
390 =head1 mtime
391  
392 C<method mtime : long ();>
393  
394 Same as L</"st_mtime">.
395  
396 =head1 atime
397  
398 C<method atime : long ();>
399  
400 Same as L</"st_atime">.
401  
402 =head1 ctime
403  
404 C<method ctime : long ();>
405  
406 Same as L</"st_ctime">.
407  
408 =head1 See Also
409  
410 =over 2
411  
412 =item * L<Sys|SPVM::Sys>
413  
414 =back
415  
416 =head1 Copyright & License
417  
418 Copyright (c) 2023 Yuki Kimoto
419  
420 MIT License
421