Advertisement
Guest User

OMD Thruk

a guest
Jul 25th, 2011
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.45 KB | None | 0 0
  1. root@brmss-noc:~# vi /omd/sites/entsf/lib/perl5/lib/perl5/Catalyst/ScriptRunner.pm
  2.  
  3. package Catalyst::ScriptRunner;
  4. use Moose;
  5. use FindBin;
  6. use lib;
  7. use File::Spec;
  8. use namespace::autoclean;
  9.  
  10. sub run {
  11. my ($self, $class, $scriptclass) = @_;
  12. my $classtoload = "${class}::Script::$scriptclass";
  13.  
  14. lib->import(File::Spec->catdir($FindBin::Bin, '..', 'lib'));
  15.  
  16. unless ( eval { Class::MOP::load_class($classtoload) } ) {
  17. warn("Could not load $classtoload - falling back to Catalyst::Script::$scriptclass : $@\n")
  18. if $@ !~ /Can't locate/;
  19. $classtoload = "Catalyst::Script::$scriptclass";
  20. Class::MOP::load_class($classtoload);
  21. }
  22. $classtoload->new_with_options( application_name => $class )->run;
  23. }
  24.  
  25. __PACKAGE__->meta->make_immutable;
  26.  
  27. =head1 NAME
  28.  
  29. Catalyst::ScriptRunner - The Catalyst Framework script runner
  30.  
  31. =head1 SYNOPSIS
  32.  
  33. # Will run MyApp::Script::Server if it exists, otherwise
  34. # will run Catalyst::Script::Server.
  35. Catalyst::ScriptRunner->run('MyApp', 'Server');
  36.  
  37. =head1 DESCRIPTION
  38.  
  39. This class is responsible for running scripts, either in the application specific namespace
  40. (e.g. C<MyApp::Script::Server>), or the Catalyst namespace (e.g. C<Catalyst::Script::Server>)
  41.  
  42. =head1 METHODS
  43.  
  44. =head2 run ($application_class, $scriptclass)
  45.  
  46. Called with two parameters, the application classs (e.g. MyApp)
  47. and the script class, (i.e. one of Server/FastCGI/CGI/Create/Test)
  48.  
  49. =head1 AUTHORS
  50.  
  51. Catalyst Contributors, see Catalyst.pm
  52.  
  53. =head1 COPYRIGHT
  54.  
  55. This library is free software. You can redistribute it and/or modify it under
  56. the same terms as Perl itself.
  57.  
  58. =cut
  59.  
  60. ----------------------------------------------------------------------------------------------
  61.  
  62.  
  63. root@brmss-noc:~# vi /omd/sites/entsf/share/thruk/script/thruk_fastcgi.pl
  64.  
  65.  
  66. use Config;
  67. if(-e $FindBin::Bin."/../local-lib") {
  68. ### use 5.10.0; # only required for packages ###
  69. use lib $FindBin::Bin."/../local-lib/lib/perl5";
  70. if(! -e $FindBin::Bin."/../local-lib/lib/perl5/".$Config{archname}) {
  71. die("\nERROR: this is the wrong precompiled version, your archname is: ".$Config{archname}."\n\n");
  72. }
  73. require local::lib; local::lib->import($FindBin::Bin."/../local-lib/perl5/");
  74. }
  75. }
  76.  
  77. use Catalyst::ScriptRunner;
  78. Catalyst::ScriptRunner->run('Thruk', 'FastCGI');
  79.  
  80. 1;
  81.  
  82. =head1 NAME
  83.  
  84. thruk_fastcgi.pl - Catalyst FastCGI
  85.  
  86. =head1 SYNOPSIS
  87.  
  88. thruk_fastcgi.pl [options]
  89.  
  90. Options:
  91. -? -help display this help and exits
  92. -l --listen Socket path to listen on
  93. (defaults to standard input)
  94. can be HOST:PORT, :PORT or a
  95. filesystem path
  96. -n --nproc specify number of processes to keep
  97. to serve requests (defaults to 1,
  98. requires -listen)
  99. -p --pidfile specify filename for pid file
  100. (requires -listen)
  101. -d --daemon daemonize (requires -listen)
  102. -M --manager specify alternate process manager
  103. (FCGI::ProcManager sub-class)
  104. or empty string to disable
  105. -e --keeperr send error messages to STDOUT, not
  106. to the webserver
  107.  
  108. =head1 DESCRIPTION
  109.  
  110. Run a Catalyst application as fastcgi.
  111.  
  112. =head1 AUTHORS
  113.  
  114. Catalyst Contributors, see Catalyst.pm
  115.  
  116. =head1 COPYRIGHT
  117.  
  118. This library is free software. You can redistribute it and/or modify
  119. it under the same terms as Perl itself.
  120.  
  121. =cut
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement