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
MiniVend 2.01
  • Loading branch information
perusionmike authored and jonjensen committed Jan 2, 2009
1 parent 37cac3c commit 38c4659
Show file tree
Hide file tree
Showing 75 changed files with 328 additions and 12,233 deletions.
9 changes: 9 additions & 0 deletions Changes
@@ -1,3 +1,12 @@
MiniVend 2.01 - Maintenance Release
* Added modifier variables to user values
* Encapsulated code to prevent dying on catalog config and execution
* Improved makecat scripts
* Corrected silly duplication of files
* Improved [selected] and [checked]
* Fixed minor demo problems
* Changed IRIX locking to flock()
* Changed configure to set ForkSearches to NO on SunOS and OSF/Alpha

MiniVend 2.0 - The ISP release
* Multiple independent and shared catalogs
Expand Down
3 changes: 2 additions & 1 deletion Vend/Config.pm
@@ -1,4 +1,4 @@
# $Id: Config.pm,v 1.3 1996/08/22 17:35:08 mike Exp mike $
# $Id: Config.pm,v 2.1 1996/09/08 08:27:58 mike Exp mike $

package Vend::Config;
require Exporter;
Expand Down Expand Up @@ -580,6 +580,7 @@ sub config {
my($directive);
$C = {};
$C->{'CatalogName'} = $catalog;
$C->{'VendRoot'} = $dir;
$C->{'ConfDir'} = $confdir;
$C->{'ErrorFile'} = $Global::ErrorFile;
Expand Down
6 changes: 4 additions & 2 deletions Vend/Data.pm
@@ -1,4 +1,4 @@
# $Id: Data.pm,v 1.3 1996/08/22 17:35:08 mike Exp mike $
# $Id: Data.pm,v 2.2 1996/09/08 08:27:58 mike Exp mike $

package Vend::Data;
require Exporter;
Expand Down Expand Up @@ -234,6 +234,8 @@ sub close_database {

## PRODUCTS
sub close_products {
undef $Product_price;
undef $Product_desc;
$Products->close_table()
or die "Could not untie products database.\n";
}
Expand Down Expand Up @@ -366,7 +368,7 @@ sub quantity_price {
}

my ($break,$i,$price,$scratch);
my $price = $one;
$price = $one;

# Use the passed quantity if there
unless(defined $quan) {
Expand Down
4 changes: 2 additions & 2 deletions Vend/Glimpse.pm
@@ -1,6 +1,6 @@
# Vend/Glimpse.pm: Search indexes with Glimpse
#
# $Id: Glimpse.pm,v 1.2 1996/08/10 22:25:59 mike Exp $
# $Id: Glimpse.pm,v 2.0 1996/08/30 08:26:58 mike Exp $
#
# ADAPTED FOR USE WITH MINIVEND from Search::Glimpse
#
Expand Down Expand Up @@ -28,7 +28,7 @@ package Vend::Glimpse;
require Vend::Search;
@ISA = qw(Vend::Search);

$VERSION = substr(q$Revision: 1.2 $, 10);
$VERSION = substr(q$Revision: 2.0 $, 10);
use Text::ParseWords;
use strict;

Expand Down
51 changes: 15 additions & 36 deletions Vend/Interpolate.pm
@@ -1,32 +1,9 @@
# Interpolate.pm - Interpret MiniVend tags
#
# $Id: Interpolate.pm,v 1.3 1996/08/22 17:35:08 mike Exp mike $
# $Id: Interpolate.pm,v 2.2 1996/09/08 08:27:58 mike Exp mike $
#
# Copyright 1996 by Michael J. Heins <mikeh@iac.net>
#
# $Log: Interpolate.pm,v $
# Revision 1.3 1996/08/22 17:35:08 mike
# Save solid snapshot of multiple catalog Vend
#
# Revision 1.2 1996/08/10 22:25:59 mike
# First working version of MiniVend 2.0
#
# Revision 1.1 1996/08/09 22:20:51 mike
# Initial revision
#
# Revision 1.1 1996/07/17 16:08:53 mike
# Initial revision
#
# Revision 1.3 1996/05/18 20:02:39 mike
# Minivend 1.03 Beta 1
#
# Revision 1.2 1996/05/09 18:54:52 mike
# Initial integration of Search::Glimpse
#
# Revision 1.1 1996/05/08 22:10:15 mike
# Initial revision
#
#
# 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
Expand All @@ -45,7 +22,7 @@ package Vend::Interpolate;
require Exporter;
@ISA = qw(Exporter);

$VERSION = substr(q$Revision: 1.3 $, 10);
$VERSION = substr(q$Revision: 2.2 $, 10);

@EXPORT = qw (

Expand Down Expand Up @@ -73,7 +50,6 @@ use strict;
use Vend::Util;
use Vend::Data;
use Vend::Server;
use Vend::User;
use Vend::ValidCC;
use Vend::PageBuild;
use Text::ParseWords;
Expand Down Expand Up @@ -103,12 +79,13 @@ sub tag_accessories {
sub tag_checked {
my $field = shift;
my $value = shift || 'on';
$field = lc $field;
my $ref = $Vend::Session->{'values'}->{$field};
$ref = lc $ref;

my $r;

#eval {/^$value$/} ;
#return '' if $@;

if($Vend::Session->{'values'}->{"\L$field"} =~ /^$value$/i) {
if( $ref eq "\L$value" ) {
$r = 'CHECKED';
}
else {$r = ''}
Expand All @@ -117,20 +94,21 @@ sub tag_checked {

# Returns 'SELECTED' when a value is present on the form
# Must match exactly, but NOT case-sensitive
# Silently returns null string if illegal regex

sub tag_selected {
my $field = shift;
my $value = shift || '';
$field = lc $field;
my $ref = $Vend::Session->{'values'}->{$field};
$ref = lc $ref;
my $r;

eval {/^$value$/} ;
return '' if ( $@ or ! $value);

if($Vend::Session->{'values'}->{$field} =~ /^$value$/i) {
if( $ref eq "\L$value" ) {
$r = 'SELECTED';
}
else {$r = ''}
else {
$r = ''
}
$r;
}

Expand Down Expand Up @@ -653,6 +631,7 @@ sub tag_if {
$op =~ s/[^rwxezfdTsB]//g;
$op = substr($op,0,1) || 'f';
$op = qq|-$op "$term"|;
$status = eval {$op};
}
elsif($base eq 'validcc') {
no strict 'refs';
Expand Down
23 changes: 18 additions & 5 deletions Vend/Order.pm
Expand Up @@ -2,7 +2,7 @@
#
# MiniVend version 1.04
#
# $Id: Order.pm,v 1.3 1996/08/22 17:35:08 mike Exp mike $
# $Id: Order.pm,v 2.1 1996/09/08 08:27:58 mike Exp mike $
#
# This program is largely based on Vend 0.2
# Copyright 1995 by Andrew M. Wilcox <awilcox@world.std.com>
Expand Down Expand Up @@ -30,7 +30,7 @@
package Vend::Order;
require Exporter;

$VERSION = substr(q$Revision: 1.3 $, 10);
$VERSION = substr(q$Revision: 2.1 $, 10);
$DEBUG = 0;

@ISA = qw(Exporter);
Expand Down Expand Up @@ -161,7 +161,7 @@ sub get_ignored {
my $ignore = {};
my $field;

@ignore = split(/\s*,\s*/, $Vend::Cfg->{'ReportIgnore'});
@ignore = split(/[\s,]+/, $Vend::Cfg->{'ReportIgnore'});
foreach $field (@ignore) {
$ignore->{$field} = 1;
}
Expand All @@ -173,20 +173,33 @@ sub get_ignored {
sub mail_order {
my($body, $i, $code, $ok, $seen, $blankline);
my($values, $key, $value, $order_no, $pgp, $subject);
my(%modifiers);
my $new = 0;
$seen = get_ignored();
$body = order_report($seen);
return undef unless defined $body;

# To ignore the modifiers in the mailed report
if($Vend::Cfg->{UseModifier}) {
for (@{$Vend::Cfg->{UseModifier}}) {
$modifiers{$_} = 1;
}
}

$values = $Vend::Session->{'values'};

$blankline = 0;
while (($key, $value) = each %$values) {
next if $key =~ /^mv_/i;
if($key =~ /\d+$/) {
$tmpkey = $key;
$tmpkey =~ s/\d+$//;
next if $modifiers{$tmpkey};
}
if (!$new && !$$seen{$key}) {
if (!$blankline) {
$body .= "\n";
$blankline = 1;
$body .= "\n";
$blankline = 1;
}
$body .= "$key: $value\n";
}
Expand Down
7 changes: 2 additions & 5 deletions Vend/PageBuild.pm
@@ -1,11 +1,9 @@
# PageBuild.pm - Interpret MiniVend tags
#
# $Id: PageBuild.pm,v 1.3 1996/08/22 17:35:08 mike Exp mike $
# $Id: PageBuild.pm,v 2.1 1996/09/08 08:08:21 mike Exp $
#
# Copyright 1996 by Michael J. Heins <mikeh@iac.net>
#
# $Log: PageBuild.pm,v $
#
# 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
Expand All @@ -24,7 +22,7 @@ package Vend::PageBuild;
require Exporter;
@ISA = qw(Exporter);

$VERSION = substr(q$Revision: 1.3 $, 10);
$VERSION = substr(q$Revision: 2.1 $, 10);

@EXPORT = qw ( fake_html );

Expand All @@ -34,7 +32,6 @@ use strict;
use Vend::Util;
use Vend::Data;
use Vend::Server;
use Vend::User;
use Vend::ValidCC;
use Vend::Interpolate;
use Text::ParseWords;
Expand Down
4 changes: 2 additions & 2 deletions Vend/Scan.pm
@@ -1,6 +1,6 @@
# Vend/Scan.pm: Prepare searches for MiniVend
#
# $Id: Scan.pm,v 1.3 1996/08/22 17:35:08 mike Exp mike $
# $Id: Scan.pm,v 2.0 1996/08/30 08:26:58 mike Exp $
#
# 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 @@ -21,7 +21,7 @@ require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(perform_search find_search_params);

$VERSION = substr(q$Revision: 1.3 $, 10);
$VERSION = substr(q$Revision: 2.0 $, 10);

use strict;
use Vend::Util;
Expand Down
10 changes: 8 additions & 2 deletions Vend/Server.pm
@@ -1,6 +1,6 @@
# Server.pm: listen for cgi requests as a background server
#
# $Id: Server.pm,v 1.3 1996/08/22 17:35:08 mike Exp mike $
# $Id: Server.pm,v 1.5 1996/09/08 08:27:58 mike Exp mike $

# Copyright 1995 by Andrew M. Wilcox <awilcox@world.std.com>
#
Expand Down Expand Up @@ -141,7 +141,13 @@ sub connection {
read_cgi_data(\@argv, \%env, \$entity);

my $http = new Vend::Http::Server \*Vend::Server::MESSAGE, \%env, $entity;
my $forked = ::dispatch($http,$socket,$debug);
my $forked;
eval {$forked = ::dispatch($http,$socket,$debug);};
if($@) {
::logGlobal("Error in '$Vend::Cfg->{CatalogName}': $@");
::logError($@);
$forked = 0;
}
$forked;
}

Expand Down
3 changes: 2 additions & 1 deletion Vend/Session.pm
@@ -1,4 +1,4 @@
# $Id: Session.pm,v 1.3 1996/08/22 17:35:08 mike Exp mike $
# $Id: Session.pm,v 1.5 1996/09/08 08:27:58 mike Exp mike $

package Vend::Session;
require Exporter;
Expand Down Expand Up @@ -226,6 +226,7 @@ sub expire_sessions {
}
$session = eval($s);
die "Could not eval '$s' from session dbm: $@\n" if $@;
next if is_yes($session->{'values'}->{'mv_save_session'});
if ( (! defined $session) ||
$time - $session->{'time'} > $Vend::Cfg->{'SessionExpire'}) {
push @delete, $session_name;
Expand Down
2 changes: 1 addition & 1 deletion Vend/Table/DB_File.pm
@@ -1,6 +1,6 @@
# Table/DB_File.pm: access a table stored in a DB file hash
#
# $Id: DB_File.pm,v 1.2 1996/08/22 17:35:08 mike Exp mike $
# $Id: DB_File.pm,v 1.2 1996/08/22 17:35:08 mike Exp $
#

# Copyright 1995 by Andrew M. Wilcox <awilcox@world.std.com>
Expand Down
2 changes: 1 addition & 1 deletion Vend/Table/GDBM.pm
@@ -1,6 +1,6 @@
# Table/GDBM.pm: access a table stored in a GDBM file
#
# $Id: GDBM.pm,v 1.2 1996/08/22 17:35:08 mike Exp mike $
# $Id: GDBM.pm,v 1.2 1996/08/22 17:35:08 mike Exp $
#

# Copyright 1995 by Andrew M. Wilcox <awilcox@world.std.com>
Expand Down
9 changes: 6 additions & 3 deletions Vend/Table/Import.pm
@@ -1,10 +1,13 @@
# Table/Import.pm: import a table
#
# $Id: Import.pm,v 1.1 1996/08/09 22:21:11 mike Exp $
# $Id: Import.pm,v 1.3 1996/09/08 08:29:46 mike Exp mike $
#
# Copyright 1995 by Andrew M. Wilcox <awilcox@world.std.com>
#
# $Log: Import.pm,v $
# Revision 1.3 1996/09/08 08:29:46 mike
# Removed hiding scope declaration
#
# Revision 1.1 1996/08/09 22:21:11 mike
# Initial revision
#
Expand All @@ -30,7 +33,7 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

package Vend::Table::Import;
$VERSION = substr(q$Revision: 1.1 $, 10);
$VERSION = substr(q$Revision: 1.3 $, 10);

require Exporter;
@ISA = qw(Exporter);
Expand Down Expand Up @@ -64,7 +67,7 @@ sub import_quoted { return import_csv(@_) }

sub import_ascii_delimited {
my ($infile, $delimiter, $create) = @_;
my $delimiter = quotemeta($delimiter);
$delimiter = quotemeta($delimiter);

open(IN, $infile) or die "Couldn't open '$infile': $!\n";

Expand Down
2 changes: 1 addition & 1 deletion Vend/Table/InMemory.pm
@@ -1,6 +1,6 @@
# Table/InMemory.pm: store a table in memory
#
# $Id: InMemory.pm,v 1.2 1996/08/22 17:35:08 mike Exp mike $
# $Id: InMemory.pm,v 1.2 1996/08/22 17:35:08 mike Exp $
#
# Copyright 1995 by Andrew M. Wilcox <awilcox@world.std.com>
#
Expand Down
6 changes: 0 additions & 6 deletions Vend/User.pm

This file was deleted.

4 changes: 2 additions & 2 deletions Vend/Util.pm
@@ -1,4 +1,4 @@
# $Id: Util.pm,v 1.3 1996/08/22 17:35:08 mike Exp mike $
# $Id: Util.pm,v 2.1 1996/09/08 08:52:31 mike Exp mike $

package Vend::Util;
require Exporter;
Expand Down Expand Up @@ -603,7 +603,7 @@ my $unlock_function;
unless (defined $use) {
my $os = $Vend::Util::Config{'osname'};
warn "lock.pm: os is $os\n" if $debug;
if ($os eq 'solaris' or $os eq 'irix') {
if ($os eq 'solaris') {
$use = 'fcntl';
}
else {
Expand Down

0 comments on commit 38c4659

Please sign in to comment.