This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Vend 0.3.6
- Loading branch information
Showing
40 changed files
with
3,289 additions
and
2,341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Application: defines the configuration common to all applications | ||
# | ||
# $Id: Application.pm,v 1.1 1996/02/26 21:16:24 amw Exp $ | ||
# | ||
package Vend::Application; | ||
|
||
# Copyright 1996 by Andrew M. Wilcox <awilcox@world.std.com> | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
|
||
require Exporter; | ||
@ISA = qw(Exporter); | ||
@EXPORT = qw(App app_config App_directory Data_directory Perl_program); | ||
|
||
use strict; | ||
|
||
my $Config; | ||
|
||
sub App { $Config->{'App'} } | ||
sub App_directory { $Config->{'App_directory'} } | ||
sub Bin_directory { $Config->{'Bin_directory'} } | ||
sub Data_directory { $Config->{'Data_directory'} } | ||
sub Perl_program { $Config->{'Perl_program'} } | ||
|
||
sub configure { | ||
my ($class, $config) = @_; | ||
# foreach $d (qw(App App_directory Data_directory Perl_program)) { | ||
# die "The $d directive is not specified" unless defined $config->{$d}; | ||
# } | ||
$Config = $config; | ||
} | ||
|
||
sub setup { | ||
make_directory(Data_directory); | ||
make_directory(Bin_directory); | ||
} | ||
|
||
sub make_directory { | ||
my ($dir) = @_; | ||
|
||
if (! -e $dir) { | ||
print "Creating directory $dir\n"; | ||
mkdir $dir, 0755 | ||
or die "Can't create directory '$dir': $!\n"; | ||
} | ||
elsif (! -d $dir) { | ||
die "Not a directory: '$dir'\n"; | ||
} | ||
return 1; | ||
} | ||
|
||
sub app_config { | ||
return $Config; | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Cgi: creates the "cgi" program that runs Vend as a cgi-bin program | ||
# | ||
# $Id: Cgi.pm,v 1.1 1996/02/26 21:19:57 amw Exp $ | ||
# | ||
package Vend::Cgi; | ||
|
||
# Copyright 1996 by Andrew M. Wilcox <awilcox@world.std.com> | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
|
||
use strict; | ||
use Vend::Application; | ||
|
||
sub setup { | ||
my $C = app_config(); | ||
|
||
my $fn = $C->{'Bin_directory'} . "/cgi"; | ||
print "Creating $fn\n"; | ||
open(OUT, ">$fn") or die "Can't create '$fn': $!\n"; | ||
|
||
print OUT <<"END"; | ||
#!$C->{'Perl_program'} -w | ||
BEGIN { | ||
open(LOG, '>>$C->{'Error_log_file'}'); | ||
print LOG ''; | ||
open(STDERR, '>&LOG'); | ||
} | ||
use lib '$C->{'Vend_lib'}'; | ||
use Vend::Setup; | ||
\$ENV{'PATH'} = '/bin:/usr/bin'; | ||
\$ENV{'SHELL'} = '/bin/sh'; | ||
\$ENV{'IFS'} = ''; | ||
srand(\$\$ ^ time()); | ||
umask 077; | ||
chdir '$C->{'App_directory'}'; | ||
require '$C->{'Config_file'}'; | ||
initialize_modules(); | ||
require Vend::Http; | ||
my \$http = new Vend::Http::CGI; | ||
\$http->populate(\\%ENV); | ||
Vend::Dispatch::dispatch(\$http); | ||
END | ||
|
||
close(OUT); | ||
chmod 04755, $fn or die "Can't chmod '$fn': $!\n"; | ||
} | ||
|
||
1; |
Oops, something went wrong.