perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Wesemann <f.wesem...@fotofinder.net>
Subject Re: Strange problem with input charset ?
Date Mon, 03 Jan 2011 14:10:05 GMT
Jean-Christophe,
It seems reasonable for me that Embperl "executes" the .pdf files
since to told it to do in your httpd.conf

Why don't you just put your links something like this:
<a href="authorize_log_and_deliver_pdf.ep?file=my.pdf>click here</a>

And than in the .ep file do something like:

[*
execute(auth.epl ) ;
$http_headers_out{'Location'}= $fdat{'file'};

*]

In other words:
Do what you have to do and let Apache do its work.

Jean-Christophe Boggio schrieb:
> Well, maybe I should reword my question.
>
> I want to place links to PDF files on my site like :
>
> <a href="/pdf/v01.pdf">Click here to download</a>
>
> And I want to log the fact that someone downloaded the file.
>
> So I set Apache up so that all PDF files are handled by Embperl :
>
> EMBPERL_OBJECT_BASE base.epl
> <FilesMatch "\.(pdf|html)$">
>   SetHandler perl-script
>   PerlHandler Embperl::Object
>   Options ExecCGI
> </FilesMatch>
>
> Inside my "base.epl", I distinguish .pdf from .html and proceed
> accordingly :
>
> [$ if ($ENV{SCRIPT_NAME} =~ /\.pdf$/) $]
>   [-
>     $ENV{SCRIPT_NAME} =~ /.*\/(.*\.pdf)$/;
>     my $filename = $1;
>     Execute('auth.epl'); # This is where the logging takes place
>     if (open(PDF,$ENV{DOCUMENT_ROOT}.$ENV{SCRIPT_NAME})) {
>       $http_headers_out{'Content-type'}='application/pdf';
>       $http_headers_out{'Content-Disposition'}="attachment; 
> filename=$filename";
>       local ($/);
>       local ($escmode);
>       my $pdf=<PDF>;
>       print OUT $pdf;
>       close(PDF);
>     }
>     exit 1;
>   -]
> [$ endif $]
>
>


-- 
mit freundlichem Gruß,

Frank Wesemann
Fotofinder GmbH         USt-IdNr. DE812854514
Software Entwicklung    Web: http://www.fotofinder.com/
Potsdamer Str. 96       Tel: +49 30 25 79 28 90
10785 Berlin            Fax: +49 30 25 79 28 999

Sitz: Berlin
Amtsgericht Berlin Charlottenburg (HRB 73099)
Geschäftsführer: Ali Paczensky




---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message