Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 使用perl'更改目录;s托克语法分析器_Html_Perl_Parsing_Web Crawler - Fatal编程技术网

Html 使用perl'更改目录;s托克语法分析器

Html 使用perl'更改目录;s托克语法分析器,html,perl,parsing,web-crawler,Html,Perl,Parsing,Web Crawler,打开文件进行解析时(例如,在$htmlFileName之前添加目录),如何更改解析器的目录外观 要更改Perl中的目录,请执行以下操作: chdir($dir); perldoc说: chdir EXPR chdir FILEHANDLE chdir DIRHANDLE chdir Changes the working directory to EXPR, if possible. If EXPR is omitted, changes to the directory specifi

打开文件进行解析时(例如,在$htmlFileName之前添加目录),如何更改解析器的目录外观


要更改Perl中的目录,请执行以下操作:

chdir($dir);
perldoc
说:

chdir EXPR
chdir FILEHANDLE
chdir DIRHANDLE
chdir   Changes the working directory to EXPR, if possible.  If EXPR is omitted, changes to the directory specified by $ENV{HOME}, if set; if not, changes to the directory specified by
        $ENV{LOGDIR}.  (Under VMS, the variable $ENV{SYS$LOGIN} is also checked, and used if it is set.)  If neither is set, "chdir" does nothing.  It returns true on success, false
        otherwise.  See the example under "die".

            On systems that support fchdir(2), you may pass a filehandle or directory handle as the argument.  On systems that don't support fchdir(2), passing handles raises an exception.
注意


另一种解决方案是将完整路径放在
$htmlFileName

中,以更改Perl中的目录:

chdir($dir);
my $p = HTML::TokeParser->new("/foo/bar/$htmlFileName")
    or die $!;
perldoc
说:

chdir EXPR
chdir FILEHANDLE
chdir DIRHANDLE
chdir   Changes the working directory to EXPR, if possible.  If EXPR is omitted, changes to the directory specified by $ENV{HOME}, if set; if not, changes to the directory specified by
        $ENV{LOGDIR}.  (Under VMS, the variable $ENV{SYS$LOGIN} is also checked, and used if it is set.)  If neither is set, "chdir" does nothing.  It returns true on success, false
        otherwise.  See the example under "die".

            On systems that support fchdir(2), you may pass a filehandle or directory handle as the argument.  On systems that don't support fchdir(2), passing handles raises an exception.
注意

另一个解决方案是将完整路径放入
$htmlFileName

my $p = HTML::TokeParser->new("/foo/bar/$htmlFileName")
    or die $!;