| 1 | #!/usr/local/bin/perl | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 5 | ▶ | use SPVM::Global; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 5 | ▶ | use SPVM::Builder::Util; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 5 | SPVM::Builder::Util::getopt | |||||||||||||||||||||||||||||||||||||||||
| 10 | # spvm,spvmcc,spvmdeps common | ||||||||||||||||||||||||||||||||||||||||||
| 11 | 'h|help' => \my $help, | ||||||||||||||||||||||||||||||||||||||||||
| 12 | 'v|version' => \my $show_version, | ||||||||||||||||||||||||||||||||||||||||||
| 13 | 'I=s' => \my @spvm_include_dirs, | ||||||||||||||||||||||||||||||||||||||||||
| 14 | 'Mblib' => \my $blib, | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | # spvm,spvmcc common | ||||||||||||||||||||||||||||||||||||||||||
| 17 | 'B|build-dir=s' => \my $build_dir, | ||||||||||||||||||||||||||||||||||||||||||
| 18 | 'w' => \my $warning, | ||||||||||||||||||||||||||||||||||||||||||
| 19 | 'f|force' => \my $force, | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | # spvm only | ||||||||||||||||||||||||||||||||||||||||||
| 22 | 'no-quiet' => \my $no_quiet, | ||||||||||||||||||||||||||||||||||||||||||
| 23 | 'e=s' => \my $source, | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 'c' => \my $syntax_ok, | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 'M=s' => \my @use_class_names, | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 'class' => \my $script_name_is_class_name | ||||||||||||||||||||||||||||||||||||||||||
| 27 | ; | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 4 | ▶ | if ($help) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | print SPVM::Builder::Util::extract_usage; | |||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | exit 0; | |||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||
| 33 | elsif ($show_version) { | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | my $version_string = "spvm v$SPVM::VERSION"; | |||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | print "$version_string\n"; | |||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | exit 0; | |||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 4 | my $script_name = shift; | |||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 4 | ▶ | if (!defined $script_name && !defined $source && !defined $source) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
defined $script_name or defined $source or defined $source
defined $script_name or defined $source
MC/DC0%0/3
defined $script_name or defined $source or defined $source
defined $script_name
defined $source
defined $source
Truth table50%2/4
A or B or C
A= defined $script_nameB= defined $sourceC= defined $source
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | die SPVM::Builder::Util::extract_usage; | |||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 4 | ▶ | if (defined $script_name && defined $source) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $script_name and defined $source
MC/DC0%0/2
defined $script_name and defined $source
defined $script_name
defined $source
Truth table66%2/3
A and B
A= defined $script_nameB= defined $source
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | die "[spvm command]Specifying both SCRIPT_NAME and -e option is not allowed."; | |||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 4 | ▶ | if (defined $source) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 1 | $script_name = "-e"; | |||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||
| 52 | elsif (defined $script_name) { | ||||||||||||||||||||||||||||||||||||||||||
| 53 | 3 | ▶ | if ($script_name_is_class_name) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | my $class_name = $script_name; | |||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | $script_name = SPVM::Builder::Util::search_spvm_file($class_name); | |||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | unless (defined $script_name) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | die "Cannot find $class_name class in @INC"; | |||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 3 | eval { $source = SPVM::Builder::Util::slurp_binary($script_name); }; | |||||||||||||||||||||||||||||||||||||||||
| 62 | 3 | $source = "#file \"$script_name\"\x{A}$source"; | |||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | 4 | SPVM::Builder::Util::setup_spvm_command_environment($script_name, $source, $blib, \@spvm_include_dirs, $build_dir, undef, $no_quiet, $warning, $force); | |||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 4 | for my $use_class_name (@use_class_names) { | |||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | SPVM::Global::build_class($use_class_name, __FILE__, __LINE__); | |||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 4 | SPVM::Global::build_class('Native', __FILE__, __LINE__); | |||||||||||||||||||||||||||||||||||||||||
| 72 | 4 | SPVM::Global::build_class('Native::MethodCall', __FILE__, __LINE__); | |||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | 4 | my $anon_class_name = SPVM::Global::build_anon_class($source, __FILE__, __LINE__); | |||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | 3 | SPVM::Native->check_bootstrap_method($anon_class_name); | |||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 3 | my $spvm_anon_class_name = "SPVM::$anon_class_name"; | |||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | 3 | ▶ | if ($syntax_ok) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | print STDERR "syntax OK\n"; | |||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | exit 0; | |||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 3 | $spvm_anon_class_name->main; | |||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | =encoding utf8 | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | =head1 Name | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | spvm - Executing SPVM programs | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | =head1 Description | ||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | The spvm command executes SPVM programs. | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | =head1 Usage | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | Usage: spvm [OPTIONS] SCRIPT_NAME | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | spvm myapp.spvm | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | Options: | ||||||||||||||||||||||||||||||||||||||||||
| 104 | -h, --help Shows this message | ||||||||||||||||||||||||||||||||||||||||||
| 105 | -v, --version Shows the version | ||||||||||||||||||||||||||||||||||||||||||
| 106 | -I DIRECTORY Adds a include directory | ||||||||||||||||||||||||||||||||||||||||||
| 107 | -Mblib Same as "-Mblib" in perl | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | -B, --build-dir DIRECTORY Build diretory | ||||||||||||||||||||||||||||||||||||||||||
| 110 | -w Enables warning flag | ||||||||||||||||||||||||||||||||||||||||||
| 111 | -f|--force Compilations and links are forced | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | --no-quiet Shows diagnostic messages. | ||||||||||||||||||||||||||||||||||||||||||
| 114 | -e SOURCE Executes a program source code in main method. | ||||||||||||||||||||||||||||||||||||||||||
| 115 | -c Check syntx only | ||||||||||||||||||||||||||||||||||||||||||
| 116 | -M CLASS_NAME Loads the SPVM class | ||||||||||||||||||||||||||||||||||||||||||
| 117 | --class Interprets SCRIPT_NAME as a class name and searches for it | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | =head1 Details | ||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | spvm [OPTIONS] SCRIPT_NAME | ||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | The C<spvm> command executes a SPVM program. | ||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | I<OPTIONS> are L<options|/"Options">. | ||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | I<SCRIPT_NAME> is a script path that contains an SPVM script. | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | # myapp.spvm | ||||||||||||||||||||||||||||||||||||||||||
| 130 | use Fn; | ||||||||||||||||||||||||||||||||||||||||||
| 131 | my $var = 1; | ||||||||||||||||||||||||||||||||||||||||||
| 132 | say $var; | ||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | Anon class that contains a L<bootstrap method|SPVM::Document::Language::Class/"Bootstrap Method"> is allowed as an SPVM script. | ||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | # myapp.spvm | ||||||||||||||||||||||||||||||||||||||||||
| 137 | class { | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | version "1.001"; | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | our $FOO : int; | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | use Fn; | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | static method main : void () { | ||||||||||||||||||||||||||||||||||||||||||
| 146 | my $var = 1; | ||||||||||||||||||||||||||||||||||||||||||
| 147 | say $var; | ||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | The base name of I<SCRIPT_NAME> must be a L</"Script Base Name">. Otherwise an exception is thrown. | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | See L<Class Search Directories|SPVM::Document::Language::Class/"Class Search Directories"> about default class search directories. | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | See L<SPVM::Document::EnvironmentVariables> about available environment variables. | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | =head2 Script Base Name | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | A script base name ends with C<.spvm>. | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | A script base name without C<.spvm> consists of L<word characters|SPVM::Document::Language::Tokenization/"Word Characters"> and C<->. | ||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | It dose not contains C<__>. | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | It dose not begin with C<0-9>. | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | It dose not begin with C<->. | ||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||
| 169 | It dose not end with C<->. | ||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | It dose not contains C<-->. | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | Examples: | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | # Script Base Names | ||||||||||||||||||||||||||||||||||||||||||
| 176 | foo.spvm | ||||||||||||||||||||||||||||||||||||||||||
| 177 | foo_bar2.spvm | ||||||||||||||||||||||||||||||||||||||||||
| 178 | myapp-foo.spvm | ||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | # Invalid Script Base Names | ||||||||||||||||||||||||||||||||||||||||||
| 181 | 2foo.spvm | ||||||||||||||||||||||||||||||||||||||||||
| 182 | foo__bar.spvm | ||||||||||||||||||||||||||||||||||||||||||
| 183 | -myapp.spvm | ||||||||||||||||||||||||||||||||||||||||||
| 184 | myapp-.spvm | ||||||||||||||||||||||||||||||||||||||||||
| 185 | myapp--foo.spvm | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | =head1 Options | ||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | =head2 --help | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | Outputs how to use the C<spvm> command to standard output. | ||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | =head2 -h | ||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | -h | ||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | Same as L</"--help">. | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | =head2 --version | ||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | Outputs the version of the C<spvm> command to standard output. This version is the same as the version of L<SPVM>. | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | =head2 -v | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | -v | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | Same as L</"--version">. | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | =head2 -I | ||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | -I DIRECTORY | ||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | Prepends I<DIRECTORY> to L<class search directories|SPVM::Document::Language::Class/"Class Search Directories"> | ||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | This option can be specified multiple times. | ||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | -I dir1 -I dir2 | ||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | In this case, class search directories becomes the following. | ||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | [dir1, dir2, default_dirs] | ||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | =head2 -Mblib | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | -Mblib | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | Uses Perl's L<blib> module. | ||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | This is useful for testing a native module before it is installed. | ||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | When this option is specified, C<blib/lib> and C<blib/arch> are prepended to C<@INC> and the library search paths. | ||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | =head2 --build-dir | ||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | --build-dir DIRECTORY | ||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | Sets L<SPVM_BUILD_DIR|SPVM::Document::EnvironmentVariables/"SPVM_BUILD_DIR"> environment variable to I<DIRECTORY>. | ||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | =head2 -B | ||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | -B DIRECTORY | ||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | Same as L</"--build-dir">. | ||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | =head2 -w | ||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | -w | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | Enables warning flag. | ||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | Implementation: | ||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | Sets L<CommandInfo#WARNING|SPVM::CommandInfo> class variable to 1. | ||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | =head2 -f | ||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | -f | ||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | Compilations and links are forced. | ||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | =head2 --force | ||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | Same as L</"-f">. | ||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | =head2 --no-quiet | ||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||
| 267 | Shows diagnostic messages. | ||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | =head2 -e | ||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | -e SOURCE | ||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | Executes a source code I<SOURCE> in C<main> method. | ||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||
| 275 | Examples: | ||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||
| 277 | spvm -e 'say "Hello World!";'; | ||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | =head2 -c | ||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | -c | ||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||
| 283 | Checks syntax only. | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | =head2 -M | ||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | -M CLASS_NAME | ||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | Loads the SPVM class I<CLASS_NAME>. | ||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | This is useful for pre-loading classes or ensuring that a class is compiled. | ||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | This option can be specified multiple times. | ||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | spvm -MFoo -MBar myapp.spvm | ||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | Implementation: | ||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | Calls L</"build_class"> method for I<CLASS_NAME>. | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | =head2 --class | ||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | --class | ||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | Interprets I<SCRIPT_NAME> as a class name and searches for it in the class search paths. | ||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | This allows you to specify a class name directly instead of a file path. | ||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | Example: | ||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||
| 311 | spvm --class Foo::Bar | ||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | =head1 lib Directive | ||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | If the source code specified by I<SCRIPT_NAME>, or C<-e> option contains lib directives, The directories specified by lib directive is prepeneded to L<class search directories|SPVM::Document::Language::Class/"Class Search Directories">. | ||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | #lib "$FindBin::Bin/lib" | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | This directories specified by lib directive is placed after the directories specified by L</"-I"> option. | ||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | =head1 Copyright & License | ||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | Copyright 2023 Yuki Kimoto. All Rights Reserved. | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | MIT License. | ||||||||||||||||||||||||||||||||||||||||||