RE: Moon phases in Perl
Any known moon calculator for the moon phases (moon calendar). Ideas appreciated. I've never used it, but you might look at Astro::Moonphase Regards, Rick ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
OLE Functions
I have seen (and have written) perl code such as: use Win32::OLE; # use existing instance if Excel is already running eval {$ex = Win32::OLE-GetActiveObject('Excel.Application')}; die Excel not installed if $@; unless (defined $ex) { $ex = Win32::OLE-new('Excel.Application', sub {$_[0]-Quit;}) or die Oops, cannot start Excel; } # get a new workbook $book = $ex-Workbooks-Add; # write to a particular cell $sheet = $book-Worksheets(1); $sheet-Cells(1,1)-{Value} = foo; # write a 2 rows by 3 columns range $sheet-Range(A8:C9)-{Value} = [[ undef, 'Xyzzy', 'Plugh' ], [ 42,'Perl', 3.1415 ]]; # print XyzzyPerl $array = $sheet-Range(A8:C9)-{Value}; for (@$array) { for (@$_) { print defined($_) ? $_| : undef|; } print \n; } # save and exit $book-SaveAs( 'test.xls' ); undef $book; undef $ex; So my question is... where do I find exactly the names of functions I can use with OLE and the specific format (case, etc.) and arguments for them? I'm looking for Excel, Word, and Outlook functions to start. Do I need a VB reference or what? Kind regards, Rick ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Regular expression
Assuming this line is typical, here is a script which gives a couple of ways to approach the regex: $text = 'LOG_INFO : cpcdos22.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success.'; print $1 \n if $text =~ /\/(.+):/; print $1 \n if $text =~ /\/([^\/]+):/; Which outputs: bootp/cygwin.bat cygwin.bat I hope this helps. Regards, Rick Evans -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Jorge Goncalvez Sent: Tuesday, July 03, 2001 1:48 AM To: [EMAIL PROTECTED] Subject: Re:Regular expression Hi , I have the following string LOG_INFO : cpcdos22.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success. And I would like to extract only the string cygwin.bat.how I can do this with re. thanks ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: what editor do you use?
I use Multi-Edit. Without going into the myriad of features, I will say this: It has done whatever I need, regardless of what I'm editing. It handles Perl, Unix shell files, HTML, Java, JavaScript, DOS Batch files, and everything else I have *ever* edited. I've even used it to fix damaged Word and WordPerfect files, since it can handle binary files (of any size) as easily as text files. You can call compilers from it, shell out to run other programs, and the two best features of all (IMHO)... 1.) You can easily (without coding) assign nearly any function/action to any key or key combination so you can emulate any keyboard layouts you might like (brief, word, wordstar, wordperfect, or anything else) 2.) If there's a feature you wish it had, there is a robust macro language that lets you write anything you want. (As a related aside, most of the editor functions are written in the macro language, and they give you the source!) check it out at http://www.multiedit.com Regards, Rick Evans -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Debbie Thomson Sent: Tuesday, June 26, 2001 10:17 AM To: [EMAIL PROTECTED] Subject: what editor do you use? All- It occurs to me now that I seem to be spending much of my day writing Perl that I need a better programming environment than Notepad. What do you use? Thanks, Deb ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: Randomly selecting characters from a list
Actually that's probably about as good as any other way. Quoting from the Perl Cookbook: Making random numbers is hard. Also from the Perl Cookbook, here is a way to generate a 10 character string 'randomly': @chars = ( A .. Z, a .. z, 0 .. 9 ); $password = join( , @chars[ map { rand @chars } ( 1 .. 10 ) ] ); print $password \n; Regards, Rick ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: Find Grep
If I had a complex ANDed expression, I'd just hard code it in the subroutine. For something simple, such as the word TABLE followed somewhere by the word ALIGN, you could use: my $stringToFind = 'TABLE.+ALIGN'; Regards, Rick Sure, if you wanted to match VEGETABLE ALIGMENT. Carl, I'm not sure if you're kidding or serious, but just in case you are serious... If you wanted to match strictly the word table and the word align, you could use my $stringToFind = '\bTABLE\b.*\bALIGN\b'; or something to that effect. Since the variable $stringToFind uses RegEx, you can use literally any expression you can develop to find matching lines. If the expression becomes too complex, or in any way limits the flexibility, you can always go to the subroutine and place the RegEx there. In short, I believe the originally suggested code accomplished the originally desired task which was to find all files matching a specific pattern and containing specific text. Regards, Rick ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: Find Grep
I believe this snippet of code does what you ask. It finds all files containing a specific string Since it prints line number and filename as it goes, there is no need to store them, as you could capture the results. Regards, Rick Evans __BEGIN__ use strict; # good practice use File::Find; # used for recursive file find my $filePattern = '\.(html|htm|asp)$'; # filename pattern to find my $stringToFind = 'TABLE'; # string to find in file @ARGV = qw(.) unless @ARGV; # use current dir if none provided find( \fileInfo, @ARGV); # find the files # sub fileInfo # { # note: $_ holds the basename # $File::Find::name holds full filename return if -d; # skip directory entries return if not /$filePattern/i; # skip unwanted files open( FILE, $_ ) || # open the matching file return; # or don't! while ( FILE ) { # read the file and print matching line # printf %10d %-s\n, $., $File::Find::name if ( /$stringToFind/i ); } close( FILE ); # close the file } ## fileInfo -Original Message- I am trying to write a small script that will recursively search through a directory tree (from some arbitrary point) and return all of the files it finds that match an expression. I then want to grep the results for a specific string in each of thos files and return the file name and line number for each match. I am somewhat out of my depth in trying this. Any assistance would be helpful. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users