linux - 火狐 ("$linkurl");问题

标签 linux perl

谁能告诉我为什么 firefox 没有打开并添加了以下 Net::HTTPServer 行?

#!/usr/bin/perl
# v5.10.1 / linux
use strict;
use warnings;
use Shell;
use Net::HTTPServer;


############ section ###############
my $server = new Net::HTTPServer(
                                 port=>5000,
                                 docroot=>"/home/frank/Perl/perl_info_pages",
                                 log => "/home/frank/Perl/perl_info_pages/access.log",

                                 chroot => 0,        #       - Run the server behind a virtual chroot().
                                #  Since only root can actually call chroot,
                                #  a URL munger is provided that will not
                                #  allow URLs to go beyond the document root
                                #  if this is specified.
                                #   ( Default: 1 )  / true ???

                                # allow only for localhost... and user ***
                                # super server daemon control of??
                                # cgi...
                                  );

$server->Start();
$server->Process(); 
 ############# end of section ###################

 # can anyone tell me why these lines work(to open up firefox) with the above section commented out, but do not work when they are uncommented??
my $linkurl = 'http://localhost:5000';
firefox ("$linkurl");

最佳答案

正如在 HttpServer 文档中解释的那样,Process() 调用会阻塞并无限期地运行服务器,因此永远不会到达最后两行。

您可以做的最简单的事情是在 StartProcess 之间生成 Firefox 进程:套接字已经创建,当进程生成代码将已经返回服务器将开始运行。

关于linux - 火狐 ("$linkurl");问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7497524/

相关文章:

perl - 如何安装pp(PAR打包器)?

perl - Devel::Cover 条件三元运算符的分支覆盖

c++ - 调用 execl 时找不到 Grep

linux - 配置SVN通过TOR代理

centos 6.4 上的 mysql 5.5

regex - 计算 Perl 中字符串中非空白字符的数量

linux - 如何使用单行 Perl 命令在 Linux 中将数据转换为列并创建 CSV 文件

linux - 如何从本地计算机 [windows 7] 运行和恢复远程计算机 [linux] 中的 Eclipse

regex - 用小写字母替换下划线

eclipse - 在其他 Perl 模块中使用 Perl 自定义模块的正确方法