Acme-Pony-Pink

 view release on metacpan or  search on metacpan

lib/Acme/Pony/Pink.pm  view on Meta::CPAN

package Acme::Pony::Pink;

use 5.010;
use autodie;
use strict;
no warnings;
use utf8;

BEGIN {
	$Acme::Pony::Pink::AUTHORITY = 'cpan:TOBYINK';
	$Acme::Pony::Pink::VERSION   = '0.003';
}

use Carp qw<croak>;
use MIME::Base64 qw<decode_base64>;
use List::MoreUtils qw<firstidx>;

use Config;
use constant _path_to_perl => $Config{perlpath};

sub new
{
	shift;
}

sub _image
{
	state $image = do {
		local $/ = <DATA>;
		decode_base64($/);
	};
	return $image;
}

sub _find_shebang
{
	my ($class, $lines) = @_;
	
	my $idx = firstidx { /^\#\!.*\bperl\b/ } @$lines;
	return if $idx < 0; # no shebang
	
	# look for code before shebang... that's not a real shebang
	for (0 .. $idx)
	{
		next if $lines->[$_] =~ m{^\s*#};
		next if $lines->[$_] =~ m{^\s*$};
		return;
	}
	
	return $lines->[$idx];
}

sub _filehandle
{
	my ($class, $args, $mode) = @_;
	return unless @$args;
	$mode //= '<';
	
	my $arg = shift @$args;
	my $fh;
	
	if (ref $arg eq 'SCALAR')
		{ open $fh, $mode, \$arg }
	elsif (!ref $arg)
		{ open $fh, $mode, $arg }
	else
		{ $fh = $arg }



( run in 0.455 second using v1.01-cache-2.11-cpan-524268b4103 )