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

Commit

Permalink
Vend 0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew M. Wilcox authored and jonjensen committed Jan 2, 2009
1 parent 7bb11ae commit 3c17b1b
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 35 deletions.
22 changes: 14 additions & 8 deletions Vend/Catalog.pm
@@ -1,6 +1,6 @@
# Catalog.pm: on-line ordering abstract class
#
# $Id: Catalog.pm,v 1.16 1995/11/28 18:32:25 amw Exp $
# $Id: Catalog.pm,v 1.17 1995/12/04 20:23:38 amw Exp $
#
package Vend::Catalog;

Expand Down Expand Up @@ -155,22 +155,28 @@ sub nitems {
}


# Returns the total cost of items ordered.
# Returns the total cost of the items ordered, without shipping or tax.

sub total_cost {
sub total_item_cost {
my ($class) = @_;
my ($total, $i, $item, $price);

$total = 0;
my $total = 0;
my ($item, $price);
foreach $item (@{Item()}) {
$price = $class->item_price($item->{code});
$total += $item->{quantity} * $price;
$total += $item->{quantity} * $price;
}
$total += $class->shipping_cost();
return $total;
}


# Returns the total cost of items ordered.

sub total_cost {
my ($class) = @_;
return $class->total_item_cost();
}


## ORDER PAGE ITEM LIST

sub ordered_items {
Expand Down
3 changes: 2 additions & 1 deletion Vend/Orders.pm
@@ -1,6 +1,6 @@
# Orders.pm: process a completed order
#
# $Id: Orders.pm,v 1.12 1995/11/28 19:02:37 amw Exp $
# $Id: Orders.pm,v 1.13 1995/12/04 20:24:43 amw Exp $
#
package Vend::Orders;

Expand Down Expand Up @@ -172,6 +172,7 @@ sub order_total {
my $s = $catalog->currency($catalog->shipping_cost());
$t .= "Shipping: " . $s . "\n" if $s != 0;
$t .= " Total: " . $catalog->total_cost() . "\n";
return $t;
}


Expand Down
4 changes: 2 additions & 2 deletions Vend/Startup.pm
@@ -1,6 +1,6 @@
# Startup.pm: startup Vend program and process command line arguments
#
# $Id: Startup.pm,v 1.17 1995/11/28 19:09:11 amw Exp $
# $Id: Startup.pm,v 1.18 1995/12/04 20:25:52 amw Exp $
#
package Vend::Startup;

Expand Down Expand Up @@ -34,7 +34,7 @@ use Vend::Server;
use Vend::Session;
use Vend::Uneval;

my $Vend_version = "0.3.0";
my $Vend_version = "0.3.1";

my $Running_as_cgi_bin;
my $Mode;
Expand Down
57 changes: 33 additions & 24 deletions setup
@@ -1,7 +1,7 @@
#!/usr/bin/perl
# setup: read configuration file and install application
#
# $Id: setup,v 1.17 1995/11/28 19:08:47 amw Exp $
# $Id: setup,v 1.18 1995/12/04 21:16:31 amw Exp $

# Copyright 1995 by Andrew M. Wilcox <awilcox@world.std.com>
#
Expand All @@ -19,7 +19,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

my $Version = "0.3.0";
my $Version = "0.3.1";

use Getopt::Long;
# use strict;
Expand Down Expand Up @@ -51,44 +51,53 @@ if ($main::opt_help) {
exit 0;
}

die "Please specify the Vend library directory with the -vend option\n"
unless $main::opt_vend;
my $Vend_lib = $main::opt_vend;
my $Vend_lib;
if ($main::opt_vend) {
$Vend_lib = $main::opt_vend;
$Vend_lib =~ s,/$,,;
-f "$Vend_lib/Vend/Dispatch.pm" or die <<"END";
I'm sorry, but I don't see the Vend sources in '$Vend_lib'.
END
}
else {
my $novend = <<'END';
I'm sorry, I wasn't able to find the Vend directory. Please
use the -vend option to give the location of the Vend library
directory.
END
my $dir = $0;
$dir =~ s,/[^/]+$,, or die $novend;
die $novend unless -f "$dir/Vend/Dispatch.pm";
$Vend_lib = $dir;
}

unshift @INC, $Vend_lib;

my $App = shift @ARGV;
unless (defined $App) {
print STDERR "Please specify the application name.\n";
usage();
exit 1;
}

require Vend::ConfigReader;

$C = new Vend::ConfigReader;
my @Modules = ();

my $App = shift @ARGV;
$App = 'vend' unless defined $App;
configuration();

if ($main::opt_config) {
$C->load($main::opt_config);
}

if ($main::opt_config) { $C->load($main::opt_config) }
elsif (-f "$App.conf") { $C->load("$App.conf") }
elsif (-f "$App.cfg") { $C->load("$App.cfg") }
elsif (-f "vend.conf") { $C->load("vend.conf") }
elsif (-f "vend.cfg") { $C->load("vend.cfg") }
else {
$C->load("$App.conf");
die <<'END';
I'm sorry, but I couldn't find the Vend configuration file
in the current directory.
END
}

my $Data_dir = $C->value("Data_directory");
makedir($Data_dir);
chdir($Data_dir) or die "Can't chdir to '$Data_dir': $!\n";

# open(CONFIG, ">config") or die "Can't create '$config': $!\n";
# my ($d, $x);
# foreach $d ($C->directives()) {
# print CONFIG "$d=", '"', $C->value($d), '"', "\n";
# }
# close(CONFIG);

cmd("$Vend_lib/template/configure");

%syscfg = ();
Expand Down

0 comments on commit 3c17b1b

Please sign in to comment.