1 |
sashby |
1.3 |
#____________________________________________________________________
|
2 |
|
|
# File: URL_http.pm
|
3 |
|
|
#____________________________________________________________________
|
4 |
|
|
#
|
5 |
|
|
# Author: Shaun ASHBY <Shaun.Ashby@cern.ch>
|
6 |
|
|
# Update: 2006-02-15 18:18:04+0100
|
7 |
|
|
# Revision: $Id$
|
8 |
williamc |
1.1 |
#
|
9 |
sashby |
1.3 |
# Copyright: 2006 (C) Shaun ASHBY
|
10 |
williamc |
1.1 |
#
|
11 |
sashby |
1.3 |
#--------------------------------------------------------------------
|
12 |
|
|
package URL::URL_http;
|
13 |
|
|
|
14 |
|
|
=head1 NAME
|
15 |
|
|
|
16 |
|
|
URL::URL_http -
|
17 |
williamc |
1.1 |
|
18 |
sashby |
1.3 |
=head1 SYNOPSIS
|
19 |
|
|
|
20 |
|
|
my $obj = URL::URL_http->new();
|
21 |
williamc |
1.1 |
|
22 |
sashby |
1.3 |
=head1 DESCRIPTION
|
23 |
|
|
|
24 |
|
|
=head1 METHODS
|
25 |
|
|
|
26 |
|
|
=over
|
27 |
|
|
|
28 |
|
|
=cut
|
29 |
|
|
|
30 |
|
|
use URL::URL_base;
|
31 |
|
|
use Cwd;
|
32 |
|
|
use Exporter;
|
33 |
|
|
require 5.004;
|
34 |
|
|
|
35 |
|
|
@ISA = qw(Exporter URL::URL_base);
|
36 |
|
|
|
37 |
|
|
sub init()
|
38 |
|
|
{
|
39 |
|
|
###############################################################
|
40 |
|
|
# init #
|
41 |
|
|
###############################################################
|
42 |
|
|
# modified : Wed Feb 15 18:18:18 2006 / SFA #
|
43 |
|
|
# params : #
|
44 |
|
|
# : #
|
45 |
|
|
# function : #
|
46 |
|
|
# : #
|
47 |
|
|
###############################################################
|
48 |
|
|
my $self=shift;
|
49 |
|
|
$self->{webget}="wget";
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
sub get()
|
53 |
|
|
{
|
54 |
|
|
my $self=shift;
|
55 |
|
|
my ($urlobject, $location)=@_;
|
56 |
|
|
my $rv="";
|
57 |
|
|
|
58 |
|
|
use LWP::Simple qw(&getstore);
|
59 |
|
|
use File::Basename;
|
60 |
|
|
my ($dir,$dirname)=($location=~/(.*)\/(.*)/);
|
61 |
|
|
|
62 |
|
|
require Utilities::AddDir;
|
63 |
|
|
if ( $dir ne $location )
|
64 |
|
|
{
|
65 |
|
|
AddDir::adddir($dir);
|
66 |
|
|
}
|
67 |
|
|
|
68 |
|
|
my @cvscmd=($self->{cvsco});
|
69 |
|
|
my $version=$url->param('version');
|
70 |
|
|
my $module;
|
71 |
|
|
($module=$url->param('module'))=~s/\/$//;
|
72 |
|
|
my $filename="";
|
73 |
|
|
if ( $module=~/\/.?/ )
|
74 |
|
|
{
|
75 |
|
|
($filename=$module)=~s/.*\///;
|
76 |
|
|
}
|
77 |
|
|
|
78 |
|
|
push @cvscmd, ("-d", "$dirname");
|
79 |
|
|
if ( $version && ($version ne "") )
|
80 |
|
|
{
|
81 |
|
|
push @cvscmd, ("-r", "$version");
|
82 |
|
|
}
|
83 |
|
|
|
84 |
|
|
return $rv;
|
85 |
|
|
}
|
86 |
sashby |
1.2 |
# my $http_response_val = &getstore($toolurl, $filename);
|
87 |
|
|
|
88 |
|
|
# Check the HTTP status. If doc not found, exit:
|
89 |
|
|
# if ($http_response_val != 200)
|
90 |
|
|
# {
|
91 |
|
|
# my ($server,$doc) = ($urlv =~ m|//(.*?)/(.*)|);
|
92 |
|
|
# $::scram->scramerror("Unable to set up $toolname: $doc not found on $server!");
|
93 |
|
|
# }
|
94 |
|
|
# else
|
95 |
|
|
# {
|
96 |
|
|
# $toolfile=$filename;
|
97 |
|
|
# }
|
98 |
|
|
|
99 |
|
|
1;
|
100 |
sashby |
1.3 |
|
101 |
|
|
__END__
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
=back
|
105 |
|
|
|
106 |
|
|
=head1 AUTHOR/MAINTAINER
|
107 |
|
|
|
108 |
|
|
Shaun ASHBY
|
109 |
|
|
|
110 |
|
|
=cut
|
111 |
|
|
|