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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1697 - (download) (annotate)
Sat Jan 3 21:00:28 2004 UTC (9 years, 4 months ago) by sh002i
File size: 1817 byte(s)
changed calls to WeBWorK::DB::new, removed obsolete config files

    1 #!/usr/bin/env perl
    2 ################################################################################
    3 # WeBWorK Online Homework Delivery System
    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 $
    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 ################################################################################
   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 	my ($course, $cmd) = @_;
   35 	
   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 	our $ce = WeBWorK::CourseEnvironment->new($ENV{WEBWORK_ROOT}, "", "", $course);
   45 	our $db = WeBWorK::DB->new($ce->{dbLayout});
   46 	(undef) = $db; # placate warnings
   47 	
   48 	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 wwsh - The WeBWorK Shell
   58 Available objects: $ce (WeBWorK::CourseEnvironment)
   59                    $db (WeBWorK::DB)
   60 EOF
   61 		PSH::prompt();
   62 	}
   63 }
   64 
   65 main(@ARGV);

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9