Re: Redirecting STDOUT
Jeremy A wrote: > Hi all, > > I am using IPC::Open2. I have a Read Handle (RH) and a Write Handle (WH). I > fork() for doing non-blocking IO. > my problem is , when i try the print the RH to socket ($client), It writes > to STDOUT (server console screen). nothing gets written to the socket. > > Thanks in advance for any help on this. > > Regards, > > Jeremy Aiyadurai. > > The following is the code. > > > $server = IO::Socket::INET->new( Proto => 'tcp', >LocalPort => $PORT, >Listen=> SOMAXCONN, >Reuse => 1); > > > die "can't setup server" unless $server; > print "[Server $0 accepting clients]\n"; > #while(1) > #{ > > while ($client = $server->accept()) { > $client->autoflush(1); > my $LFLAG = 0; > my $UP; > $hostinfo = gethostbyaddr($client,$client->peeraddr); > my $cmd = <$client>; >open2(\*RH,\*WH,"$cmd"); open2 \*WH, \*RH, $cmd; > die "can't fork: $!" unless defined($kidpid = fork()); There could be problems with forking on Win32. > if ($kidpid) { > my $byte; > while (defined(my $byte = <$client>)) { > print WH $byte; > } > #kill("TERM", $kidpid); > } > else { > my $l; > while ((defined ($l = ))) { <- problem here, RH does not write > to client, it writes to STDOUT. > print $client $l; > } > > } > } -- ,-/- __ _ _ $Bill LuebkertMailto:[EMAIL PROTECTED] (_/ / )// // DBE CollectiblesMailto:[EMAIL PROTECTED] / ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/ -/-' /___/_<_http://dbecoll.tripod.com/ (My Perl/Lakers stuff) ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Net::DNS problems
I'm using Net::DNS on winnt and win2k that does lookups (i.e. PTR, MX, etc...) and having some problems. The send function hangs when using UDP and the nameserver is down or non-existant. When using TCP (i.e. $res->usevc(1) ), the same send function to a basd server at least times out after about 10 seconds. I'd like to use UDP and timeout appropriately. Any ideas? Regards, ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Redirecting STDOUT
Hi all, I am using IPC::Open2. I have a Read Handle (RH) and a Write Handle (WH). I fork() for doing non-blocking IO. my problem is , when i try the print the RH to socket ($client), It writes to STDOUT (server console screen). nothing gets written to the socket. Thanks in advance for any help on this. Regards, Jeremy Aiyadurai. The following is the code. $server = IO::Socket::INET->new( Proto => 'tcp', LocalPort => $PORT, Listen=> SOMAXCONN, Reuse => 1); die "can't setup server" unless $server; print "[Server $0 accepting clients]\n"; #while(1) #{ while ($client = $server->accept()) { $client->autoflush(1); my $LFLAG = 0; my $UP; $hostinfo = gethostbyaddr($client,$client->peeraddr); my $cmd = <$client>; open2(\*RH,\*WH,"$cmd"); die "can't fork: $!" unless defined($kidpid = fork()); if ($kidpid) { my $byte; while (defined(my $byte = <$client>)) { print WH $byte; } #kill("TERM", $kidpid); } else { my $l; while ((defined ($l = ))) { <- problem here, RH does not write to client, it writes to STDOUT. print $client $l; } } } ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: timing system call
jtownsen wrote: I have some scripts that use "system" to drive a command line test harness. Each time I call system, I'd like to know how long the execution took. Is there a way to time the fork that is created when I call system? Untested: use Time::HiRes; use warnings; my $t0 = Time::HiRes::time(); system("some_command"); my $t1 = Time::HiRes::time(); print "Took ", $t1 - $t0, " seconds\n"; Cheers, Rob -- Any emails containing attachments will be deleted from my ISP's mail server before I even get to see them. If you wish to email me an attachment, please provide advance warning so that I can make the necessary arrangements. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Perl commands and Proxy servers (DPR#67741)
Assuming that you are able to get throught the proxy using your browser, then we should focus on the name of the environment variable and the value set for it. On both my windows sytem and my Unix (solaris) system, I use: http_proxy=http://myproxy.domain.foo:80 You will need to set replace "myproxy.domain.foo" with the name of your proxy server. The ":80" after it specifies the port that the proxy listens on. Note the lowercase letters used for the environment variable "http_proxy". This may (or may not) be important on your system -- I think Win32 systems tend to ignore casing but not sure. Make sure that your proxy environment variables are indeed set by typing this at the command prompt (if not maybe you forgot to "export" them): set Anyway, some ideas to look at. May not help depending on your situation. -- Mike Arms > -Original Message- > From: Furioli Giancarlo [mailto:[EMAIL PROTECTED] > Sent: Friday, December 12, 2003 11:51 AM > To: [EMAIL PROTECTED] > Subject: R: Perl commands and Proxy servers (DPR#67741) > Importance: High > > > > I've downloaded ActivePerl-5.8.0.806-MSWin32-x86.zip and I've > installed it on my PC WinNT4.0. > I've installed http://theoryx5.uwinnipeg.ca/ppms/Crypt-SSLeay.ppd > No problem until last week. > > Last week my company installed an Apache/1.3.26 proxy server > on our LAN. > Now it's impossible to contact a web site with a perl command using = > HTTPS protocol. > If I use a browser I havn't any problem: I can send my > user-login and my = > password to proxy with browser's command before contacting any site. > I set the system's variables HTTP_proxy, HTTP_proxy_user, = > HTTP_proxy_pass according hand-book instructions, but that not works. > I also tried to set HTTPS_proxy, HTTPS_proxy_user, HTTPS_proxy_pass = > (this is not written on hand-book) but not works too. > > Is there any perl-package to install before to execute my > perl command? = > Where can I find it ? > It is any step to do on our proxy ?=20 > > Could you help me ? > > Thank-you. > > Best regards. > > G.Furioli ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
HTML::Parse or HTML::Parser?
I've found both HTML::Parse and HTML::Parser on CPAN. Both seem reasonably current. Has anybody found reasons to prefer one to the other? My application is to parse the HTML part of e-mail messages, and to strip out potentially dangerous content such as fetches of remote images, scripts, etc. Thanks, -pd -- Peter Davis Funny stuff at http://www.pfdstudio.com The artwork formerly shown as prints List of resources for children's writers and illustrators at: http://www.pfdstudio.com/cwrl.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
timing system call
I have some scripts that use "system" to drive a command line test harness. Each time I call system, I'd like to know how long the execution took. Is there a way to time the fork that is created when I call system? Thanks ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
R: Perl commands and Proxy servers (DPR#67741)
I've downloaded ActivePerl-5.8.0.806-MSWin32-x86.zip and I've installed it on my PC WinNT4.0. I've installed http://theoryx5.uwinnipeg.ca/ppms/Crypt-SSLeay.ppd No problem until last week. Last week my company installed an Apache/1.3.26 proxy server on our LAN. Now it's impossible to contact a web site with a perl command using = HTTPS protocol. If I use a browser I havn't any problem: I can send my user-login and my = password to proxy with browser's command before contacting any site. I set the system's variables HTTP_proxy, HTTP_proxy_user, = HTTP_proxy_pass according hand-book instructions, but that not works. I also tried to set HTTPS_proxy, HTTPS_proxy_user, HTTPS_proxy_pass = (this is not written on hand-book) but not works too. Is there any perl-package to install before to execute my perl command? = Where can I find it ? It is any step to do on our proxy ?=20 Could you help me ? Thank-you. Best regards. G.Furioli ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::Service
Try putting a error check around the StartService and GetStatus method calls like so: if( Win32::Service::StartService($hostName ,$serviceName) ){ print "Successfully started service $serviceName.\n\n"; } else { print "Error: "; print Win32::FormatMessage( Win32::GetLastError() ), "\n\n"; } HTH, Trevor Joerges - Original Message - From: "Kraaijer Ronald" <[EMAIL PROTECTED]> To: "'Sisyphus'" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, December 12, 2003 6:29 AM Subject: RE: Win32::Service > Tried warnings, unfortunally did not give me any usefull hints. > > -Original Message- > From: Sisyphus [mailto:[EMAIL PROTECTED] > Sent: Friday, December 12, 2003 12:24 PM > To: Kraaijer Ronald > Cc: [EMAIL PROTECTED] > Subject: Re: Win32::Service > > > Kraaijer Ronald wrote: > > Hi, > > > > I want to manage services on my Win NT 4 station using Win32::Service, but > > somehow it doesn't do as asked. > > Below a code snippet, the service Alerter is not started when I'm running > > this. > > > > Any Ideas? > > > > use warnings; > > > use Win32::Service; > > $hostName = "127.0.0.1"; > > $serviceName = "Alerter"; > > %status = ""; > > $ref = \%status; > > Win32::Service::StartService($hostName ,$serviceName); > > > > Win32::Service::GetStatus($hostName, $serviceName, $ref); > > > > Hopefully that will provide a clue as to what the problem is. > > Cheers, > Rob > > -- > Any emails containing attachments will be deleted from my ISP's mail > server before I even get to see them. If you wish to email me an > attachment, please provide advance warning so that I can make the > necessary arrangements. > > > Disclaimer - Winterthur Europe Assurances - Avenue des Arts/Kunstlaan 56 - 1000 Brussels - Belgium. > This e-mail is intended solely for the above-mentioned recipient and it may contain confidential or privileged information. If you have > received it in error, please notify the sender immediately and delete the e-mail. You must not copy, distribute, disclose or take any > action in reliance on it. > This e-mail message and any attached files have been scanned for the presence of computer viruses. However, you are advised that > you open any attachments at your own risk. > > > > ___ > Perl-Win32-Users mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Sending e-mail? Calling emacs to edit?
Thanks, Trevor. I'm actually doing the retrieval and mail reading now pretty much as you suggest. I was hoping there might be some tools around for composing and replying to messages also. Looks like Mail::Box may have some good features to simplify that, but I'm just starting to look into that. Thanks, -pd Trevor Joerges wrote: Use Net::POP3 or Mail::POP3Client to retrieve the message, then use MIME::Parser to parse the individual message body parts. The body parts can be accessed and modified in memory or to disk. Once you have the parts you can edit the HTML however you like and put it all back together using MIME::Entity probably. Keeping track of how it was put together in the first place will probably be the toughest part although you could probably just retrieve the original message and write it as another body part to the reply. I'm glad that's not my task. HTH, Trevor. - Original Message - From: "Peter Davis" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, November 25, 2003 4:49 PM Subject: Sending e-mail? Calling emacs to edit? Please excuse the cross-post, but I'm not sure which list is more appropriate for these questions. I've been working on a set of Perl CGI scripts to read my e-mail, which is in MH format (1 message per file, filename = message number). I'm using Earl Hood's Cygwin port of nmh for some of it, and the MIME::Tools for some. However, I'm now at the point of needing to send (and reply to) messages. I'm trying to find a way to do this from a CGI script, but to have a decently powerful editor to compose the messages. I think I can do this by creating a draft message, and then calling emacs to edit it. I still have some problems with this, though, and more than a few questions: 1) Emacs has several modes for composing and sending messages, including Mail mode, Message mode, MH-E's message composition, and probably others I'm not aware of. Any recommendations? 2) I want to do something intelligible with MIME and especially HTML messages. For example, if a message is HTML (or has an HTML alternative part), I want to edit HTML, and then use lynx to generate the corresponding text alternative before sending. I know MIME::Tools will help me compose the outgoing MIME message, but the problem is how to edit it in the first place. Ideas? Suggestions? Pointers to existing code that solves these problems? Thanks very much, -pd -- Peter Davis Funny stuff at http://www.pfdstudio.com The artwork formerly shown as prints List of resources for children's writers and illustrators at: http://www.pfdstudio.com/cwrl.html ___ Perl-Win32-Web mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs -- Peter Davis Funny stuff at http://www.pfdstudio.com List of resources for children's writers and illustrators at: http://www.pfdstudio.com/cwrl.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32::Service
Tried warnings, unfortunally did not give me any usefull hints. -Original Message- From: Sisyphus [mailto:[EMAIL PROTECTED] Sent: Friday, December 12, 2003 12:24 PM To: Kraaijer Ronald Cc: [EMAIL PROTECTED] Subject: Re: Win32::Service Kraaijer Ronald wrote: > Hi, > > I want to manage services on my Win NT 4 station using Win32::Service, but > somehow it doesn't do as asked. > Below a code snippet, the service Alerter is not started when I'm running > this. > > Any Ideas? > use warnings; > use Win32::Service; > $hostName = "127.0.0.1"; > $serviceName = "Alerter"; > %status = ""; > $ref = \%status; > Win32::Service::StartService($hostName ,$serviceName); > > Win32::Service::GetStatus($hostName, $serviceName, $ref); > Hopefully that will provide a clue as to what the problem is. Cheers, Rob -- Any emails containing attachments will be deleted from my ISP's mail server before I even get to see them. If you wish to email me an attachment, please provide advance warning so that I can make the necessary arrangements. Disclaimer - Winterthur Europe Assurances - Avenue des Arts/Kunstlaan 56 - 1000 Brussels - Belgium. This e-mail is intended solely for the above-mentioned recipient and it may contain confidential or privileged information. If you have received it in error, please notify the sender immediately and delete the e-mail. You must not copy, distribute, disclose or take any action in reliance on it. This e-mail message and any attached files have been scanned for the presence of computer viruses. However, you are advised that you open any attachments at your own risk. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::Service
Kraaijer Ronald wrote: Hi, I want to manage services on my Win NT 4 station using Win32::Service, but somehow it doesn't do as asked. Below a code snippet, the service Alerter is not started when I'm running this. Any Ideas? use warnings; use Win32::Service; $hostName = "127.0.0.1"; $serviceName = "Alerter"; %status = ""; $ref = \%status; Win32::Service::StartService($hostName ,$serviceName); Win32::Service::GetStatus($hostName, $serviceName, $ref); Hopefully that will provide a clue as to what the problem is. Cheers, Rob -- Any emails containing attachments will be deleted from my ISP's mail server before I even get to see them. If you wish to email me an attachment, please provide advance warning so that I can make the necessary arrangements. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32::Service
Hi, I want to manage services on my Win NT 4 station using Win32::Service, but somehow it doesn't do as asked. Below a code snippet, the service Alerter is not started when I'm running this. Any Ideas? use Win32::Service; $hostName = "127.0.0.1"; $serviceName = "Alerter"; %status = ""; $ref = \%status; Win32::Service::StartService($hostName ,$serviceName); Win32::Service::GetStatus($hostName, $serviceName, $ref); Disclaimer - Winterthur Europe Assurances - Avenue des Arts/Kunstlaan 56 - 1000 Brussels - Belgium. This e-mail is intended solely for the above-mentioned recipient and it may contain confidential or privileged information. If you have received it in error, please notify the sender immediately and delete the e-mail. You must not copy, distribute, disclose or take any action in reliance on it. This e-mail message and any attached files have been scanned for the presence of computer viruses. However, you are advised that you open any attachments at your own risk. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs