1Net::SFTP::Foreign::AttUrsiebrutCeosn(t3r)ibuted Perl DoNceutm:e:nStFaTtPi:o:nForeign::Attributes(3)
2
3
4

NAME

6       Net::SFTP::Foreign::Attributes - File/directory attribute container
7

SYNOPSIS

9           use Net::SFTP::Foreign;
10
11           my $a1 = Net::SFTP::Foreign::Attributes->new();
12           $a1->set_size($size);
13           $a1->set_ugid($uid, $gid);
14
15           my $a2 = $sftp->stat($file)
16               or die "remote stat command failed: ".$sftp->status;
17
18           my $size = $a2->size;
19           my $mtime = $a2->mtime;
20

DESCRIPTION

22       Net::SFTP::Foreign::Attributes encapsulates file/directory attributes
23       for Net::SFTP::Foreign. It also provides serialization and
24       deserialization methods to encode/decode attributes into
25       Net::SFTP::Foreign::Buffer objects.
26

USAGE

28       Net::SFTP::Foreign::Attributes->new()
29           Returns a new "Net::SFTP::Foreign::Attributes" object.
30
31       Net::SFTP::Foreign::Attributes->new_from_buffer($buffer)
32           Creates a new attributes object and populates it with information
33           read from $buffer.
34
35       $attrs->as_buffer
36           Serializes the Attributes object $attrs into a buffer object.
37
38       $attrs->flags
39           returns the value of the flags field.
40
41       $attrs->size
42           returns the values of the size field or undef if it is not set.
43
44       $attrs->uid
45           returns the value of the uid field or undef if it is not set.
46
47       $attrs->gid
48           returns the value of the gid field or undef if it is not set.
49
50       $attrs->perm
51           returns the value of the permissions field or undef if it is not
52           set.
53
54           See also "stat" in perlfunc for instructions on how to process the
55           returned value with the Fcntl module.
56
57           For instance, the following code checks if some attributes object
58           corresponds to a directory:
59
60             use Fcntl qw(S_ISDIR);
61             ...
62             if (S_ISDIR($attr->perm)) {
63               # it is a directory!
64             }
65
66       $attrs->atime
67           returns the value of the atime field or undef if it is not set.
68
69       $attrs->mtime
70           returns the value of the mtime field or undef if it is not set.
71
72       %extended = $attr->extended
73           returns the vendor-dependent extended attributes
74
75       $attrs->set_size($size)
76           sets the value of the size field, or if $size is undef removes the
77           field. The flags field is adjusted accordingly.
78
79       $attrs->set_perm($perm)
80           sets the value of the permissions field or removes it if the value
81           is undefined. The flags field is also adjusted.
82
83       $attr->set_ugid($uid, $gid)
84           sets the values of the uid and gid fields, or removes them if they
85           are undefined values. The flags field is adjusted.
86
87           This pair of fields can not be set separately because they share
88           the same bit on the flags field and so both have to be set or not.
89
90       $attr->set_amtime($atime, $mtime)
91           sets the values of the atime and mtime fields or remove them if
92           they are undefined values. The flags field is also adjusted.
93
94       $attr->set_extended(%extended)
95           sets the vendor-dependent extended attributes
96
97       $attr->append_extended(%more_extended)
98           adds more pairs to the list of vendor-dependent extended attributes
99
101       Copyright (c) 2006-2008 Salvador FandiƱo.
102
103       All rights reserved.  This program is free software; you can
104       redistribute it and/or modify it under the same terms as Perl itself.
105
106
107
108perl v5.36.0                      2023-01-20 Net::SFTP::Foreign::Attributes(3)
Impressum