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...
Parrott asked 24/11, 2016 at 5:48

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...
Popup asked 29/4, 2013 at 21:50

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...
Gynandry asked 26/3, 2015 at 14:39

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...
Agamemnon asked 20/2, 2012 at 17:12

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...
Geostrophic asked 15/7, 2009 at 13:10
1

© 2022 - 2024 — McMap. All rights reserved.