EPrints Technical Mailing List Archive

Message: #05230


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

[EP-tech] Perl question


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