Name

SPVM::Builder::Resource - Resource

Description

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

Usage

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

Fields

class_name

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

Gets and sets the class name of the resource.

mode

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

Gets and sets the mode of the config file of the resource.

argv

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

Gets and sets the command line arguments @ARGV of the config file of the resource.

config

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

Gets and sets the config of the resource. The config is a SPVM::Builder::Config object.

Class Methods

new

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

Creates a SPVM::Builder::Resource object.

Examples:

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

Instance Methods

to_string

my $string = $resource->to_string;

Gets the string representation. This is the same as the value of "class_name".

Operators

Overloads the following operators.

bool

my $bool = !!$resource;

Always true.

stringify

my $class_name = "$resource";

The alias for the "to_string" method.

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License