Re: LWP
Steve, You need to create the http_proxy environment variable or do something like this: my $ua = LWP::UserAgent-new; $ua-proxy(['http', 'ftp'], 'http://my.proxy_server.net:3128/'); Read this for more info: http://search.cpan.org/~gaas/libwww-perl-5.79/lib/LWP/UserAgent.pm HTH, James. steve silvers wrote: I have a snippet below that I want to grab content from a website, but I need to get through my proxy server. How can this be done? #!/Perl use LWP::UserAgent; my $ua = LWP::UserAgent-new; my $req = HTTP::Request-new(GET = 'http://whereever.com'); $req-authorization_basic('user', 'pass'); print $ua-request($req)-as_string; Thanks in advance Steve _ Check out the coupons and bargains on MSN Offers! http://youroffers.msn.com ___ 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
Receiving OLE Events
I'm trying to use OLE events with the SAPI 5 OLE object (Sapi.SpVoice) for Text to Speech (TTS). As I understand it, the following code should call the 'event_handler' sub every time SAPI sees a new word: #!D:\Perl\bin\perl.exe- w use strict; use Win32::OLE qw( EVENTS ); #New OLE Object my $sapi_obj = Win32::OLE-new('Sapi.SpVoice'); #Set the text to be spoken my $text = With vision, every person, organization and country can flourish. This phrase was spoken by Microsoft SAPI 5.1; #Fire SAPI event when new word encountered (32=New Word) Win32::OLE-WithEvents( $sapi_obj, \event_handler ); $sapi_obj-{'EventInterests'} = 32; #Do talking (1=Async Mode) $sapi_obj-Speak($text, 1); #Give perl a chance to receive events $sapi_obj-WaitUntilDone('2000'); $sapi_obj-Pause; $sapi_obj-WaitUntilDone('2000'); $sapi_obj-Resume; sub event_handler { print SAPI encountered a new word!\n; } Unfortunately, the event_handler never gets called. Does anyone know if I'm making a mistake? Any help is much appreciated. Thanks, James. P.S. Win32::OLE version: 0.1403, Perl Version: 5.6.1.635, SAPI: 5.1 ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Net::Telnet::Cisco script not waiting for prompt
Hi Howard, I have some experience in writing scripts with this excellent module, some of which have been used on c2500 routers. Sometimes, I find that setting the terminal length to zero at the start of the script can help: @output=$RSession-cmd(String = 'term length 0', Timeout = '3'); (you need enable mode before sending this command) Experiment with this, but if all else fails, you could get in touch with the module author via his web forum: http://nettelnetcisco.sourceforge.net/ HTH, James. Bullock, Howard A. wrote: I am attempting to automate some router changes using Net::Telnet::Cisco and having problems. The router: IOS (tm) 2500 Software (C2500-J-L), Version 11.2(14) The cisco module methods seem to work well for login, enable, and cmd('show version'). I run into a problem when I issue cmd('wr'). The router returns the following text: Building configuration... [OK] As soon as the 'wr' command is sent the program continues to the end. I even attempt to perform a backup using TFTP after the 'wr' commad. This also seems to not wait for the prompt. My timeout for the commands is set to 40 seconds. I have used the debug dump.log and see what I think is very strange. The 'wr' command is executed, then the TFTP command is executed, then the response from the 'wr' is echoed. 0x0: 5e 5a 0d 0a 63 31 39 34 6e 23 0d 0a 63 31 39 34 ^Z..c194n#..c194 0x00010: 6e 23 n# 0x0: 77 72 0d 0a wr.. 0x0: 63 6f 70 79 20 72 75 6e 6e 69 6e 67 2d 63 6f 6e copy running-con 0x00010: 66 69 67 20 74 66 74 70 0d 0a 31 36 33 2e 32 34 fig tftp..163.24 0x00020: 31 2e 31 35 34 2e 31 38 36 0d 0a 63 31 39 34 6e 1.154.186..c194n 0x00030: 2d 63 6f 6e 66 67 0d 0a 0d 0a 0d 0a -confg.. 0x0: 77 72 0d 0a 42 75 69 6c 64 69 6e 67 20 63 6f 6e wr..Building con 0x00010: 66 69 67 75 72 61 74 69 6f 6e 2e 2e 2e 0d 0a 5b figuration.[ 0x00020: 4f 4b 5d 0d 0a 63 31 39 34 6e 23 63 6f 70 79 20 OK]..c194n#copy 0x00030: 72 75 6e 6e 69 6e 67 running I even scrapped the cmd method and implemented: $session-print('wr'); $session-waitfor('/\[OK\]/'); This also does not seem to way. Adding sleep 40; after the 'wr' command and another sleep 40; after the TFTP command got the program to work. This however is not solution. Any assistance would be greatly appreciated. Howard A. Bullock Global IT Infrastructure 717-810-3584 ___ 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
Curses
Could anyone tell me whether it is possible to use the Curses module under Win32 please? I see the following error when I install: C:\ ppm install Curses.ppd Installing package 'Curses.ppd'... Error installing package 'Curses.ppd': Read a PPD for 'Curses.ppd', but it is not intended for this build of Perl (MSWin32-x86-multi-thread) I downloaded the PPD file from http://ppm.activestate.com/PPMPackages/zips/6xx-builds-only/ I'm really wanting to install POE::Wheel::Curses to allow keyboard input to my POE program, but I suspect Curses will be a prerequisite. Does anyone know if there is an alternative non-curses based (POE compatible module) which I could use under Windows and UNIX? All I need is to allow keyboard input (no GUI display or mouse is necessary). Many thanks, James. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Calling Perl Subroutines From C
Hello All, I am trying to call perl subroutines from within C and have read 'Perlcall' and 'PerlEmbed' (which did confuse me a little). I would really appreciate it if anyone with more experience could possibly help me with the following questions? 1. I have tried a (very simple) test to call a perl function (hi::say_hi) which is installed as a perl module on my system. Unfortunately, I know I've misunderstood something and I just can't get it to run even after RTFM. Could someone point out what I've done wrong please? *C Function - test.exe* #include stdio.h #include EXTERN.h #include perl.h static PerlInterpreter *my_perl; int main( void ) { printf( This program invokes a Perl Script\n ); dSP; PUSHMARK(SP); //Perl Call call_pv(hi::say_hi, G_DISCARD | G_NOARGS); return 0; } *Perl Function* package hi; use strict; ... #Function to be called from C sub say_hi { print Hello from Perl; } As for the IDE, I'm using VisualStudio.NET and have included perl56.lib as per the Perlembed instructions. The C compiles correctly, but when running, I see the following error as soon as the dSP; macro is run: An unhandled exception of type 'System.NullReferenceException' occurred in test.exe Additional information: Object reference not set to an instance of an object. What am I doing wrong? 2. To call a perl sub, does the sub have to be installed as a package or can it be a simple script file (eg .pl file) ? 3. I don't know much about PerlXS. Do I need to create an XSUB interface? Many thanks to anyone who replies. Regards, James. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs