#!/usr/bin/perl # See the Apache2::Subprocess documentation located at # http://perl.apache.org/docs/2.0/api/Apache2/SubProcess.html for # information on spawning subprocesses. # # Be careful with global variables in mod_perl! See # http://modperlbook.org/html/ch06_02.html use strict; use warnings; use Apache2::SubProcess (); use Config; use constant PERLIO_IS_ENABLED => $Config{useperlio}; use HTML::Entities; my $r = shift; print "Content-type: text/html\r\n\r\n"; print "

grid-proxy-info

\n"; print "
\n";
get_output("$ENV{GLOBUS_LOCATION}/bin/grid-proxy-info", \$r);
print "
\n"; sub get_output { my $program = shift; my $r = shift; my @output; my $fh = $$r->spawn_proc_prog($program); print encode_entities($_) while ($_ = read_data($fh)); } # this function comes directly from the Apache2::Subprocess documentation sub read_data { my $fh = shift; my $data; if (PERLIO_IS_ENABLED || IO::Select->new($fh)->can_read(10)) { $data = <$fh>; } return defined $data ? $data : ''; }