The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

Name

spvm - Executing SPVM programs

Description

The spvm command executes SPVM programs.

Usage

Usage: spvm [OPTIONS] SCRIPT_NAME
spvm myapp.spvm
Options:
-h, --help Shows this message
-v, --version Shows the version
-I, --include-dir DIRECTORY Adds a include directory
-B, --build-dir DIRECTORY Build diretory
-e SOURCE Executes a program source code in main method.
-c Check syntx only

Details

spvm [OPTIONS] SCRIPT_NAME

The spvm command executes a SPVM program.

OPTIONS are options.

SCRIPT_NAME is a script name that contains a bootstrap method in an anon class.

class {
static method main : void () {
}
}

See Class Search Directories about default class search directories.

See SPVM::Document::EnvironmentVariables about available environment variables.

Options

--help

Outputs how to use the spvm command to standard output.

-h

-h

Same as "--help".

--version

Outputs the version of the spvm command to standard output. This version is the same as the version of SPVM.

-v

-v

Same as "--version".

--include-dir

--include-dir DIRECTORY

Prepends DIRECTORY to class search directories

This option can be specified multiple times.

--include-dir dir1 --include-dir dir2

In this case, class search directories becomes the following.

[dir1, dir2, default_dirs]

-I

-I DIRECTORY

Same as "--include-dir".

--build-dir

--build-dir DIRECTORY

Sets SPVM_BUILD_DIR environment variable to DIRECTORY.

-B

-B DIRECTORY

Same as "--build-dir".

-E

-E SOURCE

Executes a source code SOURCE.

Examples:

spvm -E 'class { static method main : void () { say "Hello World!"; } }';

-e

-e SOURCE

Executes a source code SOURCE in main method.

Examples:

spvm -e 'say "Hello World!";';

-c

-c

Checks syntax only.

-w

-w

Enables warning flag.

Implementation:

Sets CommandInfo#WARNING class variable to 1.

lib Directive

If the source code specified by SCRIPT_NAME, -E, or -e option contains lib directives, The directories specified by lib directive is prepeneded to class search directories.

#lib "$FindBin::Bin/lib"
class {
}

This directories specified by lib directive is placed after the directories specified by "--include-dir" option.

Copyright & License

Copyright 2023 Yuki Kimoto. All Rights Reserved.

MIT License.