EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #02492
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
[EP-tech] Adding methods to EPrints::Database
- To: eprints <eprints-tech@ecs.soton.ac.uk>
- Subject: [EP-tech] Adding methods to EPrints::Database
- From: Ian Stuart <Ian.Stuart@ed.ac.uk>
- Date: Thu, 12 Dec 2013 11:52:59 +0000
OK, I'm doing "hinky stuff" with additional tables in the EPrints database (primarily using them for records that are not part of the EPrints application)
The basic idea is to extend EPrints::Database - as described in http://stackoverflow.com/questions/14047407/extending-perl-module-from-within-the-calling-script
So, in an EPrints::DataObj::VisitorTickets package (which describes the additional tables) I have
===== start code ====== use EPrints::Database; sub EPrints::Database::update_visitor_ticket { my( $self, $code, $user_id ) = @_; my $table = "visitorticket"; my $Q_table = $self->quote_identifier( $table ); my $Q_user_id = $self->quote_identifier( "userid" ); my $Q_code = $self->quote_identifier( "code" );my $sql = "DELETE FROM $Q_table WHERE $Q_userid=".$self->quote_int($userid)." AND $Q_code=".$self->quote_value($code);
$self->do($sql); $self->insert( $table, ["code","userid","expires"], [ $code, $userid, time()+3600 ]); } ===== end code ====== and then in my script I have: ===== start code ===== $repo->{'database'}->update_visitor_ticket( $eprints_session, $secret_code, $visitor_id );
===== end code ===== My problem is that, when I run the script that calls this, I get the error: Can't locate object method "update_visitor_ticket" via package "EPrints::Database::Pg" Now - given that EPrints::Repository has the code ===== start code ===== my $userid = $user->get_id; $self->{database}->update_ticket_userid( $code, $userid, $ip ); ===== end code =====and works... I don't understand why EPrints::Repository works, and my package doesn't...
Any ideas? -- Ian Stuart. Developer: ORI, RJ-Broker, and OpenDepot.org Bibliographics and Multimedia Service Delivery team, EDINA, The University of Edinburgh. http://edina.ac.uk/ This email was sent via the University of Edinburgh. The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
- Prev by Date: [EP-tech] Re: . Problem with installation on Dreamhost Virtual Private Server
- Next by Date: [EP-tech] Re: Adding methods to EPrints::Database
- Previous by thread: [EP-tech] Re: . Problem with installation on Dreamhost Virtual Private Server
- Next by thread: [EP-tech] Re: Adding methods to EPrints::Database
- Index(es):