[LON-CAPA-dev] Installing Modules for LON-CAPA

GARRETT, DONNELL MAZON lon-capa-dev@mail.lon-capa.org
Tue, 27 Sep 2005 11:42:12 -0400


I have another question about .library files.  When you say "make the
problem a little slowerish", I understand that this is because of since
more time is spent parsing and compiling Perl code.  My question is when
is the actual script from .problem files ran?  Is it when the student
hits "submit answer" and the randomly generated inputs are ran though
the script and then the output is compared to the student's answer?  Or
is it when the page is displayed to begin with, and the script has ran
and the output is waiting to be compared to the student's answer.  Or is
it done before that?


-----Original Message-----
From: lon-capa-dev-admin@mail.lon-capa.org
[mailto:lon-capa-dev-admin@mail.lon-capa.org] On Behalf Of Guy
Albertelli II
Sent: Monday, September 26, 2005 3:27 PM
To: lon-capa-dev@mail.lon-capa.org
Subject: Re: [LON-CAPA-dev] Installing Modules for LON-CAPA

Hi Donnell,

> That sounds great about you adding Math::Complex and
> Math::Cephes::Matrix.  If those were added, I'm sure that 99% of our
> problems would go away.  Is there any way you can tell me when you
> to implement those two (or similar modules) into CAPA?

Any changes like this are very unlikely to occur before our next
non-bugfix release. That next release like that will be version 2.1 in

(And it is Lon-CAPA ;-)

> Also, I understand about not allowing for arbitrary modules to be
> into the CAPA problem sets, that makes sense.  However, how is that
> different from a .library file?  For now, until you guys add
> Math::Complex and Math::Cephes::Matrix (or similar modules), the
> .library route seems to be the way to go.  With the .library file, it
> sounds like we can create our own functions that we can deploy
> throughout our .problem sets.  That sounds good, since that was I was
> originally after to begin with.  However, I am a bit confused.  How is
> adding a .library file not add bloat while a module does?  

Each .library file is parsed at the time of and <import> and used
then, and the resulting information is thrown away at the end of the
.problem evaluation.

This means slowerish homework problems. (Since more time is spent
parsing and compiling Perl code.) (Although the difference here can be
is the hunderths of a second range, depending on homw much code is in
a .library)

> Where can I find information about the creation and installation of
> .library files?  Until the two modules are installed, that sounds like
> how we should proceed.

They basically work just like a .problem 

1) in CSTR select the option 'New library file' and type in a name,
click Go
2) Click Continue
3) Select a template from the list ('Basic Script library' is probably
what you want
4) Edit or EdiXML it
5) stick sub or other variable definitions in to the <script> 
6) publish it

Then in a .problem insert:


After the <import> All subsequent <script> can use the sub and
variable definitions from the <library>

guy@albertelli.com   0-7-2-1-27,137
LON-CAPA-dev mailing list