| 1 | 1 | ▶ | use strict; use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | package Module::Install::Gloom; | ||
| 3 | our $VERSION = '0.25'; | ||
| 4 | |||
| 5 | 0 | ▶ | use Module::Install::Base; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 6 | |||
| 7 | use base 'Module::Install::Base'; | ||
| 8 | |||
| 9 | our $AUTHOR_ONLY = 1; | ||
| 10 | |||
| 11 | sub use_gloom { | ||
| 12 | my $self = shift; | ||
| 13 | my $module = shift | ||
| 14 | or die "use_gloom requires the name of a target module"; | ||
| 15 | |||
| 16 | return unless $self->is_admin; | ||
| 17 | |||
| 18 | my $gloom_path = $self->admin->find_in_inc('Gloom') or return; | ||
| 19 | open IN, $gloom_path or die "Can't open '$gloom_path' for input"; | ||
| 20 | my $code = do { local $/; <IN> }; | ||
| 21 | close IN; | ||
| 22 | |||
| 23 | $code =~ s/package Gloom;/package $module;/; | ||
| 24 | |||
| 25 | my $target = $module; | ||
| 26 | $target =~ s/::/\//g; | ||
| 27 | $target = "lib/$target.pm"; | ||
| 28 | open OUT, '>', $target or die "Can't open '$target' for output"; | ||
| 29 | print OUT $code; | ||
| 30 | close OUT; | ||
| 31 | } | ||
| 32 | |||
| 33 | 1; | ||