App-Unding

 view release on metacpan or  search on metacpan

bin/unding  view on Meta::CPAN

#!/usr/bin/env perl
use strict;
use warnings;
# Autor: Boris Däppen, 2018
# No guarantee given, use at own risk and will

# PODNAME: unding
# ABSTRACT: dark magic, encrypted wallet

use v5.6.0;

use Cwd qw(getcwd abs_path);
use File::Copy;
use File::Path 'remove_tree';
use File::Slurp;
use Term::ReadKey;
use Data::Serializer;
#cpanm Crypt::CBC
#cpanm Crypt::Blowfish

my  $DATA_ptr;
our $old_state; # what was in DATA, when script started
our $new_state; # what should be in DATA, after script ends
our $encrypt_mode = 0;

INIT {
    $DATA_ptr = tell DATA;        # where is DATA?
    $old_state = join "", <DATA>; # slurp
}

######################################################
# --fatinit / handle special case for App::FatPacker #
######################################################

# print this file, fatpacked to STDOUT
if( defined $ARGV[0] and $ARGV[0] eq '--fatinit') {

    # try to load module App::FatPacker
    my $fatpack_loaded = eval {
          require App::FatPacker;
          App::FatPacker->import();
          1;
    };

    if($fatpack_loaded) {
        my @options = ('pack', $0);
        # fatpack this very file and exit
        App::FatPacker->new()->run_script(\@options);
        # delete caching directory
        remove_tree('fatlib');
        exit 0;
    }
    else {
        # inform user, that this option needs App::FatPacker installed
        print STDERR "You need to install App::FatPacker to use this feature\n";
        exit 1;
    }
}

#################
# --init option #
#################

if( defined $ARGV[0] and $ARGV[0] eq '--init') {
        my $cwd = getcwd;
        my $exe = abs_path($0);
        copy ($exe, $cwd);
        print STDERR "Copied $exe to $cwd for you.\n";
        print STDERR "Use your new local copy.\n";
        exit 0;
}

#########################################
# see if help needs to be given to user #
#########################################

my $help_message = <<'END_HELP';



( run in 0.930 second using v1.01-cache-2.11-cpan-df04353d9ac )