[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 1564 - (view) (download)

1 : sh002i 810 #!/usr/bin/env perl
2 :    
3 :     ################################################################################
4 :     # WeBWorK mod_perl (c) 1995-2002 WeBWorK Team, Univeristy of Rochester
5 : sh002i 1564 # $Id: wwsh,v 1.3 2003-10-06 22:35:16 sh002i Exp $
6 : sh002i 810 ################################################################################
7 :    
8 :     =head1 NAME
9 :    
10 :     wwdb - command-line interface to the WeBWorK libraries.
11 :    
12 :     =cut
13 :    
14 :     use strict;
15 :     use warnings;
16 :     use FindBin;
17 :     use lib "$FindBin::Bin";
18 :     use PSH;
19 :     use lib "$FindBin::Bin/../lib";
20 :     use WeBWorK::CourseEnvironment;
21 :     use WeBWorK::DB;
22 :    
23 :     sub main(@) {
24 : sh002i 1564 my ($course, $cmd) = @_;
25 : sh002i 810
26 :     unless ($ENV{WEBWORK_ROOT}) {
27 :     die "WEBWORK_ROOT not found in environment.\n";
28 :     }
29 :    
30 :     unless ($course) {
31 :     die "usage: $0 course\n";
32 :     }
33 :    
34 : sh002i 1096 our $ce = WeBWorK::CourseEnvironment->new($ENV{WEBWORK_ROOT}, "", "", $course);
35 : sh002i 810 our $db = WeBWorK::DB->new($ce);
36 :     (undef) = $db; # placate warnings
37 :    
38 : sh002i 1564 if ($cmd) {
39 :     no warnings;
40 :     no strict;
41 :     eval $cmd;
42 :     die $@ if $@;
43 :     use strict;
44 :     use warnings;
45 :     } else {
46 :     print <<'EOF';
47 : sh002i 810 wwsh - The WeBWorK Shell
48 :     Available objects: $ce (WeBWorK::CourseEnvironment)
49 :     $db (WeBWorK::DB)
50 :     EOF
51 : sh002i 1564 PSH::prompt();
52 :     }
53 : sh002i 810 }
54 :    
55 :     main(@ARGV);

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9