[system] / trunk / webwork-modperl / bin / wwsh Repository:
ViewVC logotype

Annotation of /trunk/webwork-modperl/bin/wwsh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1663 - (view) (download)

1 : sh002i 810 #!/usr/bin/env perl
2 :     ################################################################################
3 : sh002i 1663 # WeBWorK Online Homework Delivery System
4 :     # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/
5 :     # $CVSHeader$
6 :     #
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
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.
11 :     #
12 :     # This program is distributed in the hope that it will be useful, but WITHOUT
13 :     # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 :     # FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the
15 :     # Artistic License for more details.
16 : sh002i 810 ################################################################################
17 :    
18 :     =head1 NAME
19 :    
20 :     wwdb - command-line interface to the WeBWorK libraries.
21 :    
22 :     =cut
23 :    
24 :     use strict;
25 :     use warnings;
26 :     use FindBin;
27 :     use lib "$FindBin::Bin";
28 :     use PSH;
29 :     use lib "$FindBin::Bin/../lib";
30 :     use WeBWorK::CourseEnvironment;
31 :     use WeBWorK::DB;
32 :    
33 :     sub main(@) {
34 : sh002i 1564 my ($course, $cmd) = @_;
35 : sh002i 810
36 :     unless ($ENV{WEBWORK_ROOT}) {
37 :     die "WEBWORK_ROOT not found in environment.\n";
38 :     }
39 :    
40 :     unless ($course) {
41 :     die "usage: $0 course\n";
42 :     }
43 :    
44 : sh002i 1096 our $ce = WeBWorK::CourseEnvironment->new($ENV{WEBWORK_ROOT}, "", "", $course);
45 : sh002i 810 our $db = WeBWorK::DB->new($ce);
46 :     (undef) = $db; # placate warnings
47 :    
48 : sh002i 1564 if ($cmd) {
49 :     no warnings;
50 :     no strict;
51 :     eval $cmd;
52 :     die $@ if $@;
53 :     use strict;
54 :     use warnings;
55 :     } else {
56 :     print <<'EOF';
57 : sh002i 810 wwsh - The WeBWorK Shell
58 :     Available objects: $ce (WeBWorK::CourseEnvironment)
59 :     $db (WeBWorK::DB)
60 :     EOF
61 : sh002i 1564 PSH::prompt();
62 :     }
63 : sh002i 810 }
64 :    
65 :     main(@ARGV);

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9