This commit is contained in:
zyppe 2024-08-08 14:28:16 +08:00
parent a4ea373e0d
commit e6bc578e11
3 changed files with 14 additions and 11 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.idea/

View file

@ -1,3 +0,0 @@
# tools
Tools for Project

View file

@ -1,17 +1,22 @@
#!/usr/bin/perl
use strict;
use warnings;
use v5.10;
use Parse::RPM::Spec;
use LWP::UserAgent ();
use HTTP::Tiny;
my $spec = Parse::RPM::Spec->new( { file => @ARGV } );
say $spec->name;
my $url = $spec->url;
my $response = LWP::UserAgent->new( timeout => 10 )->get($url);
if ($response->is_success) {
print $response->decoded_content;
print $spec->name . "\n";
my $url = $spec->url();
say $url;
my $response = HTTP::Tiny->new( timeout => 10 )->get($url);
if ( $response->{status} == 200 ) {
if ( $response->{url} ne $url ) {
say "302 Redirect. Redirect to";
say $response->{url};
}
}
else {
die $response->status_line;
}
say "Cannot get! Status " . $response->{status};
}