Tech List

[index] [prev] [next] [options] [help]
See the Mailing Lists Page for how to subscribe and unsubscribe.

eprints_tech messages

Please note: this page shows emails that have been sent to the eprints_tech mailing list. Some of these may be spam emails we have failed to filter.

[EP-tech] Problems with OO Design

From: Clayton Carter <crcarter AT cs.indiana.edu>
Date: Thu, 22 Mar 2001 15:26:10 -0500


Threading:      • This Message
             Re: [EP-tech] Problems with OO Design from support AT eprints.org
             Re: [EP-tech] Problems with OO Design from tdb198 AT soton.ac.uk
             Re: [EP-tech] Problems with OO Design from support AT eprints.org
             Re: [EP-tech] Problems with OO Design from crcarter AT cs.indiana.edu


	Thanks for the note about the indexed searching.  That's great
news and I'm glad to hear it.

	I've now a request/complaint/rambling string of sentences.  We
(at the Indiana University Digital Library Program) are really pleased
with EPrints but, as usual, there are things we've need to change or
tweak.  I've accomplished this in a very OO way (and a rather -- to my
senses, at least -- elegant way) as such:

	EPrints::SubmissionForm::update_from_subject_form() needed to
be changed.  (Well, maybe it didn't *need* to be changed, but this is
the solution I came up with.)

	In order to do this, I moved SubmissionForm.pm to
SubmissionFormTheirs.pm (perhaps `EP' or `Orig' would have been a
better name) and did a global search replace in that file to change
all occurances of `EPrints::SubmissionForm' to
`EPrints::SubmissionFormTheirs'.  I then made a symlink from 
`perl_lib/EPrints/SubmissionForm.pm to 
`perl_lib/DLIB/SubmissionForm.pm' to help us keep all of our changes
in one place.  `DLIB/SubmissionForm.pm' looked something like this:

package EPrints::SubmissionForm;

  ...

use base qw(EPrints::SubmissionFormTheirs);  # combined use and  AT ISA

  ...

sub update_from_subject_form
{ 
  ... 
}

1;

	This worked great, except for one problem.  A few of the
scripts, like `cgi/staff/view_submission', refered directly to class
variables stored in the old `EPrints::SubmissionForm' (now
`EPrints::SubmissionFormTheirs').  The script broke because of the
fact that my inheriting package didn't have the some globals defined.
(In particular, the access to the `action_*' variables is what caused
the problems.)  The short solution was to just copy all of the
`action_*' and `stage_*' variables into my package.

	Keep in mind that, while OO is -- for the most part -- old hat
to me, I'm still getting used to Perl's OO stuff.  Basically, I'm
wondering if it's at all on the plate to modify things like this for a
more OO friendly interface.  And I mean this in the simplest of ways:
providing a method which takes an action_type and returns the
associated text.

	I guess this isn't a big deal, but it would make the system
that much easier to extend.  I don't think that this particular
example would be that hard to implement, so if I put together a patch
to make this change, what format would be prefered?  (I'm none too
well aquainted with unified diffs.)

--pc

-- 
Clayton Carter   crcarter AT cs.indiana.edu
"My mom says I'm the handsomest guy in school."

[index] [prev] [next] [options] [help]