Re: Problem with loading dynamic libraries
Artem Harutyunyan wrote: However, when I run the script under apache (with mod_perl) I see that LD_LIBRARY_PATH is ignored (I mean it seems to load the libraries from another location). How can I fix the problem ? What OS are you running? I know at least for linux LD_LIBRARY_PATH is special (for security reasons). It can't be set from within the process that's going to need it. It must be set from outside. I've fixed this by setting it in my script that starts/stops apache. 2) I have several installations of perl. How can I find out (and change if necessary) which one is used by mod_perl ? mod_perl doesn't pick a perl binary to use. It is a Perl interpreter. And it's the same version that you compiled it against. The only way to change it's version is to recompile mod_perl using another perl binary. -- Michael Peters Developer Plus Three, LP
Re: Problem with loading dynamic libraries
Hi Michael, Thank you very much for the exhaustive answer. Artem. On 8/15/07, Michael Peters [EMAIL PROTECTED] wrote: Artem Harutyunyan wrote: However, when I run the script under apache (with mod_perl) I see that LD_LIBRARY_PATH is ignored (I mean it seems to load the libraries from another location). How can I fix the problem ? What OS are you running? I know at least for linux LD_LIBRARY_PATH is special (for security reasons). It can't be set from within the process that's going to need it. It must be set from outside. I've fixed this by setting it in my script that starts/stops apache. 2) I have several installations of perl. How can I find out (and change if necessary) which one is used by mod_perl ? mod_perl doesn't pick a perl binary to use. It is a Perl interpreter. And it's the same version that you compiled it against. The only way to change it's version is to recompile mod_perl using another perl binary. -- Michael Peters Developer Plus Three, LP
Problem with loading dynamic libraries
Hi, I have 2 questions: 1) There is a script which uses Authen::SASL::Cyrus module. During the work the module needs to load some external dynamic libraries (.so files). To have correct libraries loaded I set LD_LIBRARY_PATH, this works when running my script with usual (command line) perl. However, when I run the script under apache (with mod_perl) I see that LD_LIBRARY_PATH is ignored (I mean it seems to load the libraries from another location). How can I fix the problem ? 2) I have several installations of perl. How can I find out (and change if necessary) which one is used by mod_perl ? Thanks in advance for help, Artem. PS The apache version is 2.0.55 and mod_perl is 2.0.1
Re: Correct way to upload a file
Thanks Fred. The problem is, I don't have access to httpd.conf, therefore I can't run scripts like that. Is there an alternative? TIA On 8/13/07, Fred Moyer [EMAIL PROTECTED] wrote: [please cc the mod_perl list when responding] Mag Gam wrote: Fred: Thanks. Looks like I may look into Mason for its simplification. I don't think I have a the patience or enthusiasm to learn the REquestReq feature of Mp2. It's not that hard, I would say it's no more complex than Mason (but there are varying schools of thought on that subject which I will not go into here). Here is a hello world handler to give you an example of how to get started. conf/httpd.conf -- Location / SetHandler perl-script # tells apache mod_perl handles the request PerlResponseHandler My::Hello # My::Hello::handler handles / requests /Location lib/My/Hello.pm package My::Hello; use strict; use warnings; use Apache2::RequestRec (); # for $r-content_type use Apache2::RequestIO (); # for $r-print use Apache2::Const -compile = qw( OK ); # for Apache2::Const::OK sub handler { my $r = shift; # == here is where you get $r $r-content_type('text/plain'); # set the content type to text/plain $r-print(Hello world!); # print the response to the client return Apache2::Const::OK; # return 200 OK } HTH On 8/11/07, *Fred Moyer* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: I noticed I have to use Apache::Request and Apache::Cookie. In, http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html, there is a $r which is request object. How do I create that? Is there an example anywhere I can follow? It sounds like you haven't created a mod_perl handler before, this page should answer your questions. http://perl.apache.org/docs/2.0/user/intro/start_fast.html On 8/10/07, Jonathan Vanasco [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: On Aug 10, 2007, at 10:25 PM, Mag Gam wrote: I have just started learning perl and mod_perl, and I must admit I am enjoying it a lot! I am tying to upload a file, so I can do some calculations to the file, my question is what is the correct and most efficient way to upload the file, and perform the calculations? Should I consider using the CGI module? libapreq http://httpd.apache.org/apreq/ CGI is a close second
practical mod_perl
Hi all Anyone who has the Practical Mod_perl (chm/pdf), please give me a copy. Thanks Good luck. Luke
Class inheritance, and SUPER under mod_perl2
Hello all, I am quite new to Perl, mod_perl and mod_perl2 so please excuse me for my questions. It my sounds noobish. In the code below, the class XXX:YYY3 inherits Net::Cmd, IO::Socket::Inet, create an object $obj with the SUPER keyword. As far as I know, this code works well under Apache 1.3, Perl 5.6, mod_perl 1.3. But in current environment which consists Apache 2.0.52, Perl 5.8, mod_perl 2.0.3, $obj becomes undefined (!!) after it is called with SUPER. Anyone gets any clues? Here is the code: -- package XXX::YYY3; @ISA = qw(Net::Cmd IO::Socket::INET); sub new { my $self = shift; my $type = ref($self) || $self; my $hosts = localhost; my $obj; my @localport = (); my $h; foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 ) and last; } # obj is undefined now. why? unless ( defined $obj ) { $sl-log_serror(__FILE__, __LINE__, Apache2::Const::LOG_ERR, APR::Const::SUCCESS, XXX:: undef obj! ERROR. ); } # vuhung # ref: http://www.perlmonks.org/?node_id=495975 return undef unless defined $obj; }
Re: practical mod_perl
Luke Lu wrote: Hi all Anyone who has the Practical Mod_perl (chm/pdf), please give me a copy. http://www.modperlbook.org/ --Geoff
Re: 答复: Class inheritance, and SUPER un der mod_perl2
This code didn't run. I don't think we can put an if clause inside $type-SUPER::new(...) The error I got when running this code is: syntax error at /XXX/YYY3.pm line 74, near if\nsyntax error at /XXX/YYY3.pm line 77, near } else\nsyntax error at /XXX/YYY3.pm line 82, near Luke Lu さんは��きました: Hi, In this part: foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 ) and last; } You can debug it like this foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 If (defined ($obj)) { Print ok; } Else { Print bad; } ) and last; } According to this ,you can check it whether every time it will be 'ok' or not. If the last time is output 'bad', then you can find the real reason If still have any question,please contact with me/ luke -邮件原件- 发件人: Nguyen Vu Hung [mailto:[EMAIL PROTECTED] 发送时间: 2007年8月16日 8:58 收件人: modperl@perl.apache.org 主题: Class inheritance, and SUPER under mod_perl2 Hello all, I am quite new to Perl, mod_perl and mod_perl2 so please excuse me for my questions. It my sounds noobish. In the code below, the class XXX:YYY3 inherits Net::Cmd, IO::Socket::Inet, create an object $obj with the SUPER keyword. As far as I know, this code works well under Apache 1.3, Perl 5.6, mod_perl 1.3. But in current environment which consists Apache 2.0.52, Perl 5.8, mod_perl 2.0.3, $obj becomes undefined (!!) after it is called with SUPER. Anyone gets any clues? Here is the code: -- package XXX::YYY3; @ISA = qw(Net::Cmd IO::Socket::INET); sub new { my $self = shift; my $type = ref($self) || $self; my $hosts = localhost; my $obj; my @localport = (); my $h; foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 ) and last; } # obj is undefined now. why? unless ( defined $obj ) { $sl-log_serror(__FILE__, __LINE__, Apache2::Const::LOG_ERR, APR::Const::SUCCESS, XXX:: undef obj! ERROR. ); } # vuhung # ref: http://www.perlmonks.org/?node_id=495975 return undef unless defined $obj; }
Re: 答复: 答复: Class inheritance, and SU PER under mod_perl2
Actually I did exactly what you told me yesterday and $obj was still undefined. Here is the code ( check if $obj is undefined inside foreach ) package XXX::YYY3; @ISA = qw(Net::Cmd IO::Socket::INET); sub new { my $self = shift; my $type = ref($self) || $self; my $hosts = localhost; my $obj; my @localport = (); my $h; foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 );# and last; # obj is undefined now. so weird. unless ( defined $obj ) { $sl-log_serror(__FILE__, __LINE__, Apache2::Const::LOG_ERR, APR::Const::SUCCESS, XXX:: undef obj! ERROR. ); } last; } Luke Lu さんは��きました: Ok, so sorry, You only put the print ... inside the foreach. Please try it. -邮件原件- 发件人: Nguyen Vu Hung [mailto:[EMAIL PROTECTED] 发送时间: 2007年8月16日 9:24 收件人: Luke Lu 抄送: modperl@perl.apache.org 主题: Re: 答复: Class inheritance, and SUPER under mod_perl2 This code didn't run. I don't think we can put an if clause inside $type-SUPER::new(...) The error I got when running this code is: syntax error at /XXX/YYY3.pm line 74, near if\nsyntax error at /XXX/YYY3.pm line 77, near } else\nsyntax error at /XXX/YYY3.pm line 82, near Luke Lu さんは��きました: Hi, In this part: foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 ) and last; } You can debug it like this foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 If (defined ($obj)) { Print ok; } Else { Print bad; } ) and last; } According to this ,you can check it whether every time it will be 'ok' or not. If the last time is output 'bad', then you can find the real reason If still have any question,please contact with me/ luke -邮件原件- 发件人: Nguyen Vu Hung [mailto:[EMAIL PROTECTED] 发送时间: 2007年8月16日 8:58 收件人: modperl@perl.apache.org 主题: Class inheritance, and SUPER under mod_perl2 Hello all, I am quite new to Perl, mod_perl and mod_perl2 so please excuse me for my questions. It my sounds noobish. In the code below, the class XXX:YYY3 inherits Net::Cmd, IO::Socket::Inet, create an object $obj with the SUPER keyword. As far as I know, this code works well under Apache 1.3, Perl 5.6, mod_perl 1.3. But in current environment which consists Apache 2.0.52, Perl 5.8, mod_perl 2.0.3, $obj becomes undefined (!!) after it is called with SUPER. Anyone gets any clues? Here is the code: -- package XXX::YYY3; @ISA = qw(Net::Cmd IO::Socket::INET); sub new { my $self = shift; my $type = ref($self) || $self; my $hosts = localhost; my $obj; my @localport = (); my $h; foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 ) and last; } # obj is undefined now. why? unless ( defined $obj ) { $sl-log_serror(__FILE__, __LINE__, Apache2::Const::LOG_ERR, APR::Const::SUCCESS, XXX:: undef obj! ERROR. ); } # vuhung # ref: http://www.perlmonks.org/?node_id=495975 return undef unless defined $obj; }
Re: 答复: 答复: 答复: Class inheritance, and SUPER under mod_perl2
Yes, it was undefined even inside foreach. You can see it above the debug lines on my code. Luke Lu さんは��きました: Hi, the $obj is undefined everytime? -邮件原件- 发件人: Nguyen Vu Hung [mailto:[EMAIL PROTECTED] 发送时间: 2007年8月16日 9:34 收件人: Luke Lu 抄送: modperl@perl.apache.org 主题: Re: 答复: 答复: Class inheritance, and SUPER under mod_perl2 Actually I did exactly what you told me yesterday and $obj was still undefined. Here is the code ( check if $obj is undefined inside foreach ) package XXX::YYY3; @ISA = qw(Net::Cmd IO::Socket::INET); sub new { my $self = shift; my $type = ref($self) || $self; my $hosts = localhost; my $obj; my @localport = (); my $h; foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 );# and last; # obj is undefined now. so weird. unless ( defined $obj ) { $sl-log_serror(__FILE__, __LINE__, Apache2::Const::LOG_ERR, APR::Const::SUCCESS, XXX:: undef obj! ERROR. ); } last; } Luke Lu さんは��きました: Ok, so sorry, You only put the print ... inside the foreach. Please try it. -邮件原件- 发件人: Nguyen Vu Hung [mailto:[EMAIL PROTECTED] 发送时间: 2007年8月16日 9:24 收件人: Luke Lu 抄送: modperl@perl.apache.org 主题: Re: 答复: Class inheritance, and SUPER under mod_perl2 This code didn't run. I don't think we can put an if clause inside $type-SUPER::new(...) The error I got when running this code is: syntax error at /XXX/YYY3.pm line 74, near if\nsyntax error at /XXX/YYY3.pm line 77, near } else\nsyntax error at /XXX/YYY3.pm line 82, near Luke Lu さんは��きました: Hi, In this part: foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 ) and last; } You can debug it like this foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 If (defined ($obj)) { Print ok; } Else { Print bad; } ) and last; } According to this ,you can check it whether every time it will be 'ok' or not. If the last time is output 'bad', then you can find the real reason If still have any question,please contact with me/ luke -邮件原件- 发件人: Nguyen Vu Hung [mailto:[EMAIL PROTECTED] 发送时间: 2007年8月16日 8:58 收件人: modperl@perl.apache.org 主题: Class inheritance, and SUPER under mod_perl2 Hello all, I am quite new to Perl, mod_perl and mod_perl2 so please excuse me for my questions. It my sounds noobish. In the code below, the class XXX:YYY3 inherits Net::Cmd, IO::Socket::Inet, create an object $obj with the SUPER keyword. As far as I know, this code works well under Apache 1.3, Perl 5.6, mod_perl 1.3. But in current environment which consists Apache 2.0.52, Perl 5.8, mod_perl 2.0.3, $obj becomes undefined (!!) after it is called with SUPER. Anyone gets any clues? Here is the code: -- package XXX::YYY3; @ISA = qw(Net::Cmd IO::Socket::INET); sub new { my $self = shift; my $type = ref($self) || $self; my $hosts = localhost; my $obj; my @localport = (); my $h; foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 ) and last; } # obj is undefined now. why? unless ( defined $obj ) { $sl-log_serror(__FILE__, __LINE__, Apache2::Const::LOG_ERR, APR::Const::SUCCESS, XXX:: undef obj! ERROR. ); } # vuhung # ref: http://www.perlmonks.org/?node_id=495975 return undef unless defined $obj; }
Re: 答复: 答复: Class inheritance, and SUPER under mod_perl2
Nguyen Vu Hung [EMAIL PROTECTED] writes: Here is the code ( check if $obj is undefined inside foreach ) package XXX::YYY3; @ISA = qw(Net::Cmd IO::Socket::INET); sub new { my $self = shift; my $type = ref($self) || $self; my $hosts = localhost; my $obj; my @localport = (); my $h; foreach $h (@{$hosts}) Are you using symrefs or something? $hosts here is a scalar, not an arrayref. Are you sure the loop is being entered at all? -- Joe Schaefer
Re: 答复: 答复: 答复: 答复: Class inherit ance, and SUPER under mod_perl2
Lu, I think IO::Socket:SSL has nothing to do here because this class inherits Net::Cmd and IO::Socket::INET. The next part of the code is to connect to a POP server and get emails, therefore it has no relationship wih IO::Socket:SSL. The point maybe the word SUPER. AFAIK, SUPER means super class in Perl, right? Please fix me if I am wrong. So, in this case, $type-SUPER::new refers to the parents clasess ( i.e, Net::Cmd, IO::Socket::INET ) of its own ( XXX::YYY3 class ). Do I need to post the code where XXX:YYY3 is being called? Luke Lu さんは��きました: We can infer : $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 );# and last; This line may have some problems , you can use IO::Socket::SSL this package . Or you can give me the SUPER, I try to debug it. -邮件原件- 发件人: Nguyen Vu Hung [mailto:[EMAIL PROTECTED] 发送时间: 2007年8月16日 9:46 收件人: Luke Lu 抄送: modperl@perl.apache.org 主题: Re: 答复: 答复: 答复: Class inheritance, and SUPER under mod_perl2 Yes, it was undefined even inside foreach. You can see it above the debug lines on my code. Luke Lu さんは��きました: Hi, the $obj is undefined everytime? -邮件原件- 发件人: Nguyen Vu Hung [mailto:[EMAIL PROTECTED] 发送时间: 2007年8月16日 9:34 收件人: Luke Lu 抄送: modperl@perl.apache.org 主题: Re: 答复: 答复: Class inheritance, and SUPER under mod_perl2 Actually I did exactly what you told me yesterday and $obj was still undefined. Here is the code ( check if $obj is undefined inside foreach ) package XXX::YYY3; @ISA = qw(Net::Cmd IO::Socket::INET); sub new { my $self = shift; my $type = ref($self) || $self; my $hosts = localhost; my $obj; my @localport = (); my $h; foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 );# and last; # obj is undefined now. so weird. unless ( defined $obj ) { $sl-log_serror(__FILE__, __LINE__, Apache2::Const::LOG_ERR, APR::Const::SUCCESS, XXX:: undef obj! ERROR. ); } last; } Luke Lu さんは��きました: Ok, so sorry, You only put the print ... inside the foreach. Please try it. -邮件原件- 发件人: Nguyen Vu Hung [mailto:[EMAIL PROTECTED] 发送时间: 2007年8月16日 9:24 收件人: Luke Lu 抄送: modperl@perl.apache.org 主题: Re: 答复: Class inheritance, and SUPER under mod_perl2 This code didn't run. I don't think we can put an if clause inside $type-SUPER::new(...) The error I got when running this code is: syntax error at /XXX/YYY3.pm line 74, near if\nsyntax error at /XXX/YYY3.pm line 77, near } else\nsyntax error at /XXX/YYY3.pm line 82, near Luke Lu さんは��きました: Hi, In this part: foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 ) and last; } You can debug it like this foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 If (defined ($obj)) { Print ok; } Else { Print bad; } ) and last; } According to this ,you can check it whether every time it will be 'ok' or not. If the last time is output 'bad', then you can find the real reason If still have any question,please contact with me/ luke -邮件原件- 发件人: Nguyen Vu Hung [mailto:[EMAIL PROTECTED] 发送时间: 2007年8月16日 8:58 收件人: modperl@perl.apache.org 主题: Class inheritance, and SUPER under mod_perl2 Hello all, I am quite new to Perl, mod_perl and mod_perl2 so please excuse me for my questions. It my sounds noobish. In the code below, the class XXX:YYY3 inherits Net::Cmd, IO::Socket::Inet, create an object $obj with the SUPER keyword. As far as I know, this code works well under Apache 1.3, Perl 5.6, mod_perl 1.3. But in current environment which consists Apache 2.0.52, Perl 5.8, mod_perl 2.0.3, $obj becomes undefined (!!) after it is called with SUPER. Anyone gets any clues? Here is the code: -- package XXX::YYY3; @ISA = qw(Net::Cmd IO::Socket::INET); sub new { my $self = shift; my $type = ref($self) || $self; my $hosts = localhost; my $obj; my @localport = (); my $h; foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 ) and last; } # obj is undefined now. why? unless ( defined $obj ) { $sl-log_serror(__FILE__, __LINE__, Apache2::Const::LOG_ERR, APR::Const::SUCCESS, XXX:: undef obj! ERROR. ); } # vuhung # ref: http://www.perlmonks.org/?node_id=495975 return undef unless defined $obj; }
Re: ??: ??: Class inheritance , and SUPER under mod_perl2
Joe Schaefer : Nguyen Vu Hung [EMAIL PROTECTED] writes: Here is the code ( check if $obj is undefined inside foreach ) package XXX::YYY3; @ISA = qw(Net::Cmd IO::Socket::INET); sub new { my $self = shift; my $type = ref($self) || $self; my $hosts = localhost; my $obj; my @localport = (); my $h; foreach $h (@{$hosts}) Are you using symrefs or something? It seems that I am using symref. Please see the cose below ( more original - The code I have posted in the previous emails are slight modified, by me, so it may contains errors! ) $hosts here is a scalar, not an arrayref. Yes, I changed my code. Please see below. Are you sure the loop is being entered at all? Yes, because the log inisde the foreach loop was printed out. Here is the code package XXX::YYY3; @ISA = qw(Net::Cmd IO::Socket::INET); sub new { my $self = shift; my $type = ref($self) || $self; my $host = shift if @_ % 2; my %arg = @_; my $hosts = defined $host ? [ $host ] : $NetConfig{pop3_hosts}; my $obj; my @localport = exists $arg{ResvPort} ? ( LocalPort = $arg{ResvPort} ): (); my $h; foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($host = $h), PeerPort = 110, #$arg{PeerPort} || 110,#(110)', Proto = 'tcp', LocalPort = 110, Timeout = 120 #defined $arg{Timeout} );# and last; #last:?? # printed:undef - i.e, $obj is undefined at this moment. unless ( defined $obj ) { $sl-log_serror(__FILE__, __LINE__, Apache2::Const::LOG_ERR, APR::Const::SUCCESS, xpop3:: undef obj! ERROR. ); } last; } } # printed:undef - i.e, $obj is undefined at this moment. unless ( defined $obj ) { $sl-log_serror(__FILE__, __LINE__, Apache2::Const::LOG_ERR, APR::Const::SUCCESS, xpop3:: undef obj! ERROR. ); }
Re: 答复: 答复: 答复: 答复: 答复: Class i nheritance, and SUPER under mod_perl2
I am not sure if this is the SUPER package we are looking for. Being said this, please remember that I am quite new to Perl. http://search.cpan.org/~chromatic/SUPER-1.16/lib/SUPER.pm Luke Lu さんは��きました: Where can I get the SUPER package? I want to debug it If you got it,pls give me a copy -邮件原件- 发件人: Nguyen Vu Hung [mailto:[EMAIL PROTECTED] 发送时间: 2007年8月16日 10:15 收件人: Luke Lu 抄送: modperl@perl.apache.org 主题: Re: 答复: 答复: 答复: 答复: Class inheritance, and SUPER under mod_perl2 Lu, I think IO::Socket:SSL has nothing to do here because this class inherits Net::Cmd and IO::Socket::INET. The next part of the code is to connect to a POP server and get emails, therefore it has no relationship wih IO::Socket:SSL. The point maybe the word SUPER. AFAIK, SUPER means super class in Perl, right? Please fix me if I am wrong. So, in this case, $type-SUPER::new refers to the parents clasess ( i.e, Net::Cmd, IO::Socket::INET ) of its own ( XXX::YYY3 class ). Do I need to post the code where XXX:YYY3 is being called? Luke Lu さんは��きました: We can infer : $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 );# and last; This line may have some problems , you can use IO::Socket::SSL this package . Or you can give me the SUPER, I try to debug it. -邮件原件- 发件人: Nguyen Vu Hung [mailto:[EMAIL PROTECTED] 发送时间: 2007年8月16日 9:46 收件人: Luke Lu 抄送: modperl@perl.apache.org 主题: Re: 答复: 答复: 答复: Class inheritance, and SUPER under mod_perl2 Yes, it was undefined even inside foreach. You can see it above the debug lines on my code. Luke Lu さんは��きました: Hi, the $obj is undefined everytime? -邮件原件- 发件人: Nguyen Vu Hung [mailto:[EMAIL PROTECTED] 发送时间: 2007年8月16日 9:34 收件人: Luke Lu 抄送: modperl@perl.apache.org 主题: Re: 答复: 答复: Class inheritance, and SUPER under mod_perl2 Actually I did exactly what you told me yesterday and $obj was still undefined. Here is the code ( check if $obj is undefined inside foreach ) package XXX::YYY3; @ISA = qw(Net::Cmd IO::Socket::INET); sub new { my $self = shift; my $type = ref($self) || $self; my $hosts = localhost; my $obj; my @localport = (); my $h; foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 );# and last; # obj is undefined now. so weird. unless ( defined $obj ) { $sl-log_serror(__FILE__, __LINE__, Apache2::Const::LOG_ERR, APR::Const::SUCCESS, XXX:: undef obj! ERROR. ); } last; } Luke Lu さんは��きました: Ok, so sorry, You only put the print ... inside the foreach. Please try it. -邮件原件- 发件人: Nguyen Vu Hung [mailto:[EMAIL PROTECTED] 发送时间: 2007年8月16日 9:24 收件人: Luke Lu 抄送: modperl@perl.apache.org 主题: Re: 答复: Class inheritance, and SUPER under mod_perl2 This code didn't run. I don't think we can put an if clause inside $type-SUPER::new(...) The error I got when running this code is: syntax error at /XXX/YYY3.pm line 74, near if\nsyntax error at /XXX/YYY3.pm line 77, near } else\nsyntax error at /XXX/YYY3.pm line 82, near Luke Lu さんは��きました: Hi, In this part: foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 ) and last; } You can debug it like this foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 If (defined ($obj)) { Print ok; } Else { Print bad; } ) and last; } According to this ,you can check it whether every time it will be 'ok' or not. If the last time is output 'bad', then you can find the real reason If still have any question,please contact with me/ luke -邮件原件- 发件人: Nguyen Vu Hung [mailto:[EMAIL PROTECTED] 发送时间: 2007年8月16日 8:58 收件人: modperl@perl.apache.org 主题: Class inheritance, and SUPER under mod_perl2 Hello all, I am quite new to Perl, mod_perl and mod_perl2 so please excuse me for my questions. It my sounds noobish. In the code below, the class XXX:YYY3 inherits Net::Cmd, IO::Socket::Inet, create an object $obj with the SUPER keyword. As far as I know, this code works well under Apache 1.3, Perl 5.6, mod_perl 1.3. But in current environment which consists Apache 2.0.52, Perl 5.8, mod_perl 2.0.3, $obj becomes undefined (!!) after it is called with SUPER. Anyone gets any clues? Here is the code: -- package XXX::YYY3; @ISA = qw(Net::Cmd IO::Socket::INET); sub new { my $self = shift; my $type = ref($self) || $self; my $hosts = localhost; my $obj; my @localport = (); my $h; foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($h), PeerPort = 110, Proto = 'tcp', LocalPort = 110, Timeout = 120 )
Re: ??: ??: Class inheritance, and SUPER under mod_perl2
Nguyen Vu Hung [EMAIL PROTECTED] writes: foreach $h (@{$hosts}) { $obj = $type-SUPER::new(PeerAddr = ($host = $h), Are you sure you want SUPER::new()? I think in your case it translates to Net::Cmd::new(), when your args suggest you want IO::Socket::INET::new(). PeerPort = 110, #$arg{PeerPort} || 110,#(110)', Proto = 'tcp', LocalPort = 110, You can't bind to LocalPort 110 unless you are root. Try doing without the LocalPort = 110 argument, there's probably no need for it. -- Joe Schaefer
Re: Class inheritance, and SUPER under mod_perl2
On 8/15/07, Nguyen Vu Hung [EMAIL PROTECTED] wrote: In the code below, the class XXX:YYY3 inherits Net::Cmd, IO::Socket::Inet, create an object $obj with the SUPER keyword. As far as I know, this code works well under Apache 1.3, Perl 5.6, mod_perl 1.3. But in current environment which consists Apache 2.0.52, Perl 5.8, mod_perl 2.0.3, $obj becomes undefined (!!) after it is called with SUPER. I don't think this is related to SUPER, since mod_perl doesn't affect that. You can confirm this by hard-coding the name of the superclass instead of the word SUPER, e.g. $obj = $type-IO::Socket::INET::new( ...etc... - Perrin