use IO::Socket; use MIME::Base64; use strict; use warnings; my $credentials = encode_base64("peip:930612"); my $conn = new IO::Socket::INET(Proto => "tcp", PeerAddr => "localhost", PeerPort => 8080) || die "dead"; my $req; if ($ARGV[0] eq "remove") { $req = "GET http://localhost:8080/manager/remove?path=/hello1 HTTP/1.1\r\n"; $req .= "Authorization: Basic " . $credentials . "\r\n"; $req .= "Host: localhost:8080\r\n\r\n"; } elsif ($ARGV[0] eq "install") { $req = "GET http://localhost:8080/manager/install?path=/hello1&war=jar:file:/jwsdp/webapps/jwstutorial13/examples/web/hello1/dist/hello1.war!/ HTTP/1.1\r\n"; $req .= "Authorization: Basic " . $credentials . "\r\n"; $req .= "Host: localhost:8080\r\n\r\n"; } print $conn $req; while (my $line = <$conn>) { print $line; } close($conn);