Skip to content

Instantly share code, notes, and snippets.

@yappo
Last active December 22, 2015 08:48
Show Gist options
  • Save yappo/6447138 to your computer and use it in GitHub Desktop.
Save yappo/6447138 to your computer and use it in GitHub Desktop.
smart script
requires 'Acme::Hidek' => '43';
#!/usr/bin/env perl
use strict;
use warnings FATAL => 'all';
use utf8;
use lib;
use Config;
use Cwd 'getcwd';
use File::Spec;
use FindBin;
BEGIN {
my $carton_version = `carton -v`;
die 'please install carton 1.0.0 higher' if !$carton_version || $carton_version =~ /\Av0\./;
my $cwd = getcwd();
chdir $FindBin::Bin;
!system 'carton', 'install' or die $;
!system 'carton', 'check' or die $?;
chdir $cwd;
@INC = @Config{qw(privlibexp archlibexp)}; # same as a lib::core::only
lib->import(
File::Spec->catfile($FindBin::Bin, 'lib'),
File::Spec->catfile($FindBin::Bin, 'local', 'lib', 'perl5')
);
}
# write your awesome code!
use Acme::Hidek;
my $hidek = Acme::Hidek->new();
$hidek->we_love_hidek;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment