EPrints Technical Mailing List Archive

Message: #05231


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

[EP-tech] Re: Perl question


My best guess would be different developers.  Unfortunately, this difference predates github, so everything gets blamed to Tim Brody.


--
Adam Field
Business Relationship Manager and Community Lead
EPrints Services
+44 (0)23 8059 8814





On 3 Dec 2015, at 13:39, John Salter wrote:

> Hi,
> Bit of a random question - around the code in some Metafield modules.
>> From these two examples:
> https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/MetaField/Id.pm#L26-L31
> https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/MetaField/Date.pm#L25-L37
> 
> In some Metafields, the sub-classing is done like this:
> 
> ###### 
> package EPrints::MetaField::Id;
> use EPrints::MetaField;
> @ISA = qw( EPrints::MetaField );
> ######
> 
> In others, it uses a 'BEGIN' block like this
> ######
> package EPrints::MetaField::Date;
> use strict;
> use warnings;
> BEGIN
> {
> 	our( @ISA );
> 	@ISA = qw( EPrints::MetaField );
> }
> use EPrints::MetaField;
> ######
> 
> Does anyone know the purpose of the different styles?
> Is there some subtle trick I'm missing here - or is it just different coding styles from different eras?
> 
> I understand what the BEGIN block does (from http://perldoc.perl.org/perlmod.html#BEGIN%2c-UNITCHECK%2c-CHECK%2c-INIT-and-END) - but I'm unsure what it's doing/trying to do/was doing in this context...
> 
> Cheers,
> John
> 
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: http://www.eprints.org/tech.php/
> *** EPrints community wiki: http://wiki.eprints.org/
> *** EPrints developers Forum: http://forum.eprints.org/