comparison src/http/modules/perl/ngx_http_perl_module.c @ 775:a452a0e13539

check nginx.pm version
author Igor Sysoev <igor@sysoev.ru>
date Thu, 12 Oct 2006 19:55:15 +0000
parents 7e24168b0853
children 6a99bc84c135
comparison
equal deleted inserted replaced
774:589841f06b87 775:a452a0e13539
563 static PerlInterpreter * 563 static PerlInterpreter *
564 ngx_http_perl_create_interpreter(ngx_http_perl_main_conf_t *pmcf, 564 ngx_http_perl_create_interpreter(ngx_http_perl_main_conf_t *pmcf,
565 ngx_log_t *log) 565 ngx_log_t *log)
566 { 566 {
567 int n; 567 int n;
568 char *embedding[6]; 568 STRLEN len;
569 SV *sv;
570 char *ver, *embedding[6];
569 PerlInterpreter *perl; 571 PerlInterpreter *perl;
570 572
571 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, log, 0, "create perl interpreter"); 573 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, log, 0, "create perl interpreter");
572 574
573 #if (NGX_HAVE_PERL_CLONE) 575 #if (NGX_HAVE_PERL_CLONE)
629 631
630 n = perl_parse(perl, ngx_http_perl_xs_init, n, embedding, NULL); 632 n = perl_parse(perl, ngx_http_perl_xs_init, n, embedding, NULL);
631 633
632 if (n != 0) { 634 if (n != 0) {
633 ngx_log_error(NGX_LOG_ALERT, log, 0, "perl_parse() failed: %d", n); 635 ngx_log_error(NGX_LOG_ALERT, log, 0, "perl_parse() failed: %d", n);
636 goto fail;
637 }
638
639 sv = get_sv("nginx::VERSION", FALSE);
640 ver = SvPV(sv, len);
641
642 if (ngx_strcmp(ver, NGINX_VERSION) != 0) {
643 ngx_log_error(NGX_LOG_ALERT, log, 0,
644 "version " NGINX_VERSION " of nginx.pm is required, "
645 "but %s was found", ver);
634 goto fail; 646 goto fail;
635 } 647 }
636 648
637 if (ngx_http_perl_run_requires(aTHX_ &pmcf->requires, log) != NGX_OK) { 649 if (ngx_http_perl_run_requires(aTHX_ &pmcf->requires, log) != NGX_OK) {
638 goto fail; 650 goto fail;