GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Net::SFTP::Foreign::Attributes(3) User Contributed Perl Documentation Net::SFTP::Foreign::Attributes(3)

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

    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;

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

Net::SFTP::Foreign::Attributes->new()
Returns a new "Net::SFTP::Foreign::Attributes" object.
Net::SFTP::Foreign::Attributes->new_from_buffer($buffer)
Creates a new attributes object and populates it with information read from $buffer.
$attrs->as_buffer
Serializes the Attributes object $attrs into a buffer object.
$attrs->flags
returns the value of the flags field.
$attrs->size
returns the values of the size field or undef if it is not set.
$attrs->uid
returns the value of the uid field or undef if it is not set.
$attrs->gid
returns the value of the gid field or undef if it is not set.
$attrs->perm
returns the value of the permissions field or undef if it is not set.

See also "stat" in perlfunc for instructions on how to process the returned value with the Fcntl module.

For instance, the following code checks if some attributes object corresponds to a directory:

  use Fcntl qw(S_ISDIR);
  ...
  if (S_ISDIR($attr->perm)) {
    # it is a directory!
  }
    
$attrs->atime
returns the value of the atime field or undef if it is not set.
$attrs->mtime
returns the value of the mtime field or undef if it is not set.
%extended = $attr->extended
returns the vendor-dependent extended attributes
$attrs->set_size($size)
sets the value of the size field, or if $size is undef removes the field. The flags field is adjusted accordingly.
$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.
$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.

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.

$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.
$attr->set_extended(%extended)
sets the vendor-dependent extended attributes
$attr->append_extended(%more_extended)
adds more pairs to the list of vendor-dependent extended attributes

Copyright (c) 2006-2008 Salvador Fandiño.

All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2019-10-04 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.