Anyone know about perl authenticator

I am very new to Perl and just started working with it, having learned JavaScript first. I am wondering if there could be a validator for checking Perl code (like Firebug for JS). If someone knows the reliable, that would be greatly appreciated. I have done this many times at Googled with very little success, and, as we all know, with learning new language errors. Thanks in advance!

+3
source share
4 answers

What about Perl itself?

perl -c your_program.pl

If you add the following at the beginning of your programs, you will avoid many headaches.

use strict;
use warnings;
use diagnostics;

Finally, Perl :: Critic .

+17
source

here is online authentication

perl -c filename. PerlTidy., . - .

STDERR. HTTPD- STDERR . , , STDOUT, .

carpout(). carpout() , ,

 use CGI::Carp qw(carpout);

carpout() , . BEGIN CGI, . :

 BEGIN {
    use CGI::Carp qw(carpout);
    open(LOG, ">>/usr/local/cgi-logs/mycgi-log") or
    die("Unable to open mycgi-log: $!\n");
    carpout(LOG);
    }

carpout() . , carpout() , .

STDERR - CGI:: Carp:: SAVEERR. CGI , script STDOUT STDERR. CGI:: Carp:: SAVEERR, .

carpout() . "" - GLOB:

carpout (* LOG);

:

carpout(LOG);
carpout(main::LOG);
carpout(main'LOG);
carpout(\LOG);
carpout(\'main::LOG');
... and so on

FileHandle .

(, ) , "fatalsToBrowser":

 use CGI::Carp qw(fatalsToBrowser);
    die "Bad error here";

, . CGI:: Carp HTTP- , , . ( ).

* , fatalsToBrowser mod_perl 2.0 . *

- . , , set_message(). ; use():

use CGI::Carp qw(fatalsToBrowser set_message);
set_message("It not a bug, it a feature!");

, . , - script . :

use CGI::Carp qw(fatalsToBrowser set_message);
BEGIN {
sub handle_errors {
my $msg = shift;
print "<h1>Oh gosh</h1>";
print "<p>Got an error: $msg</p>";
}
set_message(\&handle_errors);
}
+6

perl - , , ; , , , . , , .

, , , perl.

, Perl:: Critic.

+6

. http://perldoc.perl.org/perldebug.html, , , Firebug. .

  • ,    ;    ;

  • http://perltidy.sourceforge.net/ .

  • The CPAN Perl :: Critic module performs automated code analysis to enforce certain style decisions. A consistent style makes tracking errors easier.
  • Use unit tests. The main module Test :: More simplifies the work with this.
+5
source

Source: https://habr.com/ru/post/1789829/


All Articles