Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Vend 0.3.6
  • Loading branch information
Andrew M. Wilcox authored and jonjensen committed Jan 2, 2009
1 parent 6b61bf8 commit 85de257
Show file tree
Hide file tree
Showing 40 changed files with 3,289 additions and 2,341 deletions.
53 changes: 53 additions & 0 deletions ChangeLog
@@ -1,3 +1,56 @@
Mon Feb 26 22:29:18 1996 Andrew Wilcox <awilcox@world.std.com>

* setup: Version 0.3.6.

* setup: Much simplified.

* Vend/Catalog.pm, Vend/Form.pm, Vend/Dispatch.pm: Doc update.

* Vend/Session_file.pm: Vend::Escape_filename renamed to Vend::Escape.

* Vend/Escape.pm:
Rename escape_string(), unescape_string() to escape_filename(),
unescape_filename().

* Vend/Util.pm (random_string): new function.

* Vend/Table/GDBM.pm:
Pack and unpack strings, so that tabs can be stored in fields.
Get 'File_permission_mode', 'Read_only', and 'Fast_write' from config
hash.
Store the column names in the GDBM file.

* Vend/Startup.pm:
Use main::LOG instead of log_error() and Vend::Log::ERROR.

* Vend/Shopcart.pm (add_url_ph): use page_url() instead of vend_url().
(get_field, get_required_field): moved to Form.pm.

* Vend/Server.pm (server): print to main::LOG filehandle instead of calling
log_error().

* Vend/Sendmail.pm (Sendmail_program, configure): new subs.

* Vend/Http.pm: Old Vend::form package code removed.

* Vend/Form.pm:
Import Dump_request() from Dispatch.
Rename specify_form() to register_form().
(expect_form): interaction_error() now dies instead of returning.
(get_field, get_required_field, get_field_values): new subs.

* Vend/Dispatch.pm:
Rename specify_action() to register_action().
(configure): new subroutine.
(dispatch): Catch die("ABORT: ").
(act): some support for last page.
(page_url): code moved here from Builtin.pm.
(display_page): use new page_exists().

* Vend/Builtin.pm (External_URL, configure): new subroutines.
(page_url_ph): code moved to Dispatch::page_url().
(default_page_url): removed.

Thu Feb 1 23:09:53 1996 Andrew Wilcox <awilcox@maine.com>

* Vend/Startup.pm, setup: Version 0.3.5.
Expand Down
68 changes: 68 additions & 0 deletions Vend/Application.pm
@@ -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;
52 changes: 27 additions & 25 deletions Vend/Builtin.pm
@@ -1,10 +1,10 @@
# Builtin.pm: defines placeholders available to all Vend applications
#
# $Id: Builtin.pm,v 1.10 1996/01/30 23:10:08 amw Exp $
# $Id: Builtin.pm,v 1.11 1996/02/26 21:18:17 amw Exp $
#
package Vend::Builtin;

# Copyright 1995 by Andrew M. Wilcox <awilcox@world.std.com>
# Copyright 1995,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
Expand All @@ -20,8 +20,17 @@ package Vend::Builtin;
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

my $Config;

sub External_URL { $Config->{'External_URL'} }

sub configure {
my ($class, $config) = @_;
$Config = $config;
}

use strict;
use Vend::Directive qw(Default_page External_URL);
# use Vend::Directive qw(Default_page External_URL);
use Vend::Dispatch;
use Vend::Session;
use Vend::Page;
Expand All @@ -45,6 +54,7 @@ define_placeholder '[message]', sub {
$Vend::Message;
};


=head2 C<[page-url "name"]>
Returns the URL which references the specified catalog page.
Expand All @@ -60,32 +70,24 @@ placeholder always returns a fully qualified URL.
=cut

define_placeholder '[page-url $pg]', sub {
sub page_url_ph {
my ($pg) = @_;
my ($path, $base);

if (($path) = ($pg =~ m!^/(.*)!)) {
return vend_url($path);
}

($base) = (page_name() =~ m!^(.*)/!);
if (defined $base) {
return vend_url($base . "/" . $pg);
} else {
return vend_url($pg);
}
};

=head2 C<[default-page-url]>
return page_url($pg);
}

Returns a URL refering to the default page of the catalog. The name
of the default page is specified by the Default_page directive.
define_placeholder '[page-url $pg]', \&page_url_ph;

=cut

define_placeholder '[default-page-url]', sub {
vend_url(Default_page);
};
# =head2 C<[default-page-url]>
#
# Returns a URL refering to the default page of the catalog. The name
# of the default page is specified by the Default_page directive.
#
# =cut
#
# define_placeholder '[default-page-url]', sub {
# vend_url(Default_page);
# };

=head2 C<[external-url $img]>
Expand Down
10 changes: 9 additions & 1 deletion Vend/Catalog.pm
@@ -1,6 +1,6 @@
# Catalog.pm: on-line ordering abstract class
#
# $Id: Catalog.pm,v 1.18 1995/12/15 20:06:14 amw Exp $
# $Id: Catalog.pm,v 1.19 1996/02/26 21:18:45 amw Exp $
#
package Vend::Catalog;

Expand All @@ -20,6 +20,14 @@ package Vend::Catalog;
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

=head1 NAME
Vend::Catalog - depreciated Catalog class
This class is depreciated in favor of Vend::Shopcart, but is retained
for compatibility with existing storefronts.
=cut
use strict;
use Vend::Directive qw(Default_page Shopping_list_page Order_subsequent);
use Vend::Dispatch;
Expand Down
65 changes: 65 additions & 0 deletions Vend/Cgi.pm
@@ -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;

0 comments on commit 85de257

Please sign in to comment.