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
Connector::Builtin::File::Path(3) User Contributed Perl Documentation Connector::Builtin::File::Path(3)

Connector::Builtin::File::Path

Highly configurable file writer/reader.

LOCATION
The base directory where the files are located. This parameter is mandatory.
file/path
Pattern for Template Toolkit to build the filename. The path components are available in the key ARGS. In set mode the unfiltered data is available in key DATA.

See also Connector::Role::LocalPath

content
Pattern for Template Toolkit to build the content. The data is passed "as is". If data is a scalar, it is wrapped into a hash using DATA as key.
ifexists
  • append: opens the file for appending write.
  • fail: call "die"
  • silent: fail silently.
  • replace: replace the file with the new content.
mode
Filesystem permissions to apply to the file when a file is written using the set method. Must be given in octal notation, e.g. 0644. Default is to not set the permissions and rely on the systems umask.
user / group
Name of a user / group that the file should belong to.

Write data to a file.

    $conn->set('filename', { NAME => 'Oliver', 'ROLE' => 'Administrator' });

See the file parameter how to control the filename. By default, files are silently overwritten if they exist. See the ifexists parameter for an alternative behaviour.

Fetch data from a file. See the file parameter how to control the filename.

    my $data = $conn->get('filename');

    my $conn = Connector::Builtin::File::Path->new({
       LOCATION: /var/data/
       file: [% ARGS.0 %].txt
       content: Hello [% NAME %]
    });

    $conn->set('test', { NAME => 'Oliver' });

Results in a file /var/data/test.txt with the content Hello Oliver.

2022-02-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.