Hi!

$c is hash reference with key "can_request_view_document";

The value for that key is anonymous sub.

You can call this sub like this

$c->{can_request_view_document}->($doc, $r);



On 7/20/18 6:04 PM, James Kerwin wrote:
Afternoon all,

I have been asked to take a look at a .pl file which is part of a set-up called "EPrints". The particular file controls who can access documents on a server.

Excluding some comments, the file starts like:

$c->{can_request_view_document} = sub
{
        my( $doc, $r ) = @_;

It then goes on to complete the subroutine and return a value.

I understand that $doc and $r are populated via @_ but I have never before seen the structure of the first line starting with "$c". Additionally, the file doesn't look like a typical Perl file (eg.#!/usr/bin/perl -w at the top and some use statements).

I know it's very vague, but could anybody explain this syntax to me? My suspicion is that something else is calling the subroutines in this file? Am I at least on the right track?

Thanks,
James

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to