modulino Questions
1
Here's a short Raku program that declare a MAIN subroutine. I should only see output if I execute the program directly:
$ cat main.rakumod
sub MAIN { say "Called as a program!" }
And I s...
3
Solved
I know Perl has a design pattern known as a modulino, in which a library module file can act as both a library and a script. Is there any equivalent to this in Ruby / Python?
I think this design pa...
1
Solved
I want to make a modulino (a file that can run as either a module or a script) in Perl6.
The following code "processes" file names from the command line:
sub MAIN ( *@filenames )
{
for @filenam...
4
Solved
I'm trying to include the unit tests for a module in the same source file as the module itself, following the Perl modulino model.
#! /usr/bin/env ruby
require 'test/unit'
module Modulino
def m...
Berrie asked 1/12, 2009 at 16:2
1
I have some scripts that I have started unit-testing using the "modulino" idea. I have encountered a problem in that when the script is called with "perl -d" the script does not run as caller() ret...
3
Solved
Let's say I have a Perl file in which there are parts I need to run only when I'm called as a script. I remember reading sometime back about including those parts in a main() method and doing a
ma...
1
© 2022 - 2024 — McMap. All rights reserved.