我正在开发一个perl程序,我有一个显示一些信息的脚本。在显示该页面之前,我需要对页面进行一些登录。我尝试过使用"要求"函数在我的主脚本中调用另一个要求输入用户名和密码的脚本。当满足登录条件时,我需要自动返回原始程序。 请帮帮我。
文件1:
require 'index.pl';
文件2:
sub print_form {
my $query = new CGI; use vars qw($userid $pword);
my $password_dir = '/opt/app/d1pre2w1/sites/apache/cgi-bin-new/';
my $pword_file = "commit_access_control.cfg";
my $passwrd_location = $pword_file;
print("<td><form> \n", "USERNAME :", "<input type=text name=USERNAME >", "<br>", "PASSWORD :", "<input type=password name=PASSWORD>", "<br>", "<input type=submit name=login value=Login>", "</form>");
答案 0 :(得分:3)
从你的问题来看,你看起来有两个问题:
您正在使用古老且不明智的Perl教程。 2015年没有人(更不用说2001年)会建议使用{"project_info":{"project_id":"xxxxxxx","project_number":"xxxxxx","name":"fleeber"},"client":[{"client_info":{"mobilesdk_app_id":"xxxxxxx","client_id":"android:com.fleeber","client_type":1,"android_client_info":{"package_name":"com.fleeber"}},"oauth_client":[{"client_id":"xxxxxxxxxx","client_type":1,"android_info":{"package_name":"com.fleeber","certificate_hash":"xxxxxxxxxxxxxxx"}},{"client_id":"xxxxxxxxxxxxxx","client_type":1,"android_info":{"package_name":"com.fleeber.debug","certificate_hash":"xxxxxxxxxxx"}}],"api_key":[],"services":{"analytics_service":{"status":2,"analytics_property":{"tracking_id":"xxxxxxxxx"}},"cloud_messaging_service":{"status":2,"apns_config":[]},"appinvite_service":{"status":2,"other_platform_oauth_client":[{"client_id":"xxxxxxxxxx","client_type":2,"ios_info":{"bundle_id":"com.fleeber.prod","app_store_id":""}}]},"google_signin_service":{"status":2},"ads_service":{"status":1}}}],"client_info":[],"ARTIFACT_VERSION":"1"}
进行代码重用。
您不了解Web应用程序的工作原理。您无法编写单个应用程序脚本,该脚本将从一个州顺利流动到另一个州。相反,您必须创建一个与客户端进行对话的系统。虽然基于CGI的技术几乎不是现代技术,但它们确实可以工作并构成许多当前技术的基础。查看Ovid's CGI Course。一旦您对此感到满意,请查看Mojolicious,Catalyst或Dancer,了解更多现代的Perl Web开发方法。