summaryrefslogtreecommitdiffabout
path: root/slackbuilder
authorSergey Poznyakoff <gray@gnu.org.ua>2019-03-20 12:50:47 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2019-03-20 13:57:30 (GMT)
commita297c865dd4611c4fd862e59c70ba1b72a142035 (patch) (side-by-side diff)
tree1751891a3b93a8ce8a2260e0be9ddf8d9e90f6a0 /slackbuilder
parenta6040f631367a33f4e96759ce6ceefb759303f25 (diff)
downloadslackbuilder-a297c865dd4611c4fd862e59c70ba1b72a142035.tar.gz
slackbuilder-a297c865dd4611c4fd862e59c70ba1b72a142035.tar.bz2
Rewrite request loader.v1.0-
* lib/SlackBuild/Request.pm (load): New method. (new): Fall back to load() if given one argument. * lib/SlackBuild/Request/Auto.pm: Remove. * lib/SlackBuild/Request/Loader/dir.pm: New file. * lib/SlackBuild/Request/Loader/file.pm: New file. * lib/SlackBuild/Request/Loader/sbo.pm: New file. * lib/SlackBuild/Request/Loader/url.pm: New file. * slackbuilder: Use SlackBuild::Request->new instead of SlackBuild::Request::Auto->new * t/request.t: More tests.
Diffstat (limited to 'slackbuilder') (more/less context) (ignore whitespace changes)
-rwxr-xr-xslackbuilder13
1 files changed, 2 insertions, 11 deletions
diff --git a/slackbuilder b/slackbuilder
index 6e3ac47..9ad2722 100755
--- a/slackbuilder
+++ b/slackbuilder
@@ -9,7 +9,7 @@ use File::Basename;
use File::Spec;
use Unix::Sysexits;
use SlackBuilder;
-use SlackBuild::Request::Auto;
+use SlackBuild::Request;
use Net::SBo;
use JSON;
use Try::Tiny;
@@ -35,15 +35,6 @@ sub error {
print STDERR "$_{prefix}: " if defined($_{prefix});
print STDERR "$msg\n"
}
-
-sub readfile {
- my $file = shift;
- local $/ = undef;
- open(my $fd, $file) or abend(EX_NOINPUT, "can't open file $file: $!");
- my $string = <$fd>;
- close $fd;
- return decode_json($string);
-}
my %sbargs;
GetOptions("h" => sub {
@@ -64,7 +55,7 @@ GetOptions("h" => sub {
abend(EX_USAGE, "bad number of arguments") unless @ARGV == 1;
my $reqname = shift @ARGV;
my $req = try {
- new SlackBuild::Request::Auto($reqname)
+ new SlackBuild::Request($reqname)
} catch {
my $err = (split /\n/)[0];
$err =~ s{\s+at .* line \d+\.$}{};

Return to:

Send suggestions and report system problems to the System administrator.