Skip to content

Commit 67e3181

Browse files
committed
modules are fun
1 parent 5f90cb8 commit 67e3181

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed

.proverc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-It/lib

t/00-cli.t

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
use strict;
22
use warnings qw\ all \;
3+
use Bashon;
34
use Test::More;
4-
use Cwd qw\ cwd \;
5-
6-
sub bashon {
7-
my $cmd = shift;
8-
qx{/usr/bin/env /bin/bash --noprofile --norc -c '. bashon.sh;$cmd'}
9-
}
105

116
is(bashon('printf %s salut'), 'salut', 'sourcing bashon.sh works');
127

t/01-types.t

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
use strict;
22
use warnings qw\ all \;
3+
use Bashon;
34
use Test::More;
45

5-
sub bashon {
6-
my $cmd = shift;
7-
qx{/usr/bin/env /bin/bash --noprofile --rcfile ../bashon.sh -c '$cmd'}
8-
}
9-
106
subtest 'null' => sub {
117
plan tests => 1;
128

t/lib/Bashon.pm

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package Bashon;
2+
3+
use strict;
4+
use warnings qw\ all \;
5+
6+
BEGIN {
7+
require Exporter;
8+
9+
our @ISA = qw\ Exporter \;
10+
our @EXPORT = qw\ bashon \;
11+
}
12+
13+
our sub bashon {
14+
my $cmd = shift;
15+
qx{/usr/bin/env /bin/bash --noprofile --norc -c '. bashon.sh;$cmd'}
16+
}
17+
18+
1;

0 commit comments

Comments
 (0)