2010年9月21日星期二

Re: [PerlChina] Any event for this/next month?

谢谢指出,已经改正了。这往往是 \n 的时候的忘了需要跳出成  \\n 导致的问题,原始教材对的地方的错误都是我在翻译时候的错误 :)

2010/9/21 Vayn <dreamx007@gmail.com>
http://emisweb03.securities.com/ovid-cgi/lesson_3.html
19. open FILE, "<$data" or die "Cannot open $data: $!
如果不是例子本身想说明什么,那就是个小错误。
p.s. 教程写的很有趣

2010/9/21 joe jiang <lamp.purl@gmail.com>
Fixed, thanks for this info.

2010/9/21 Vayn <dreamx007@gmail.com>

http://emisweb03.securities.com/ovid-cgi/lesson_2.html
&ltinput type="text" name="Enter something">
代码被显示出来了

2010/9/21 joe jiang <lamp.purl@gmail.com>
这个月,或者下个月会有什么聚会么?最近是难得的空闲时间。

BTW I have done some translation of http://wiki.perlchina.org/Ovid_的_CGI_教程
Please help to move more of them into that wiki, the original english text is at http://jdporter.perlmonk.org/cgi_course/
My temporary place of the full translation is at http://emisweb03.securities.com/ovid-cgi

--
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。



--
no panic.

--
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

--
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。



--
no panic.

--
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

--
您收到此邮件是因为您订阅了 Google 网上论坛的"PerlChina Mongers 讨论组"论坛。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

Re: [PerlChina] Any event for this/next month?

On 09/21/2010 06:16 AM, joe jiang wrote:
> 这个月,或者下个月会有什么聚会么?最近是难得的空闲时间。

谢谢提醒,是再次聚会的时候啦。大概10月晚些时候我来组织一下。

Qiang

>
> BTW I have done some translation of http://wiki.perlchina.org/Ovid_的
> _CGI_教程 <http://wiki.perlchina.org/Ovid_%E7%9A%84_CGI_%E6%95%99%E7%A8%8B>
> Please help to move more of them into that wiki, the original english
> text is at http://jdporter.perlmonk.org/cgi_course/
> My temporary place of the full translation is at
> http://emisweb03.securities.com/ovid-cgi
>
> --
> 您收到此邮件是因为您订阅了 Google 网上论坛的"PerlChina Mongers 讨论组"论坛。
> 要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
> 要取消订阅此网上论坛,请发送电子邮件至
> perlchina+unsubscribe@googlegroups.com。
> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN
> 访问此网上论坛。

--
您收到此邮件是因为您订阅了 Google 网上论坛的"PerlChina Mongers 讨论组"论坛。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

2010年9月20日星期一

Re: [PerlChina] Any event for this/next month?

http://emisweb03.securities.com/ovid-cgi/lesson_3.html
19. open FILE, "<$data" or die "Cannot open $data: $!
如果不是例子本身想说明什么,那就是个小错误。
p.s. 教程写的很有趣

2010/9/21 joe jiang <lamp.purl@gmail.com>
Fixed, thanks for this info.

2010/9/21 Vayn <dreamx007@gmail.com>

http://emisweb03.securities.com/ovid-cgi/lesson_2.html
&ltinput type="text" name="Enter something">
代码被显示出来了

2010/9/21 joe jiang <lamp.purl@gmail.com>
这个月,或者下个月会有什么聚会么?最近是难得的空闲时间。

BTW I have done some translation of http://wiki.perlchina.org/Ovid_的_CGI_教程
Please help to move more of them into that wiki, the original english text is at http://jdporter.perlmonk.org/cgi_course/
My temporary place of the full translation is at http://emisweb03.securities.com/ovid-cgi

--
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。



--
no panic.

--
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

--
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。



--
no panic.

--
您收到此邮件是因为您订阅了 Google 网上论坛的"PerlChina Mongers 讨论组"论坛。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

Re: [PerlChina] Any event for this/next month?

Fixed, thanks for this info.

