[system] / branches / gage_dev / webwork2 / bin / wwsh Repository:
ViewVC logotype

Diff of /branches/gage_dev/webwork2/bin/wwsh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1697 Revision 2819
1#!/usr/bin/env perl 1#!/usr/bin/env perl
2################################################################################ 2################################################################################
3# WeBWorK Online Homework Delivery System 3# WeBWorK Online Homework Delivery System
4# Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ 4# Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/
5# $CVSHeader: webwork-modperl/bin/wwsh,v 1.4 2003/12/09 01:12:28 sh002i Exp $ 5# $CVSHeader: webwork2/bin/wwsh,v 1.5 2004/01/03 21:00:28 sh002i Exp $
6# 6#
7# This program is free software; you can redistribute it and/or modify it under 7# This program is free software; you can redistribute it and/or modify it under
8# the terms of either: (a) the GNU General Public License as published by the 8# the terms of either: (a) the GNU General Public License as published by the
9# Free Software Foundation; either version 2, or (at your option) any later 9# Free Software Foundation; either version 2, or (at your option) any later
10# version, or (b) the "Artistic License" which comes with this package. 10# version, or (b) the "Artistic License" which comes with this package.
21 21
22=cut 22=cut
23 23
24use strict; 24use strict;
25use warnings; 25use warnings;
26use FindBin; 26
27use lib "$FindBin::Bin"; 27BEGIN {
28 die "WEBWORK_ROOT not found in environment.\n"
29 unless exists $ENV{WEBWORK_ROOT};
30}
31
32use lib "$ENV{WEBWORK_ROOT}/lib";
28use PSH; 33use PSH;
29use lib "$FindBin::Bin/../lib";
30use WeBWorK::CourseEnvironment; 34use WeBWorK::CourseEnvironment;
31use WeBWorK::DB; 35use WeBWorK::DB;
32 36
33sub main(@) {
34 my ($course, $cmd) = @_; 37my ($course, $cmd) = @ARGV;
35 38
36 unless ($ENV{WEBWORK_ROOT}) {
37 die "WEBWORK_ROOT not found in environment.\n";
38 }
39
40 unless ($course) { 39unless ($course) {
41 die "usage: $0 course\n"; 40 die "usage: $0 course\n";
42 } 41}
43 42
44 our $ce = WeBWorK::CourseEnvironment->new($ENV{WEBWORK_ROOT}, "", "", $course); 43our $ce = WeBWorK::CourseEnvironment->new($ENV{WEBWORK_ROOT}, "", "", $course);
45 our $db = WeBWorK::DB->new($ce->{dbLayout}); 44our $db = WeBWorK::DB->new($ce->{dbLayout});
46 (undef) = $db; # placate warnings 45(undef) = $db; # placate warnings
47 46
48 if ($cmd) { 47if ($cmd) {
49 no warnings; 48 no warnings;
50 no strict; 49 no strict;
51 eval $cmd; 50 eval $cmd;
52 die $@ if $@; 51 die $@ if $@;
53 use strict; 52 use strict;
54 use warnings; 53 use warnings;
55 } else { 54} else {
56 print <<'EOF'; 55 print <<'EOF';
57wwsh - The WeBWorK Shell 56wwsh - The WeBWorK Shell
58Available objects: $ce (WeBWorK::CourseEnvironment) 57Available objects: $ce (WeBWorK::CourseEnvironment)
59 $db (WeBWorK::DB) 58 $db (WeBWorK::DB)
60EOF 59EOF
61 PSH::prompt(); 60 PSH::prompt();
62 }
63} 61}
64
65main(@ARGV);

Legend:
Removed from v.1697  
changed lines
  Added in v.2819

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9