Almost-minimal filesystem based blog.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.1 KiB

17 years ago
17 years ago
17 years ago
17 years ago
17 years ago
17 years ago
17 years ago
  1. #!/usr/bin/env perl
  2. =pod
  3. =head1 NAME
  4. wrt-fcgi - Sample FastCGI wrapper script for App::WRT
  5. =head1 DESCRIPTION
  6. Pulls in App::WRT and CGI::Fast, runs a configuration file, and loops over
  7. FastCGI queries, passing their parameters to C<App::WRT::display()>.
  8. Useful for local testing of output. Please do not expose to the public web.
  9. =cut
  10. use strict;
  11. use warnings;
  12. no warnings 'uninitialized';
  13. use App::WRT;
  14. use CGI::Fast;
  15. use Getopt::Long;
  16. use Pod::Usage;
  17. # Handle options, including help generated from the POD above. See:
  18. # - http://perldoc.perl.org/Getopt/Long.html#User-defined-subroutines-to-handle-options
  19. # - https://metacpan.org/pod/Pod::Usage
  20. # - http://michael.thegrebs.com/2014/06/08/Pod-Usage/
  21. my $config_file = 'wrt.json';
  22. GetOptions(
  23. 'config=s' => \$config_file,
  24. help => sub { pod2usage(0) },
  25. ) or pod2usage(2);
  26. my $w = App::WRT::new_from_file($config_file);
  27. # use Data::Dumper;
  28. # Handle input from FastCGI:
  29. while (my $query = CGI::Fast->new) {
  30. my @params = $query->multi_param('keywords');
  31. print "Content-Type: text/html\n\n";
  32. print $w->display(@params);
  33. }
  34. exit;