2010/9/21 Vayn <dreamx007@gmail.com>
http://emisweb03.securities.com/ovid-cgi/lesson_2.html
&ltinput type="text" name="Enter something">
代码被显示出来了

2010/9/21 joe jiang <lamp.purl@gmail.com>
这个月,或者下个月会有什么聚会么?最近是难得的空闲时间。

BTW I have done some translation of http://wiki.perlchina.org/Ovid_的_CGI_教程
Please help to move more of them into that wiki, the original english text is at http://jdporter.perlmonk.org/cgi_course/
My temporary place of the full translation is at http://emisweb03.securities.com/ovid-cgi

--
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。



--
no panic.

--
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

--
您收到此邮件是因为您订阅了 Google 网上论坛的"PerlChina Mongers 讨论组"论坛。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

Re: [PerlChina] Any event for this/next month?

http://emisweb03.securities.com/ovid-cgi/lesson_2.html
&ltinput type="text" name="Enter something">
代码被显示出来了

2010/9/21 joe jiang <lamp.purl@gmail.com>
这个月,或者下个月会有什么聚会么?最近是难得的空闲时间。

BTW I have done some translation of http://wiki.perlchina.org/Ovid_的_CGI_教程
Please help to move more of them into that wiki, the original english text is at http://jdporter.perlmonk.org/cgi_course/
My temporary place of the full translation is at http://emisweb03.securities.com/ovid-cgi

--
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。



--
no panic.

--
您收到此邮件是因为您订阅了 Google 网上论坛的"PerlChina Mongers 讨论组"论坛。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

[PerlChina] Any event for this/next month?

这个月,或者下个月会有什么聚会么?最近是难得的空闲时间。

BTW I have done some translation of http://wiki.perlchina.org/Ovid_的_CGI_教程
Please help to move more of them into that wiki, the original english text is at http://jdporter.perlmonk.org/cgi_course/
My temporary place of the full translation is at http://emisweb03.securities.com/ovid-cgi

--
您收到此邮件是因为您订阅了 Google 网上论坛的"PerlChina Mongers 讨论组"论坛。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

2010年9月19日星期日

[PerlChina] lwp实现鉴权并下载文件

大家好,
 
我第一次用lwp遇到了困难,请大家给点建议。
 
想用lwp实现下面的情景(在浏览器下手动跑没有问题):浏览器地址栏输入一个URL(https),然后用户被要求输入用户名和密码,输入正确后,弹出了保存文件的对话框,保存文件到本地。
 
我的做法:我先连同用户名,密码,发送URL,得到的回复如下:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://xxx">here</a>.</p>
</body></html>
我猜这是让我到 href指向的链接去拿文件吧?然后我用TokenParser把这个新的URL解析出来,连同我原来的用户名密码发出去,然后print reseponse->content() 为空!
 
不知道是哪里不对,这种问题怎么debug呢?

# cat -n lwp.pl
     1  #!/usr/bin/perl
     2
     3  use strict;
     4  use LWP;
     5  use HTML::TokeParser;
     6
     7  my $user   = 'xxxxxx';
     8  my $passwd = 'xxxxxx';
     9
    10  my $browser = LWP::UserAgent->new();
    11
    12  my $url = 'https://......';
    13  my $response =
    14    $browser->post( $url, [ 'username' =>, $user, 'password' => $passwd ], );
    15  my $content = $response->content();
    16
    17  my $stream = HTML::TokeParser->new( \$content );
    18  my $relink;
    19  while ( my $token = $stream->get_token() ) {
    20      if ( $token->[0] eq 'S' ) {
    21          my ( $tagname, $attr ) = @$token[ 1, 2 ];
    22          print "tag:", $tagname, "\n";
    23          if ( $tagname eq 'a' ) {
    24              $relink = $attr->{'href'};
    25          }
    26      }
    27  }
    28
    29  print "relink", $relink, "\n";
    30
    31  $response = $browser->post(
    32      $relink,
    33      [
    34          username => $user,
    35          password => $passwd,
    36      ]
    37  );
    38  print "response begin\n";
    39  print $response->content(); # ..
    40  print "response end \n";
    41