.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Net::SFTP::Foreign::Attributes 3pm" .TH Net::SFTP::Foreign::Attributes 3pm "2021-01-23" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Net::SFTP::Foreign::Attributes \- File/directory attribute container .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Net::SFTP::Foreign; \& \& my $a1 = Net::SFTP::Foreign::Attributes\->new(); \& $a1\->set_size($size); \& $a1\->set_ugid($uid, $gid); \& \& my $a2 = $sftp\->stat($file) \& or die "remote stat command failed: ".$sftp\->status; \& \& my $size = $a2\->size; \& my $mtime = $a2\->mtime; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fINet::SFTP::Foreign::Attributes\fR encapsulates file/directory attributes for \fINet::SFTP::Foreign\fR. It also provides serialization and deserialization methods to encode/decode attributes into \&\fINet::SFTP::Foreign::Buffer\fR objects. .SH "USAGE" .IX Header "USAGE" .IP "Net::SFTP::Foreign::Attributes\->\fBnew()\fR" 4 .IX Item "Net::SFTP::Foreign::Attributes->new()" Returns a new \f(CW\*(C`Net::SFTP::Foreign::Attributes\*(C'\fR object. .IP "Net::SFTP::Foreign::Attributes\->new_from_buffer($buffer)" 4 .IX Item "Net::SFTP::Foreign::Attributes->new_from_buffer($buffer)" Creates a new attributes object and populates it with information read from \f(CW$buffer\fR. .ie n .IP "$attrs\->as_buffer" 4 .el .IP "\f(CW$attrs\fR\->as_buffer" 4 .IX Item "$attrs->as_buffer" Serializes the \fIAttributes\fR object \fI\f(CI$attrs\fI\fR into a buffer object. .ie n .IP "$attrs\->flags" 4 .el .IP "\f(CW$attrs\fR\->flags" 4 .IX Item "$attrs->flags" returns the value of the flags field. .ie n .IP "$attrs\->size" 4 .el .IP "\f(CW$attrs\fR\->size" 4 .IX Item "$attrs->size" returns the values of the size field or undef if it is not set. .ie n .IP "$attrs\->uid" 4 .el .IP "\f(CW$attrs\fR\->uid" 4 .IX Item "$attrs->uid" returns the value of the uid field or undef if it is not set. .ie n .IP "$attrs\->gid" 4 .el .IP "\f(CW$attrs\fR\->gid" 4 .IX Item "$attrs->gid" returns the value of the gid field or undef if it is not set. .ie n .IP "$attrs\->perm" 4 .el .IP "\f(CW$attrs\fR\->perm" 4 .IX Item "$attrs->perm" returns the value of the permissions field or undef if it is not set. .Sp See also \*(L"stat\*(R" in perlfunc for instructions on how to process the returned value with the Fcntl module. .Sp For instance, the following code checks if some attributes object corresponds to a directory: .Sp .Vb 5 \& use Fcntl qw(S_ISDIR); \& ... \& if (S_ISDIR($attr\->perm)) { \& # it is a directory! \& } .Ve .ie n .IP "$attrs\->atime" 4 .el .IP "\f(CW$attrs\fR\->atime" 4 .IX Item "$attrs->atime" returns the value of the atime field or undef if it is not set. .ie n .IP "$attrs\->mtime" 4 .el .IP "\f(CW$attrs\fR\->mtime" 4 .IX Item "$attrs->mtime" returns the value of the mtime field or undef if it is not set. .ie n .IP "%extended = $attr\->extended" 4 .el .IP "\f(CW%extended\fR = \f(CW$attr\fR\->extended" 4 .IX Item "%extended = $attr->extended" returns the vendor-dependent extended attributes .ie n .IP "$attrs\->set_size($size)" 4 .el .IP "\f(CW$attrs\fR\->set_size($size)" 4 .IX Item "$attrs->set_size($size)" sets the value of the size field, or if \f(CW$size\fR is undef removes the field. The flags field is adjusted accordingly. .ie n .IP "$attrs\->set_perm($perm)" 4 .el .IP "\f(CW$attrs\fR\->set_perm($perm)" 4 .IX Item "$attrs->set_perm($perm)" sets the value of the permissions field or removes it if the value is undefined. The flags field is also adjusted. .ie n .IP "$attr\->set_ugid($uid, $gid)" 4 .el .IP "\f(CW$attr\fR\->set_ugid($uid, \f(CW$gid\fR)" 4 .IX Item "$attr->set_ugid($uid, $gid)" sets the values of the uid and gid fields, or removes them if they are undefined values. The flags field is adjusted. .Sp This pair of fields can not be set separately because they share the same bit on the flags field and so both have to be set or not. .ie n .IP "$attr\->set_amtime($atime, $mtime)" 4 .el .IP "\f(CW$attr\fR\->set_amtime($atime, \f(CW$mtime\fR)" 4 .IX Item "$attr->set_amtime($atime, $mtime)" sets the values of the atime and mtime fields or remove them if they are undefined values. The flags field is also adjusted. .ie n .IP "$attr\->set_extended(%extended)" 4 .el .IP "\f(CW$attr\fR\->set_extended(%extended)" 4 .IX Item "$attr->set_extended(%extended)" sets the vendor-dependent extended attributes .ie n .IP "$attr\->append_extended(%more_extended)" 4 .el .IP "\f(CW$attr\fR\->append_extended(%more_extended)" 4 .IX Item "$attr->append_extended(%more_extended)" adds more pairs to the list of vendor-dependent extended attributes .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2006\-2008 Salvador FandiƱo. .PP All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.