The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Name

SPVM::Builder::Resource - Resource

Description

The SPVM::Builder::Resource class has methods to manipulate resources.

Usage

my $resource = SPVM::Builder::Resource->new(
  class_name => 'Resource::Zlib',
  mode => 'high_performance',
  argv => ['foo', 'bar'],
);

Details

See SPVM::Document::Resource about creating and using resources.

Fields

class_name

my $class_name = $resource->class_name;
$resource->class_name($class_name);

Gets and sets the class_name field, the class name of this resource.

mode

my $mode = $resource->mode;
$resource->mode($mode);

Gets and sets the mode field, the mode of the config file of this resource.

argv

my $argv = $resource->argv;
$resource->argv($argv);

Gets and sets the argv field, an array reference of command line arguments @ARGV given to the config file of this resource.

config

my $config = $resource->config;
$resource->config($config);

Gets and sets the config field, an SPVM::Builder::Config object.

Class Methods

new

my $resource = SPVM::Builder::Resource->new(%fields);

Creates a new SPVM::Builder::Resource object with "Fields".

Field Default Values:

Instance Methods

to_string

my $string = $resource->to_string;

Returns "class_name" field.

Operators

Overloads the following operators.

bool

my $bool = !!$resource;

Always true.

stringify

my $class_name = "$resource";

The alias for "to_string" method.

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License