App-Sqitch
view release on metacpan or search on metacpan
lib/App/Sqitch.pm view on Meta::CPAN
has pager => (
is => 'ro',
lazy => 1,
isa => declare('Pager', where {
eval { $_->isa('IO::Pager') || $_->isa('IO::Handle') }
}),
default => sub {
# Dupe and configure STDOUT.
require IO::Handle;
my $fh = IO::Handle->new_from_fd(*STDOUT, 'w');
binmode $fh, ':utf8_strict';
# Just return if no pager is wanted or there is no TTY.
return $fh if shift->options->{no_pager} || !(-t *STDOUT);
# Load IO::Pager and tie the handle to it.
eval "use IO::Pager 0.34"; die $@ if $@;
return IO::Pager->new($fh, ':utf8_strict');
},
);
lib/App/Sqitch/Command/show.pm view on Meta::CPAN
unless (-e $path) {
return if $self->exists_only;
hurl show => __x('File "{path}" does not exist', path => $path);
}
hurl show => __x('"{path}" is not a file', path => $path)
if $path->is_dir;
return $self if $self->exists_only;
# Assume nothing about the encoding.
binmode STDOUT, ':raw';
$self->emit( $path->slurp(iomode => '<:raw') );
return $self;
}
1;
__END__
=head1 Name
lib/App/Sqitch/Plan/Line.pm view on Meta::CPAN
}
sub request_note {
my ( $self, %p ) = @_;
my $note = $self->note // '';
return $note if $note =~ /\S/;
# Edit in a file.
require File::Temp;
my $tmp = File::Temp->new;
binmode $tmp, ':utf8_strict';
( my $prompt = $self->note_prompt(%p) ) =~ s/^/# /gms;
$tmp->print( "\n", $prompt, "\n" );
$tmp->close;
my $sqitch = $self->sqitch;
$sqitch->shell( $sqitch->editor . ' ' . $sqitch->quote_shell($tmp) );
open my $fh, '<:utf8_strict', $tmp or hurl add => __x(
'Cannot open {file}: {error}',
file => $tmp,
( run in 0.855 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )