Name

SPVM::Builder::Resource - Resource

Description

The SPVM::Builder::Resource class has methods to manipulate a resource.

Usage

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

Fields

module_name

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

Gets and sets the module_name field.

This field is a module name of a resource.

mode

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

Gets and sets the mode field.

This field is a mode of a config file of a resource.

argv

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

Gets and sets the mode field.

This field is an array reference that contains command line arguments @ARGV of a config file of a resource.

config

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

Gets and sets the config field.

This field is a a SPVM::Builder::Config object for a resource.

Class Methods

new

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

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

Default Field Values:

If a field is not defined, the field is set to the following default value.

Instance Methods

to_string

my $string = $resource->to_string;

Returns the "module_name" field.

Operators

Overloads the following operators.

bool

my $bool = !!$resource;

Always true.

stringify

my $module_name = "$resource";

The alias for the "to_string" method.

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License