#!/usr/bin/perl

use strict;
use warnings;

use Ernad::Erimp;

my $impna=$ARGV[0] // '';
if(not $impna) {
  print "I can't do without an impna here.\n";
  exit;
}

my $target_file=$ARGV[1] // '';
if(not $target_file) {
  print "I can't do without a target here.\n";
  exit;
}

our $e=Ernad::Erimp->new({'impna'=>$impna});
if(not $e) {
  print "I don't like you impna $impna.\n";
  exit;
}

my $status=$e->{'t'}->t($e->{'r'}->assemble(),'apache_editors',$target_file);
if($status) {
  system("sudo service apache2 force-reload > /dev/null");
}
