insipid.cgi

来自「Insipid 是一款基于Web书签仓库。很方面的记录下各种输入输出信息。」· CGI 代码 · 共 55 行

CGI
55
字号
#!/usr/bin/perl -wuse strict;# This stub checks for libraries and what not and then calls the main program.push(@INC, "lib");if(!-e "insipid-config.cgi") {	# TODO: Better error message here.	show_error("Configuration file missing", "The \"insipid-config.cgi\"" .		" file could not be found.");}eval {	require Insipid::Main;	Insipid::Main::main();};if($@) {	my $errstr = $@;		if($errstr =~ /Can\'t locate (.*) in/) {		show_error("Couldn't find the module \"$1\".", "You may want to " .			"<a href=\"http://search.cpan.org/\">search CPAN</a> " .			"for the module or check the " .			"<a href=\"http://www.neuro-tech.net/insipid/\">" .			"Insipid</a> homepage for more information.");	} elsif ($errstr =~ /Couldn\'t acquire lock on id/) {		# This means that a database connection was establishd but the		# tables were not found.		eval {			require Insipid::Database;			Insipid::Database::install();		};		if($@) {			show_error("Database error", "There was a problem " . 			"creating the database tables required by Insipid.");		}	} else {		print "Content-Type: text/plain\r\n\r\nError: $@\r\n";	}}sub show_error {	my ($subject, $body) = (@_);	print "Content-Type: text/html\r\n\r\n";	print "<html><head><title>Insipid Error</title></head>";	print "<body>";	print "<h2>$subject</h2>";	print "<p><font size=\"+1\"></font></p>";	print "<p><font size=\"+1\">$body";	print "</font></p></body></html>";	exit;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?