RE: Change in goto behavior
Title: Message John, Look up function dispatch tables on perlmonks.com. It's a pretty good alternative to switch case statements (better than if-else, anyway). But as to your question, I don't know if there was any functionality change made. Sam Sam Gardner GTO Application Development Keefe, Bruyette Woods, Inc. 212-887-6753 -Original Message-From: John Deighan [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 13, 2005 9:55 AMTo: perl-win32-users@listserv.ActiveState.comSubject: Re: Change in "goto" behaviorAt 08:30 AM 7/13/2005, Hugh Loebner wrote: Why on earth are you using a goto statement? They are pernicious.We have a goto in our code. I hate it, but there just isn't a good "switch" or "case" statement in Perl yet (I think I've heard that it's planned), and the following just isn't efficient enough for us:if ($op = 'thisop') {}elsif ($op = 'thatop') {}...There are hundreds of possible values for $op. Anyway, I don't know how many people are aware of it, but the destination of a "goto" can be a variable, e.g.goto $op;thisop: do_this();thatop: do_that();Of course, you then have to prevent the fall through from the code for thisop: to the code for thatop:, but that's another matter. (We initially used a "goto FINISH", but I hated that, too. You can use a "break" if you're in a loop.) We use a method that I really don't have time to describe now, but doesn't use a "goto". I hate goto's, but for the example above, it's efficient and much clearer than e.g. setting up a hash of op names and code to handle each op. On 7/12/05, Dave Ressler [EMAIL PROTECTED] wrote: I have noticed a change in behavior in "goto" statements recently. Whereas a statement like "goto PLACE;" would work fine no matter where "PLACE:" was in my code, I've noticed that scripts that used to work are now failing at the "goto" statement. I can probably work out an example if needed, but the general question is: have any restrictions been put on "goto" recently? What are the real criteria needed to be satisfied for the destination to be successfully found? Thanks, Dave ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Scanned for Spam and Viruses. Content-Type: text/plain; charset="us-ascii"MIME-Version: 1.0Content-Transfer-Encoding: 7bitContent-Disposition: inlineX-NAIMIME-Disclaimer: 1X-NAIMIME-Modified: 1___Perl-Win32-Users mailing listPerl-Win32-Users@listserv.ActiveState.comTo unsubscribe: http://listserv.ActiveState.com/mailman/mysubsScanned for Spam and Viruses. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Change in goto behavior
Title: RE: Change in goto behavior This kind of flexibility in a switch statement reminds me why I love perl. Sam Gardner GTO Application Development Keefe, Bruyette Woods, Inc. 212-887-6753 -Original Message- From: Thomas, Mark - BLS CTR [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 13, 2005 10:46 AM To: 'John Deighan'; perl-win32-users@listserv.ActiveState.com Subject: RE: Change in goto behavior John Deighan wrote: We have a goto in our code. I hate it, but there just isn't a good switch or case statement in Perl yet Yes there is, in Perl 5.8. If you're using an older Perl, you can still get Switch.pm from CPAN. use Switch; switch ($val) { case 1 { print number 1 } case a { print string a } case [1..10,42] { print number in list } case (@array) { print number in list } case /\w+/ { print pattern } case qr/\w+/ { print pattern } case (%hash) { print entry in hash } case (\%hash) { print entry in hash } case (\sub) { print arg to subroutine } else { print previous case not true } } ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: NET-DNS Regex
Title: RE: NET-DNS Regex $the_ip='80.224.159.46'; $the_ip =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/; $the_domain=$4.$3.$2.$1.sbl-xbl.spamhaus.org; ## you're reversing the order of the IP here. . . Is there some reason you're doing this? $the_domain should now equal 46.159.224.80.sbl-xbl.spamhaus.org ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Why is this a problem?
Title: Message See answers: my %fh = ( aa = 1, bb =2, cc = 3) ; # note that each instance of $fh{$fhkey} has a different valueforeach my $fhkey ( keys %fh){ open ( $fh{$fhkey}, "$fhkey" ) ;## so, you open 3 file handles, one named "1", one named "2", and one named "3" } non-working code my %fh = ( aa = 1, bb =1, cc = 1) ; # note - only change, each $fh{} has value of 1foreach my $fhkey ( keys %fh){ open ( $fh{$fhkey}, "$fhkey" ) ; }## Mmmm, because you only open one uniquely named file handle? Specifically, named "1"? ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Script printing its own source code
Title: RE: Script printing its own source code 1) H. . . Did you chomp? 2) I don't think there's any problem at all with a script opening itself as a text file. Keep in mind that when it's running it's been interpreted and is in memory (so no file sharing issue). It could, of course, destroy or modify itself. Whether you think that's a good thing or not depends on the purpose and methods of your script. Sam Gardner GTO Application Development Keefe, Bruyette Woods, Inc. 212-887-6753 -Original Message- From: Ted Schuerzinger [mailto:[EMAIL PROTECTED]] Sent: Saturday, May 28, 2005 1:05 PM To: Perl Mailing List Subject: Script printing its own source code Over on rec.puzzles on Usenet ([EMAIL PROTECTED]), somebody posted a puzzle asking about using programming languages to print out a program's own source code. So, I quickly whipped up the following 11-line script in Perl: snip #! perl -w use strict; my $selfprint=c:/scripts/selfprint.pl; open SELFPRINT, $selfprint or die Cannot open $selfprint for read :$!; while (SELFPRINT) { print; } /snip I opened up the DOS prompt in Windows 98, and ran the script. The result was the following: snip Microsoft(R) Windows 98 (C)Copyright Microsoft Corp 1981-1999. C:\WINDOWScd\scripts C:\scriptsperl selfprint.pl #! perl -w use strict; my $selfprint=c:/scripts/selfprint.pl; open SELFPRINT, $selfprint or die Cannot open $selfprint for read :$!; while (SELFPRINT) { print; } C:\scripts /snip Two questions: 1) When the script prints itself out, it prints an extra blank line before giving me the command line again. (I've got the script open in my text editor, set to show line numbers, and there are definitely only 11 lines.) Where's the blank line coming from? 2) Is it really a good idea for a script to be allowed to open itself? I don't know if I want to try having a script open itself for write, even if only to see what would happen. :-) -- Ted Schuerzinger, [EMAIL PROTECTED] ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Perl and Images
Title: RE: Perl and Images Yes: 1) Open directory 2) Double-click file 3) Alt-PrintScreen 4) Open Paint 5) Ctrl-V 6) Save Okay, maybe you'll have to play around with this to get the thumbnail, but you get the idea. . . Sam Gardner GTO Application Development Keefe, Bruyette Woods, Inc. 212-887-6753 -Original Message- From: steve silvers [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 17, 2005 1:44 PM To: perl-win32-users@listserv.ActiveState.com Subject: Perl and Images Quick question. Is there a way that I can go into a directory with a static html file in it and create a thumbnail image of the html file? Any suggestions or examples greatly appreciated. Steve ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: FTP modules
Title: RE: FTP modules See below -Original Message- From: Kelly Stumbaugh [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 28, 2005 12:13 PM To: Perl-Win32-Users@listserv.ActiveState.com Subject: FTP modules Does anyone running Perl on Windows recommend a module for FTP? I have tried Net::FTP::Common, but I can't get it to work and there isn't much in the way of documentation. If you have some sample code that retrieves a file from an FTP site, it would be really helpful for me to see it. Thanks! ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs It's a modified extract from a script I had, but you can get the idea. #! perl -w use File::Copy; use File::Path; use Net::FTP; ($user, $pwd, $ipaddress) = @ARGV; $whereto=C:/; $current=; $date = time(); ($sec, $min, $hour, $day, $mon, $year) = localtime $date; $sec = 0; $min = 0; $hour = 0; $year = $year + 1900; $mon++; $current=$year.$mon.$day; mkpath ($whereto.$current, 0, 0777); $host=$ipaddress; $reports=Reports; $ftp=Net::FTP-new($host,Timeout=240) or $newerr=1; $ftp-login($user,$pwd) or $newerr=2; $ftp-cwd($reports) or $newerr=3; $ftp-binary; @files = $ftp-ls(); for(@files){ $ftp-get($_, $whereto.$current./.$_); } $ftp-cwd(../Data); @datafiles = $ftp-ls(); for(@datafiles){ $ftp-get($_, G:/.$_); } ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Archive::Zip - Bad file descriptor on directories
I noted I had some problems using the constants (e.g., AZ_OK) with Archive::Zip, so I went with the literal values. Sam Gardner GTO Application Development Keefe, Bruyette Woods, Inc. 212-887-6753 -Original Message- From: Sisyphus [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 30, 2005 11:59 PM To: Ben Conrad; perl-win32-users@listserv.ActiveState.com Subject: Re: Archive::Zip - Bad file descriptor on directories - Original Message - From: Ben Conrad [EMAIL PROTECTED] To: perl-win32-users@listserv.ActiveState.com Sent: Thursday, March 31, 2005 7:37 AM Subject: Archive::Zip - Bad file descriptor on directories Folks, I'm not sure what the problem is but I can't seem to get a valid return when using $zip-writeToFileNamed(). It works when I zip a single file, but when I use addTree() I get Bad file descriptor. Am I doing something wrong? use warnings; use strict; use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); # FYI, I'm using Version : 1.22 of Zlib.pm per the FAQ my $zip = Archive::Zip-new(); my $dir = 'c:/temp'; unlink ($dir/xxx.zip) if ( -f $dir/xxx.zip) ; # # This works # # $member = $zip-addFile( 'y1.txt' ); # $zip-writeToFileNamed( 'someZip.zip' ) || die ERROR $! if $status != AZ_OK; What is $status ? Even if 'writeToFileNamed()' fails, I doubt that the script will die, or that you'll see any error message. Rewrite as something like (untested): my $status = $zip-writeToFileNamed( 'someZip.zip' ); die ERROR $! if $status != AZ_OK; if ( -d $dir/mydir ) { my $result = $zip-addTree( $dir/mydir, 'mydir1' ); # I monitor this with filemon.exe and I do see it go through all the dirs and files. print result is: $result\n; # $result = $zip-writeToFileNamed($dir/xxx.zip) || die ERROR $!; ## This gives me: ERROR Bad file descriptor at archive.pl line 17 # xxx.zip file exists and looks ok. That's the wrong way to check for the error. If everything is ok, $result will be 0 (remember that AZ_OK == 0), and the script will die. Rewrite as something like (untested): $result = $zip-writeToFileNamed($dir/xxx.zip); die ERROR $! if $result != AZ_OK; # $result = $zip-writeToFileNamed($dir/xxx.zip) || die ERROR $! if $status != AZ_OK; # this does not die but also does not create a .zip I don't know what $status is - and I'm not sure how that line of code will be evaluated. I would think that, if 'writeToFileNamed()' fails, then $result will be true, and the 'die()' will not even get looked at. Once again, I recommend rewriting it as: $result = $zip-writeToFileNamed($dir/xxx.zip); die ERROR $! if $result != AZ_OK; } Cheers, Rob ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: :Oracle copy from one PC to another
Title: RE: :Oracle copy from one PC to another Yes, the machines are set up similarly, with the exception that I installed a module on one, and can now no longer retrieve it from the repository I originally got it from. Sam Gardner GTO Application Development Keefe, Bruyette Woods, Inc. 212-887-6753 -Original Message- From: Trevor Joerges [SendMIME Software] [mailto:[EMAIL PROTECTED]] Sent: Friday, February 04, 2005 11:08 AM To: Chris; perl-win32-users Subject: Re: :Oracle copy from one PC to another I hope and believe this is not a hard question, merely procedural. . . It seems Tim Bunce's Oracle DBD repository is no longer functional; does anyone know the procedure for copying a module install from one machine to another? So far I've tried copying the .pm's that seemed to be relevant (and, of course, installed DBI), but this doesn't seem to work. I get an error indicating: install_driver(Oracle) failed: Can't locate loadable object for module DBD::Oracle in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at (eval 1) line 3 Compilation failed in require at (eval 1) line 3. Perhaps a module that DBD::Oracle requires hasn't been fully installed at F:\APPS\KBW_EXE\jobs\trades\dc.pl line 17 Do you have the Oracle client software installed? It is required to build and run DBD Oracle. --Trevor. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Regex Help
Title: RE: Regex Help Okay, this is amazingly cloddish, but it does work and may point out where some of your regexes are going wrong. Whenever I have difficulty, I try to simplify it down and then analyze. @strings = qw/ 2004 200412 20041201 2004-12 2004-12-01/; for (@strings){ if (/^\d{4}$|^\d{4}-\d{2}-\d{2}$|^\d{4}-\d{2}$/){ print $_ matches\n; } else{ print $_ does not match\n; } } Sam Gardner GTO Application Development Keefe, Bruyette Woods, Inc. 212-887-6753 -Original Message- From: Dirk Bremer [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 27, 2005 11:43 AM To: perl-win32-users Subject: Regex Help I need to test for the following date-type strings: 2004 2004-12 2004-12-01 All of the above would be legal, any other combination would be illegal. I have been using the following data to test the regex: '' Should produce a false result. '2004' Should produce a true result. '200412' Should produce a false result. '20041201' Should produce a false result. '2004-12' Should produce a true result. '2004-12-01' Should produce a true result. My first attempt at a regex is /\d{4}(-\d{2})*/. This produces the following result: is false 2004 is true 200412 is true 20041201 is true 2004-12 is true 2004-12-01 is true I would prefer that '200412' and '20041201' would fail, i.e. be reported as false. I'm not sure what's going on with this regex as I would expect the following: match the first four numeric characters, then match zero or more occurrences of a dash character followed by two numeric characters The next regex /\d{4}(-\d{2})+/ produces the following results: is false 2004 is false 200412 is false 20041201 is false 2004-12 is true 2004-12-01 is true This is closer, but I also want '2004' to be true. The next regex /\d{4}(?=-\d{2})/ produces the same results as the previous regex: is false 2004 is false 200412 is false 20041201 is false 2004-12 is true 2004-12-01 is true I've done quite a few regexes in the past but have never used the positive lookahead assertion before because I have never really understood it. Out of the three regexes, I would have expected the first to fulfill my requirements. I do not understand why it is not, although I suspect it has something to do with the dash character. What am I doing wrong here? I should be able to accomplish this test using a single regex, right? Dirk Bremer - Systems Programmer II - ESS/AMS - NISC St. Peters USA Central Time Zone 636-922-9158 ext. 8652 fax 636-447-4471 [EMAIL PROTECTED] www.nisc.cc ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Zip Enlightenment
Title: Message Thanks guys, this has been very helpful... I notice that I don't seem to have the samples the documentation mentions anywhere on my system, however -- this isn't critical (I've done what I needed to do), but does anyone know where they might be? Sam Gardner GTO Application Development Keefe, Bruyette Woods, Inc. 212-887-6753 -Original Message-From: Wagner, David --- Senior Programmer Analyst --- WGO [mailto:[EMAIL PROTECTED] Sent: Friday, January 21, 2005 5:46 PMTo: Gardner, Sam; Perl-Win32-Users@listserv.ActiveState.comSubject: RE: Zip Enlightenment use Archive::Zip Doc is sufficient and works very well for me. Wags ;) -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Gardner, SamSent: Friday, January 21, 2005 13:53To: 'Perl-Win32-Users@listserv.ActiveState.com'Subject: Zip Enlightenment Anyone know how to zip files in perl? I tried downloading Tie::gzip, but found the documentation a bit obtuse (which normally wouldn't stop me, but when I tried implementing it I received errors stating I couldn't "modify a constant item in a tie"). I'd prefer a perl method over a third-party (i.e., command-line WinZip) method, mostly because I'd like to learn to do it and don't want to have to worry about making sure the right version of WinZip and whatever add-on it needs are installed. Also because I'd like to learn to do it. Otherwise, I'll just have to write my thing in Java, and that would be annoying. Any advice appreciated. . . Sam GardnerGTO Application DevelopmentKeefe, Bruyette Woods, Inc.787 7th Avenue, 4th FloorNew York, NY 10019(212) 887-6753kbw.com[EMAIL PROTECTED] "For thousands more years the mighty ships tore across the empty wastes of space and finally dived screaming on to the first planet they came across - which happened to be the Earth - where due to a terrible miscalculation of scale the entire battle fleet was accidentally swallowed by a small dog." - HHG This communication is confidential and is intended solely for the addressee. It is not to be forwarded to any other person or copied without the permission of the sender. Please notify the sender in the event you have received this communication in error. This communication is not an offer to sell or a solicitation of an offer to buy any securities discussed herein. Keefe, Bruyette Woods, Inc. makes no representation as to the accuracy or completeness of information contained in this communication. ***This message contains information that is confidentialand proprietary to FedEx Freight or its affiliates.It is intended only for the recipient named and forthe express purpose(s) described therein.Any other use is prohibited.*** ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Zip Enlightenment
Title: Message Anyone know how to zip files in perl? I tried downloading Tie::gzip, but found the documentation a bit obtuse (which normally wouldn't stop me, but when I tried implementing it I received errors stating I couldn't "modify a constant item in a tie"). I'd prefer a perl method over a third-party (i.e., command-line WinZip) method, mostly because I'd like to learn to do it and don't want to have to worry about making sure the right version of WinZip and whatever add-on it needs are installed. Also because I'd like to learn to do it. Otherwise, I'll just have to write my thing in Java, and that would be annoying. Any advice appreciated. . . Sam GardnerGTO Application DevelopmentKeefe, Bruyette Woods, Inc.787 7th Avenue, 4th FloorNew York, NY 10019(212) 887-6753kbw.com[EMAIL PROTECTED] "For thousands more years the mighty ships tore across the empty wastes of space and finally dived screaming on to the first planet they came across - which happened to be the Earth - where due to a terrible miscalculation of scale the entire battle fleet was accidentally swallowed by a small dog." - HHG This communication is confidential and is intended solely for the addressee. It is not to be forwarded to any other person or copied without the permission of the sender. Please notify the sender in the event you have received this communication in error. This communication is not an offer to sell or a solicitation of an offer to buy any securities discussed herein. Keefe, Bruyette Woods, Inc. makes no representation as to the accuracy or completeness of information contained in this communication. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: EggExp Question
Title: RE: EggExp Question See below, from perlre: So, your regex would be $phone_book_entry=~m/^Smith.+(?!John)/; (?!pattern) A zero-width negative look-ahead assertion. For example /foo(?!bar)/ matches any occurrence of ``foo'' that isn't followed by ``bar''. Note however that look-ahead and look-behind are NOT the same thing. You cannot use this for look-behind. If you are looking for a ``bar'' that isn't preceded by a ``foo'', /(?!foo)bar/ will not do what you want. That's because the (?!foo) is just saying that the next thing cannot be ``foo''--and it's not, it's a ``bar'', so ``foobar'' will match. You would have to do something like /(?!foo)...bar/ for that. We say ``like'' because there's the case of your ``bar'' not having three characters before it. You could cover that this way: /(?:(?!foo)...|^.{0,2})bar/. Sometimes it's still easier just to say: if (/bar/ $` !~ /foo$/) Sam Gardner GTO Application Development Keefe, Bruyette Woods, Inc. 212-887-6753 -Original Message- From: Edwards, Mark (CXO) [mailto:[EMAIL PROTECTED]] Sent: Friday, January 14, 2005 12:16 PM To: Perl-Win32-Users@listserv.ActiveState.com Subject: EggExp Question Is there a regular _expression_ to indicate a string you're looking for and one you're not looking for? Example: You want to find all the Smiths in a list but not Smith, John. So if you read each record from the list, the pseudo code would be something like: $phone_book_entry=~m/^Smith.+?not(John)/ $phone_book_entry=~m/^Smith, [^J][^o][^h][^n]/ works but can be cumbersome for long strings. Also if you don't know that , is always between the last and first name (Smith Jr., John) and use .*?, it breaks. Is there a real re that will do this? Thanks Mark Edwards HP Services Technical Solutions Group http://www.hp.com/ Hewlett-Packard Company CXO01-3/N13 301 Rockrimmon Blvd. South Colorado Springs, CO 80919-2398 Voice: (719) 592-5363 Email: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Task Scheduler
Title: RE: Task Scheduler Put it in the registry under HKLM\Software\Microsoft\Windows\CurrentVersion\Run Sam Gardner GTO Application Development Keefe, Bruyette Woods, Inc. 212-887-6753 -Original Message- From: Erich Beyrent [mailto:[EMAIL PROTECTED]] Sent: Monday, January 10, 2005 9:34 AM To: perl-win32-users@listserv.ActiveState.com Subject: Task Scheduler Does anyone know how to schedule a new task to run at system reboot (every time the system reboots)? I cannot seem to figure it out... TIA -Erich- ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Crypt::SSLeay
Title: RE: Crypt::SSLeay I had to install openssl before this would work. Do a search for openssl (a free windows download). Sam Gardner GTO Application Development Keefe, Bruyette Woods, Inc. 212-887-6753 -Original Message- From: Lundgren, Scott [mailto:[EMAIL PROTECTED]] Sent: Monday, January 10, 2005 10:30 AM To: perl-win32-users@listserv.ActiveState.com Subject: Crypt::SSLeay I'm using a script that uses Crypt::SSLeay and the module doesn't seem to have installed properly so I'm hoping someone can guide me of how to correct it. Below is my environment, how I installed Crypt::SSLeay, the script that doesn't work, and what I've tried to figure out why the script doesn't work. Please suggest you think I should try next. - SL The OS is Windows Server 2003 Standard Edition, the web server is IIS 6.0, and the installation of Perl is ActivePerl 5.8.4.810. To install Crypt::SSLeay I followed the HOWTO @ http://johnbokma.com/perl/https.html and installed the module via the PPM command: ppm install http://theoryx5.uwinnipeg.ca/ppms/Crypt-SSLeay.ppd When prompted, I chose to fetch both the ssleay32.dll and libeay32.dll and both were put in C:\Perl\bin. When I request the script below via IIS from a browser, the script does not send output to the browser but there's this entry in C:\Perl\bin\PerlIS-Err.log: *** 'D:\websites\internalserver.uncc.edu\www\https-test.cgi' error message at: 2005/01/10 09:46:07 Failed to GET 'https://www.helsinki.fi/': 501 Protocol scheme 'https' is not supported (Crypt::SSLeay not installed) at D:\websites\internalserver.uncc.edu\www\https-test.cgi line 14. #!/usr/bin/perl # https-test.cgi - HTTPS GET example # # (c) 2004 By John Bokma, http://johnbokma.com/ use strict; use warnings; use LWP::UserAgent; my $url = '';" TARGET="_blank">https://www.helsinki.fi/'; my $ua = LWP::UserAgent-new; my $response = $ua-get( $url ); $response-is_success or die Failed to GET '$url': , $response-status_line; print $response-as_string As the above script works fine when I log into the server and run it from command line, I copied the script below to specifically load the Crypt::SSLeay module and then dump out what modules other environment settings were being used. #!/usr/bin/perl # path-test.cgi use strict; use Crypt::SSLeay; # to find the path to Perl binary print Perl Binary: \n$^X\n; # library path print Perl [EMAIL PROTECTED]: \n, join \n, @INC; # and to find the path to the script you are executing: use FindBin qw($RealScript $RealDir); print \nPerl Script Executing: \n$::RealDir/$::RealScript\n; # sucessfully loaded modules print \nPerl Modules Loaded: \n, map {$_ = $INC{$_}\n} keys %INC; # path print \nPerl Path: \n, $ENV{PATH}; Which produces this output from commandline: D:\websites\internalserver.uncc.edu\wwwperl path-test.cgi Perl Binary: C:\Perl\bin\perl.exe Perl @INC: C:/Perl/lib C:/Perl/site/lib . Perl Script Executing: D:/websites/internalserver.uncc.edu/www/path-test.cgi Perl Modules Loaded: re.pm = C:/Perl/lib/re.pm XSLoader.pm = C:/Perl/lib/XSLoader.pm warnings/register.pm = C:/Perl/lib/warnings/register.pm Cwd.pm = C:/Perl/lib/Cwd.pm warnings.pm = C:/Perl/lib/warnings.pm File/Basename.pm = C:/Perl/lib/File/Basename.pm Config.pm = C:/Perl/lib/Config.pm Crypt/SSLeay.pm = C:/Perl/site/lib/Crypt/SSLeay.pm Crypt/SSLeay/X509.pm = C:/Perl/site/lib/Crypt/SSLeay/X509.pm Carp.pm = C:/Perl/lib/Carp.pm Exporter/Heavy.pm = C:/Perl/lib/Exporter/Heavy.pm File/Spec/Unix.pm = C:/Perl/lib/File/Spec/Unix.pm strict.pm = C:/Perl/lib/strict.pm vars.pm = C:/Perl/lib/vars.pm Exporter.pm = C:/Perl/lib/Exporter.pm File/Spec.pm = C:/Perl/lib/File/Spec.pm AutoLoader.pm = C:/Perl/lib/AutoLoader.pm File/Spec/Win32.pm = C:/Perl/lib/File/Spec/Win32.pm DynaLoader.pm = C:/Perl/lib/DynaLoader.pm FindBin.pm = C:/Perl/lib/FindBin.pm Perl Path: C:\Perl\bin\;C:\Program Files\VERITAS\NetBackup\bin\;C:\WINDOWS\system32;C:\WIND OWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft Visual C++ Toolkit 2003\ bin;C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin;C:\Program Files\ Microsoft SDK\bin;C:\Program Files\Microsoft SDK\bin\winnt;C:\Perl\bin\;C:\Progr am Files\VERITAS\NetBackup\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\S ystem 32\Wbem D:\websites\internalserver.uncc.edu\www But produces this this entry in C:\Perl\bin\PerlIS-Err.log when path-test.cgi is requested via browser: *** 'D:\websites\internalserver.uncc.edu\www\path-test.cgi' error message at: 2005/01/10 10:14:44 Can't load 'C:/Perl/site/lib/auto/Crypt/SSLeay/SSLeay.dll' for module Crypt::SSLeay: load_file:Access is denied at C:/Perl/lib/DynaLoader.pm line 230. at D:\websites\internalserver.uncc.edu\www\path-test.cgi line 5 Compilation failed in require at D:\websites\internalserver.uncc.edu\www\path-test.cgi line 5. BEGIN failed--compilation aborted at D:\websites\internalserver.uncc.edu\www\path-test.cgi line 5. ___
RE: a question for split function in perl
Title: RE: a question for split function in perl pretty easy. . . Just add the colon to the character class. . . $line = fordGID=54097; $line2 = fordGID:54097; ($match,$data)=split(/[=:]/,$line); print line 1 is $match, $data; ($match,$data)=split(/[=:]/,$line); print line 2 is $match, $data; Sam Gardner GTO Application Development Keefe, Bruyette Woods, Inc. 212-887-6753 -Original Message- From: Ella Cai [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 01, 2004 4:16 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: a question for split function in perl Our codes is like this: $line = fordGID=54097; ($match,$data)=split(/[=]/,$line); Right now, sometime $line = fordGID:54097; I would like to know can split function support regular _expression_ like if it has either = or :? Thanks Lixin Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: checking that patches have been installed
Title: RE: checking that patches have been installed The question's a bit vague. What kind of patch? Windows? Sam Gardner GTO Application Development Keefe, Bruyette Woods, Inc. 212-887-6753 -Original Message- From: Tfbsr Bertrand [mailto:[EMAIL PROTECTED]] Sent: Monday, November 29, 2004 2:05 PM To: perl perl; perl1 perl1 Subject: checking that patches have been installed Does anyone have a script for verifying that a patch has been installed. or any ideas on how to go about doing that? Thanks __ Do you Yahoo!? All your favorites on one personal page - Try My Yahoo! http://my.yahoo.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
DBI/email not dying right
Title: Message For some reason, my script (below) isn't dying appropriately (instead, it's just hanging and not returning to the prompt). I changed server/database/etc. The script had formerly also printed out the die message (before I put in the finish and disconnect statements), but still just gave me a blinking cursor (without a prompt) at the end. For anyone testing, obviously you can't get to my database, but the spreadsheet is public on the internet. Any help appreciated. . . #!perl use LWP::Simple;use LWP::UserAgent;use Mail::Sender;use DBI;use Spreadsheet::BasicRead; ($user, $pwd, $email) = @ARGV;$date = time();($sec, $min, $hour, $day, $mon, $year) = localtime $date;$curryear = $year + 1900;$xmon = sprintf ("%02d", $mon+1);$day = sprintf ("%02d", $day);$year =~ /\d\d(\d\d)/;$truncyear = $1;$name = "C:/sp500-".$xmon.$day.$truncyear.".xls";GetSNPfile($name);$spread = new Spreadsheet::BasicRead($name) || die "Error: $!";print "Opened Spread...\n";while ($data = ""> last if ($$data[0] eq "ACTUALS"); next if !($$data[0] =~ m,/\d+/,); $$data[0] =~ m,/\d{2}/(\d{4}),; $year = $1; push @ests, $$data[2]; push @dates, $$data[0]; } @fwd_four = (reverse @ests)[0..3]; @fwd_four_dates = (reverse @dates)[0..3]; $printests = join "\t", @fwd_four; $printdates = join "\t", @fwd_four_dates; print $printdates."\n".$printests; for (@fwd_four){$sum+=$_;} print "\nSNP\t".$sum."\n";$dbh = DBI-connect('dbi:Oracle:host=oracleserver;sid=serviceid', $user, $pwd, { RaiseError = 1, PrintError = 1 });$getsnp = $dbh-prepare("SelectCOLUMN fromTABLE whereYEAR_COLUMN = ?");$getsnp-execute($curryear + 1);@row = $getsnp-fetchrow_array;($snp_eps)[EMAIL PROTECTED]; $getsnp-finish();print "DB\t".$snp_eps."\n";if($snp_eps != $sum){ $result = "dvalues\nDB:\t$snp_eps \nWEB:\t$sum\t$printdates\n$printests\t";}else{ $result = "svalues \nDB:\t$snp_eps \nWEB:\t$sum\t$printdates\n$printests";}print $result;$sender = new Mail::Sender {smtp = 'mail.mailserver.com', from = '[EMAIL PROTECTED]'};$sender-MailMsg({to = $email, subject = "SP Estimates", msg = $result}); $dbh-disconnect(); exit;die "silly program doesn't know it's over"; sub GetSNPfile{($get) = @_;print "Getting SNP file from web. . . \n";$snp = getstore("http://www2.standardandpoors.com/spf/xls/index/SP500EPSEST.XLS", $get);print "Done getting file. . . \n";$snp;} Output: C:\logsnp500epsdbuserdbpwd [EMAIL PROTECTED]Getting SNP file from web. . .Done getting file. . .Opened Spread...09/30/2004 (91% actual) 12/31/2004 03/31/2005 06/30/200516.68 17.23 17.24 18.35SNP 69.5DB 69.5svaluesDB: 69.5WEB: 69.5 09/30/2004 (91% actual) 12/31/2004 03/31/2005 06/30/200516.68 17.23 17.24 18.35_ and then blinks the cursor at the end of "18.35" until I Ctrl-C it. Sam GardnerGTO Application DevelopmentKeefe, Bruyette Woods, Inc.787 7th Avenue, 4th FloorNew York, NY 10019(212) 887-6753kbw.com[EMAIL PROTECTED] "For thousands more years the mighty ships tore across the empty wastes of space and finally dived screaming on to the first planet they came across - which happened to be the Earth - where due to a terrible miscalculation of scale the entire battle fleet was accidentally swallowed by a small dog." - HHG This communication is confidential and is intended solely for the addressee. It is not to be forwarded to any other person or copied without the permission of the sender. Please notify the sender in the event you have received this communication in error. This communication is not an offer to sell or a solicitation of an offer to buy any securities discussed herein. Keefe, Bruyette Woods, Inc. makes no representation as to the accuracy or completeness of information contained in this communication. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: A regular expression question
Title: Message or even. . . $string = "sct-1.62-1";print "$1\n" if ($string =~ /^.+-(.+)-.+$/); (no need to use the backslash escape for the dashes; they're not part of a character class. . . Sam Gardner GTO Application Development Keefe, Bruyette Woods, Inc. 212-887-6753 -Original Message-From: Peter Eisengrein [mailto:[EMAIL PROTECTED] Sent: Thursday, November 11, 2004 2:52 PMTo: 'Cai, Lixin (L.)'; [EMAIL PROTECTED]Subject: RE: A regular _expression_ question Your format does not match XXX-XXX-XXX so I'll guess you mean three fields delimited by a dash. here's one way to do it $string = "sct-1.62-1"; print "$1\n" if ($string =~ /^.+\-(.+)\-.+$/) -Original Message-From: Cai, Lixin (L.) [mailto:[EMAIL PROTECTED]Sent: Thursday, November 11, 2004 2:37 PMTo: [EMAIL PROTECTED]Subject: A regular _expression_ question Now I have a string like My $string = "sct-1.62-1"; I have 2 regular _expression_ question here, A. I want to check whether the format is "XXX-XXX-XXX", how can I do it? B. I want to get 1.62 from the string, how can I do it? Thanks a lot in advance! Lixin Lixin Cai Security Compliance Tools(SCT) Location: ITek 2WC135 Phone:313-317-4906 email: [EMAIL PROTECTED] Message transport securityby GatewayDefender2:40:28 PM ET - 11/11/2004 ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: LWP help
Title: Message I believe this line: $req-content('query=libwww-perlmode=dist'); is your problem. Anyway, it's what apparently kills the script for me, particularly against yahoo (if I remove it and the proxy settings (which I don't need) it runs successfully for me). Am I correct that you listed this code off a tutorial page? It looks like this relates specifically to CPAN (since if I run it against CPAN it does work, though I do notice you changed a POST to a GET, and it's the POST that works against CPAN). I also noticed that your attached "STATFILE" indicates "forbidden", not "not found". . . I'm not sure the significance of this. . . Sam Gardner GTO Application Development Keefe, Bruyette Woods, Inc. 212-887-6753 -Original Message-From: Lasher, Brian [mailto:[EMAIL PROTECTED] Sent: Thursday, October 28, 2004 11:53 AMTo: Gardner, Sam; Perl-Win32-UsersSubject: RE: LWP help Lwp_example.pl is script. STATFILE is output. I changed the "proxy server" info to protect TI proprietary data, and changed the site that is being accessed (although result is the same). Brian Lasher Catalog DSP Product Engineering Best Practices and Yield Enhancement Team [EMAIL PROTECTED] 281-274-2913(W) 281-684-4699(C) 713-664-6240(H) 281-274-2279(F) -----Original Message-From: Gardner, Sam [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 26, 2004 1:07 PMTo: Lasher, Brian; Perl-Win32-UsersSubject: RE: LWP help Kind of hard to tell, w/o seeing the script or knowing what page it is. . . Sam Gardner GTO Application Development Keefe, Bruyette Woods, Inc. 212-887-6753 -Original Message-From: Lasher, Brian [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 26, 2004 1:29 PMTo: Perl-Win32-UsersSubject: LWP help I wrote a script using the LWP module. At first I got error 500 (something about server does not exist). Realized by reading the docs that I had to define my proxy server. Not getting that error now, so I assume that fix worked. Now I'm getting error 404 (doc not found) for a site that I know is correct. Script replies the following: CODE: 404 STATUS: 404 Not Found CONTENT: !DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN" htmlhead title404 Not Found/title /headbody h1Not Found/h1 pThe requested URL /04-05RD.txt was not found on this server./p hr / /body/html Anyone seen this? Is there something people can do to prevent LWP from pulling data from their server? Is there something I'm missing? -brian Brian Lasher Catalog DSP Product Engineering Best Practices and Yield Enhancement Team [EMAIL PROTECTED] 281-274-2913(W) 281-684-4699(C) 713-664-6240(H) 281-274-2279(F) ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: LWP help
Title: Message Kind of hard to tell, w/o seeing the script or knowing what page it is. . . Sam Gardner GTO Application Development Keefe, Bruyette Woods, Inc. 212-887-6753 -Original Message-From: Lasher, Brian [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 26, 2004 1:29 PMTo: Perl-Win32-UsersSubject: LWP help I wrote a script using the LWP module. At first I got error 500 (something about server does not exist). Realized by reading the docs that I had to define my proxy server. Not getting that error now, so I assume that fix worked. Now I'm getting error 404 (doc not found) for a site that I know is correct. Script replies the following: CODE: 404 STATUS: 404 Not Found CONTENT: !DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN" htmlhead title404 Not Found/title /headbody h1Not Found/h1 pThe requested URL /04-05RD.txt was not found on this server./p hr / /body/html Anyone seen this? Is there something people can do to prevent LWP from pulling data from their server? Is there something I'm missing? -brian Brian Lasher Catalog DSP Product Engineering Best Practices and Yield Enhancement Team [EMAIL PROTECTED] 281-274-2913(W) 281-684-4699(C) 713-664-6240(H) 281-274-2279(F) ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs