The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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 field.

This field is a class 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 "class_name" field.

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