Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Config
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25454/lib/OpenInteract2/Config
Modified Files:
Package.pm
Log Message:
add author_names() and author_emails()
Index: Package.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Config/Package.pm,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** Package.pm 25 Jan 2005 02:47:24 -0000 1.20
--- Package.pm 8 Feb 2005 01:27:23 -0000 1.21
***************
*** 100,103 ****
--- 100,136 ----
+ sub author_names {
+ my ( $self ) = @_;
+ my ( $names, $emails ) = $self->_parse_authors;
+ return @{ $names };
+ }
+
+ sub author_emails {
+ my ( $self ) = @_;
+ my ( $names, $emails ) = $self->_parse_authors;
+ return @{ $emails };
+ }
+
+ sub _parse_authors {
+ my ( $self ) = @_;
+ my $authors = $self->author;
+ return ( [], [] ) unless ( ref $authors );
+ my @names = ();
+ my @emails = ();
+ foreach my $author ( @{ $authors } ) {
+ my ( $name, $d1, $email, $d2 ) = $author =~ /^([\w\s]+)(\(|<)\s*(.*)\s*(\)|>)\s*$/;
+ # ...they didn't put an email in
+ unless ( $name ) {
+ $name = $author;
+ $email = '';
+ }
+ $name =~ s/^\s+//;
+ $name =~ s/\s+$//;
+ push @names, $name;
+ push @emails, $email;
+ }
+ return ( \@names, \@emails );
+ }
+
sub get_spops_files {
my ( $self ) = @_;
***************
*** 414,417 ****
--- 447,460 ----
Returns: object
+ B<author_names()>
+
+ Returns a list of all author names pulled out of the 'author'
+ property.
+
+ B<author_emails()>
+
+ Returns a list of all author emails pulled out of the 'author'
+ property.
+
B<get_spops_files()>
|