file-parsing (I got it)
my $source = Whatsnew.html; my $destination = hw5.txt; open IN, $source or die Can't read source file $source: $!\n; open OUT, $destination or die Can't write on file $destination: $!\n; print Copying $source to $destination\n; while(IN){ if(/^\s+nbsp;(\d\d\/\d\d:) #match 1st line \s* (a\s+href [^] +) (.*?)\s*$ /isx ) { if(length($3) = 1){ print OUT $1 ,$3 ; } elsif(length($3)==0){ print OUT $1; } } elsif(/^\s*(.*?)\/abr\s*$/) #match 2nd line { my $subject = $1; print OUT $subject ; print OUT \n; last if /Planning Letter PL\-329/;# ends section I care about } } ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Using scientific notation as a numeric value within a CVS file?
Hanson, Rob wrote: Unless you need something specific, you can use them as is since those are valid numbers in Perl... print 9.12e-002 * 1; # prints 0.0912 print 9.12e-002 * 2; # prints 0.1824 print 9.12e-002 + 100; # prints 100.0912 These all give correct answers. Did you need to convert them back to the e-notation? Rob No. Just didn't think it would be so simple. But that is Perl. Thanks for the help. Wags ;) ** This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
HOw to find the Connected BandWidth -help needed
Hi, I want to find bandwidth at which the dialup session has connected through perl program. Is there any module which can help me..Advance thanks for help. regards, hemachandra -Original Message- From: Alberto Adrian [mailto:[EMAIL PROTECTED] Sent: Mon 29/09/2003 04:55 To: [EMAIL PROTECTED] Cc: Subject: RE:'which' functionality in Perl ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Tk main window draw problems.
[EMAIL PROTECTED] wrote: Guys, When I start my script the following happens... The main window appears in a random location, smaller than when fully populated. It resizes to accomodate all it's widgets. It jumps to the centre of the screen. I want it to appear complete in the centre of the screen with no jumping about. I tried this... my $main_window = MainWindow - new (options); $main_window-withdraw; ...fill the main_window... # POSITION MAIN WINDOW IN CENTRE OF SCREEN my $screenwidth = $main_window - screenwidth; my $screenheight = $main_window - screenheight; my $xposition = int (( $screenwidth - $windowwidth ) / 2); my $yposition = int (( $screenheight - $windowheight ) / 2); $main_window - geometry (+$xposition+$yposition); $main_window - deiconify; $main_window - raise; MainLoop(); But, of course, because the main_window is not shown on the screen, I can't get the windiwwidth and windowheight of it... Global symbol $windowwidth requires explicit package name... Global symbol $windowheight requires explicit package name... Is there a way of doing what I'm trying to do, without drawing the window, then moving it? Richard -- #...fill the main_window... $main_window-update; my $windowwidth = $main_window -width; my $windowheight = $main_window -height; Should do it, I think. -- mike higgins ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: 'which' functionality in Perl
Dax T. Games [EMAIL PROTECTED] wrote: How would I determine if a file existed in a directory in the PATH environment variable on a Windows box with Perl. If the file exists I want to return the full path to the file. The functionality I want is similar to 'which' on Unix/Linux. Dax, I second the folks recommending the Perl Power Tools (ppt) if you want a straight implementation of Unix commands in Perl. I wrote my own enhanced which.pl command which could do more than the standard Unix which: 1. If on a Win32 platform, it is PATHEXT aware and will match without typing the suffix. And in such a case it only matches files that have a suffix in the PATHEXT list. Example: C:\which gvim C:\WINNT\gvim.bat C:\Pkgs\vim\vim61\gvim.exe 2. Each directory in the PATH environment variable is searched and all matches are displayed (not just the first). You can see this in the example above. This is useful to determine if you have more than one executable of the same basename in various directories of your PATH. The first file with the given basename hides the others from being executed (unless a full path is specified). 3. Can type in a wildcard character '*' or '?' to have it match any executables with that filename pattern. Example: C:\ which.pl jav* C:\Java\j2sdk1.4.1_02\bin\java.exe C:\Java\j2sdk1.4.1_02\bin\javac.exe C:\Java\j2sdk1.4.1_02\bin\javadoc.exe C:\Java\j2sdk1.4.1_02\bin\javah.exe C:\Java\j2sdk1.4.1_02\bin\javap.exe C:\Java\j2sdk1.4.1_02\bin\javaw.exe C:\WINNT\system32\java.exe C:\WINNT\system32\javaw.exe Another example illustrating two wildcards: C:\which *nd* C:\Perl\bin\find2perl.bat C:\Pkgs\bin\pfind.pl C:\Perl\bin\find2perl.bat C:\WINNT\system32\append.exe C:\WINNT\system32\command.com C:\WINNT\system32\expand.exe C:\WINNT\system32\faxsend.exe C:\WINNT\system32\find.exe C:\WINNT\system32\findstr.exe C:\WINNT\system32\nddeapir.exe C:\WINNT\system32\rundll32.exe C:\WINNT\system32\sndrec32.exe C:\WINNT\system32\sndvol32.exe 4. A command line option ('-l' or '--list') to provide a directory listing for matching items. Example: C:\which -l jav* 2003/02/20 14:17:34 24677 C:\Java\j2sdk1.4.1_02\bin\java.exe 2003/02/20 14:17:34 28794 C:\Java\j2sdk1.4.1_02\bin\javac.exe 2003/02/20 14:17:34 28800 C:\Java\j2sdk1.4.1_02\bin\javadoc.exe 2003/02/20 14:17:34 28794 C:\Java\j2sdk1.4.1_02\bin\javah.exe 2003/02/20 14:17:34 28790 C:\Java\j2sdk1.4.1_02\bin\javap.exe 2003/02/20 14:17:34 28775 C:\Java\j2sdk1.4.1_02\bin\javaw.exe 2003/02/20 14:17:38 24677 C:\WINNT\system32\java.exe 2003/02/20 14:17:38 28775 C:\WINNT\system32\javaw.exe 5. A command line option ('-m' or '--md5') to compute a MD5 digest checksum for matching items. Example: C:\which -m jav* 9f455abce73150ed13707c1827589501 C:\Java\j2sdk1.4.1_02\bin\java.exe 96fa7cc38ef36a16750cdfaeb7ce7c84 C:\Java\j2sdk1.4.1_02\bin\javac.exe 2e2752ccf39d3d8d5654153b23ef44d0 C:\Java\j2sdk1.4.1_02\bin\javadoc.exe d967925f345b70bcc2c379b0e9e65c35 C:\Java\j2sdk1.4.1_02\bin\javah.exe 29bf016d4642956a47364b0e0b612d36 C:\Java\j2sdk1.4.1_02\bin\javap.exe 2ec1d702ff5252e88e12b124c53f9099 C:\Java\j2sdk1.4.1_02\bin\javaw.exe 9f455abce73150ed13707c1827589501 C:\WINNT\system32\java.exe 2ec1d702ff5252e88e12b124c53f9099 C:\WINNT\system32\javaw.exe Note: the '-m' and '-l' options can be combined: C:\which -l -m java 9f455abce73150ed13707c1827589501 2003/02/20 14:17:34 24677 C:\Java\j2sdk1.4.1_02\bin\java.exe 9f455abce73150ed13707c1827589501 2003/02/20 14:17:38 24677 C:\WINNT\system32\java.exe This is good for finding truly duplicate executables. 6. On Win32 platforms, the current directory '.' is prepended to the PATH list as this is implied on Win32 systems (this is not implied on Unix systems). Example: C:\Tempwhich which .\which.pl C:\Pkgs\bin\which.pl 7. I also implement multi-level debugging and tracing to allow more explanation of the breakout of the filename argument and the PATH and PATHEXT environment variables. Example: C:\Tempwhich -# which* Debugging C:\Temp\which.pl -d which version = v1.4 2003/09/14 debug= 1 filename = which PATHEXT = .COM .EXE .BAT .CMD .VBS .VBE .JS .JSE .WSF .WSH .PL Matches: .\which.pl C:\Pkgs\bin\which.pl C:\Pkgs\bin\which0.bat which.pl: Finished This may be overkill for your needs, but I have found this to be an extremely useful utility on my Win32 platform. I add to it occasionally when I find more things that I want it to be able to do. You can get it here: http://marms.sourceforge.net/perl/ -- Mike Arms ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: *nix or Windows Text Files?
Hanson, Rob [EMAIL PROTECTED] wrote: If you want the same line endings under *nix and Windows you could explicitly state the line ending: my $NL = \x0A; # ascii 10 in hex print The end is near$NL; \n will use the system default. Not true. On a Win32 system, the above will priduce output ending in CR-LF (\x0a\x0d) just like \n. Verification: C:\perl -e print qq(\n) | od -tx1 000 0d 0a 002 C:\perl -e print qq(\x0a) | od -tx1 000 0d 0a 002 You could turn on binmode STDOUT to get just a LF (\x0a): C:\perl -e binmode STDOUT; print qq(\x0a) | od -tx1 000 0a 001 -- Mike Arms ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
converting from NT to Win 2000
Hi All I am in the process of converting our existing system from NT to Windows 2000. I am having problems getting the code to run from within a browser. The code will run from the cmd line with no problems but when I try to call it as a web page it gives me CGI errors. Here is the code that works for NT. I am running activeperl 5.6.1 build 633 on the NT server and activeperl 5.6.1 build 633 on the Win 2000 server. use CGI qw/:all/; use MIME::Base64; $web = new CGI; $FirstScreenIn = 1; require 'c:/inetpub/cgi/Lib/ConInfo.pl'; ConInfo; use Win32::OLE; use Win32::ADO; my @DBerrors = (); $rsUserRoles = Win32::OLE-new(ADODB.Recordset); $UsernameInRole = MCC; $UsernameIn = MCC.XX; $sql = 'select * from UserRoles '; $sql= $sql. where (UserKey = '$UsernameInRole') ; $rsUserRoles-Open($sql, $con, Win32::ADO::adOpenDynamic, Win32::ADO::adLockOptimistic, Win32::ADO::adCmdText); Win32::ADO::CheckDBErrors($con, [EMAIL PROTECTED]) or die Request sql failed at \n, @DBerrors; $SubroutinePath = $rsUserRoles-fields(Location)-value; ###This is where it blows saying that value dosn't exist. and gives the CGI errors. $SubroutineName = $rsUserRoles-fields(ProgramName)-value; $rsUserRoles-Close; print $web-header(); require $SubroutinePath; eval($SubroutineName); Thanks Larry sub ConInfo { use Win32::OLE; use Win32::OLE::Variant; use Win32::ADO; $con = Win32::OLE-new(ADODB.Connection); #; Everything after this line is an OLE DB initstring $con-Open(Provider=MSDAORA.1;Password=somepassword;User ID=someidname;Data Source=;Persist Security Info=True); $cmd = Win32::OLE-new(ADODB.Command); } 1; ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Spreadsheet-like data entry/editing in PerlTk?
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Dax T. Games Sent: Tuesday, September 30, 2003 8:12 AM To: [EMAIL PROTECTED] Subject: Spreadsheet-like data entry/editing in PerlTk? Does anyone know of a Tk widget or have some sample code that would allow data entry and editing like with a spreadsheet in PerlTk. Currently I am familiar with the HList widget but as far as I know it only will list what you populate it with you cannot enter data or edit data. Thanks, Dax http://www.cpan.org/modules/by-module/Tk/ Look for Tk-TableMatrix. Also available on ppm from AS. -Lynn. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RES: converting from NT to Win 2000
Hi Briggs, Try to check your connection with database before the field request. Replace the Win32::ADO::CheckDBErrors($con, [EMAIL PROTECTED]) or die Request sql failed at \n, @DBerrors; ...to: Win32::ADO::CheckDBErrors($con, [EMAIL PROTECTED]) or print Request sql failed at \n, @DBerrors; and see what happens... 'die' does not show the error in CGI regards, fabricio. -Mensagem original- De: Briggs, Larry [mailto:[EMAIL PROTECTED] Enviada em: Tuesday, September 30, 2003 4:17 PM Para: '[EMAIL PROTECTED]' Assunto: converting from NT to Win 2000 Hi All I am in the process of converting our existing system from NT to Windows 2000. I am having problems getting the code to run from within a browser. The code will run from the cmd line with no problems but when I try to call it as a web page it gives me CGI errors. Here is the code that works for NT. I am running activeperl 5.6.1 build 633 on the NT server and activeperl 5.6.1 build 633 on the Win 2000 server. use CGI qw/:all/; use MIME::Base64; $web = new CGI; $FirstScreenIn = 1; require 'c:/inetpub/cgi/Lib/ConInfo.pl'; ConInfo; use Win32::OLE; use Win32::ADO; my @DBerrors = (); $rsUserRoles = Win32::OLE-new(ADODB.Recordset); $UsernameInRole = MCC; $UsernameIn = MCC.XX; $sql = 'select * from UserRoles '; $sql= $sql. where (UserKey = '$UsernameInRole') ; $rsUserRoles-Open($sql, $con, Win32::ADO::adOpenDynamic, Win32::ADO::adLockOptimistic, Win32::ADO::adCmdText); Win32::ADO::CheckDBErrors($con, [EMAIL PROTECTED]) or die Request sql failed at \n, @DBerrors; $SubroutinePath = $rsUserRoles-fields(Location)-value; ###This is where it blows saying that value dosn't exist. and gives the CGI errors. $SubroutineName = $rsUserRoles-fields(ProgramName)-value; $rsUserRoles-Close; print $web-header(); require $SubroutinePath; eval($SubroutineName); Thanks Larry sub ConInfo { use Win32::OLE; use Win32::OLE::Variant; use Win32::ADO; $con = Win32::OLE-new(ADODB.Connection); #; Everything after this line is an OLE DB initstring $con-Open(Provider=MSDAORA.1;Password=somepassword;User ID=someidname;Data Source=;Persist Security Info=True); $cmd = Win32::OLE-new(ADODB.Command); } 1; ___ 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: Spreadsheet-like data entry/editing in PerlTk?
Have a look in the TK demo directories at the widget demos: I seem to remember there's one that does almost what you want. Failing that, try the tk usenet group. hth lee At 14:37 30/09/2003, Alan Dickey wrote: Dax T. Games wrote: Does anyone know of a Tk widget or have some sample code that would allow data entry and editing like with a spreadsheet in PerlTk. try perldoc Tk::Entry Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol. Probald ki most! http://www.freestart.hu ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: 'which' functionality in Perl
On approximately 9/30/2003 11:03 AM, came the following characters from the keyboard of Arms, Mike: Dax T. Games [EMAIL PROTECTED] wrote: How would I determine if a file existed in a directory in the PATH environment variable on a Windows box with Perl. If the file exists I want to return the full path to the file. The functionality I want is similar to 'which' on Unix/Linux. Dax, I second the folks recommending the Perl Power Tools (ppt) if you want a straight implementation of Unix commands in Perl. I wrote my own enhanced which.pl command which could do more than the standard Unix which: ... very interesting description deleted This may be overkill for your needs, but I have found this to be an extremely useful utility on my Win32 platform. I add to it occasionally when I find more things that I want it to be able to do. You can get it here: http://marms.sourceforge.net/perl/ Hi Mike, You have a very nice which.pl there, but I see two omissions, which may be resolved by the same coding... 1) You require that an executable have an extension from PATHEXT to be found... Windows doesn't. Extensionless executables are possible, and runnable. Further, extensions not on PATHEXT are runnable by specifying the extension when running it. 2) You require that an executable be specified to which without an extension... Windows permits specification of the extension... then you add each extension from PATHEXT in turn, and therefore do not find the executable. I think both of these could be resolved by implicitly adding a null or empty extension to your internal copy of PATHEXT ... I'm not sure whether Windows checks that first or last, but you should figure that out, and do the same. For example, I placed your which.pl in a directory on my path, but .PL is not in my PATHEXT. So I get the following results: which.pl which.pl = which.pl not found in PATH which.pl which = d:\...\which.exe d:\...\which.com which.pl which.exe = which.exe not found in PATH I wouldn't have expected which.pl to be listed by which.pl which, but I would expect it to be listed by which.pl which.pl. And I would expect which.pl which.exe to find my which.exe, even though I did specify the extension. Perhaps you would prefer that it not work as I suggest, but I think that my suggestions would make it work more like Windows does. And for a which.pl that seems to be trying to work well in a Windows environment... it would seem to me that it would be a good idea to work more like Windows does. -- Glenn -- http://nevcal.com/ === Like almost everyone, I receive a lot of spam every day, much of it offering to help me get out of debt or get rich quick. It's ridiculous. -- Bill Gates ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: 'which' functionality in Perl
- Original Message - From: Arms, Mike [EMAIL PROTECTED] To: 'Dax T. Games' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, September 30, 2003 13:03 Subject: RE: 'which' functionality in Perl Dax T. Games [EMAIL PROTECTED] wrote: How would I determine if a file existed in a directory in the PATH environment variable on a Windows box with Perl. If the file exists I want to return the full path to the file. The functionality I want is similar to 'which' on Unix/Linux. Dax, I second the folks recommending the Perl Power Tools (ppt) if you want a straight implementation of Unix commands in Perl. I wrote my own enhanced which.pl command which could do more than the standard Unix which: 1. If on a Win32 platform, it is PATHEXT aware and will match without typing the suffix. And in such a case it only matches files that have a suffix in the PATHEXT list. Example: C:\which gvim C:\WINNT\gvim.bat C:\Pkgs\vim\vim61\gvim.exe 2. Each directory in the PATH environment variable is searched and all matches are displayed (not just the first). You can see this in the example above. This is useful to determine if you have more than one executable of the same basename in various directories of your PATH. The first file with the given basename hides the others from being executed (unless a full path is specified). 3. Can type in a wildcard character '*' or '?' to have it match any executables with that filename pattern. Example: C:\ which.pl jav* C:\Java\j2sdk1.4.1_02\bin\java.exe C:\Java\j2sdk1.4.1_02\bin\javac.exe C:\Java\j2sdk1.4.1_02\bin\javadoc.exe C:\Java\j2sdk1.4.1_02\bin\javah.exe C:\Java\j2sdk1.4.1_02\bin\javap.exe C:\Java\j2sdk1.4.1_02\bin\javaw.exe C:\WINNT\system32\java.exe C:\WINNT\system32\javaw.exe Another example illustrating two wildcards: C:\which *nd* C:\Perl\bin\find2perl.bat C:\Pkgs\bin\pfind.pl C:\Perl\bin\find2perl.bat C:\WINNT\system32\append.exe C:\WINNT\system32\command.com C:\WINNT\system32\expand.exe C:\WINNT\system32\faxsend.exe C:\WINNT\system32\find.exe C:\WINNT\system32\findstr.exe C:\WINNT\system32\nddeapir.exe C:\WINNT\system32\rundll32.exe C:\WINNT\system32\sndrec32.exe C:\WINNT\system32\sndvol32.exe 4. A command line option ('-l' or '--list') to provide a directory listing for matching items. Example: C:\which -l jav* 2003/02/20 14:17:34 24677 C:\Java\j2sdk1.4.1_02\bin\java.exe 2003/02/20 14:17:34 28794 C:\Java\j2sdk1.4.1_02\bin\javac.exe 2003/02/20 14:17:34 28800 C:\Java\j2sdk1.4.1_02\bin\javadoc.exe 2003/02/20 14:17:34 28794 C:\Java\j2sdk1.4.1_02\bin\javah.exe 2003/02/20 14:17:34 28790 C:\Java\j2sdk1.4.1_02\bin\javap.exe 2003/02/20 14:17:34 28775 C:\Java\j2sdk1.4.1_02\bin\javaw.exe 2003/02/20 14:17:38 24677 C:\WINNT\system32\java.exe 2003/02/20 14:17:38 28775 C:\WINNT\system32\javaw.exe 5. A command line option ('-m' or '--md5') to compute a MD5 digest checksum for matching items. Example: C:\which -m jav* 9f455abce73150ed13707c1827589501 C:\Java\j2sdk1.4.1_02\bin\java.exe 96fa7cc38ef36a16750cdfaeb7ce7c84 C:\Java\j2sdk1.4.1_02\bin\javac.exe 2e2752ccf39d3d8d5654153b23ef44d0 C:\Java\j2sdk1.4.1_02\bin\javadoc.exe d967925f345b70bcc2c379b0e9e65c35 C:\Java\j2sdk1.4.1_02\bin\javah.exe 29bf016d4642956a47364b0e0b612d36 C:\Java\j2sdk1.4.1_02\bin\javap.exe 2ec1d702ff5252e88e12b124c53f9099 C:\Java\j2sdk1.4.1_02\bin\javaw.exe 9f455abce73150ed13707c1827589501 C:\WINNT\system32\java.exe 2ec1d702ff5252e88e12b124c53f9099 C:\WINNT\system32\javaw.exe Note: the '-m' and '-l' options can be combined: C:\which -l -m java 9f455abce73150ed13707c1827589501 2003/02/20 14:17:34 24677 C:\Java\j2sdk1.4.1_02\bin\java.exe 9f455abce73150ed13707c1827589501 2003/02/20 14:17:38 24677 C:\WINNT\system32\java.exe This is good for finding truly duplicate executables. 6. On Win32 platforms, the current directory '.' is prepended to the PATH list as this is implied on Win32 systems (this is not implied on Unix systems). Example: C:\Tempwhich which .\which.pl C:\Pkgs\bin\which.pl 7. I also implement multi-level debugging and tracing to allow more explanation of the breakout of the filename argument and the PATH and PATHEXT environment variables. Example: C:\Tempwhich -# which* Debugging C:\Temp\which.pl -d which version = v1.4 2003/09/14 debug= 1 filename = which PATHEXT = .COM .EXE .BAT .CMD .VBS .VBE .JS .JSE .WSF .WSH .PL Matches: .\which.pl C:\Pkgs\bin\which.pl C:\Pkgs\bin\which0.bat which.pl: Finished This may be overkill for your needs, but I have found this to be an extremely useful utility on my Win32 platform. I add to it occasionally when I find more things that I want it to be able to do. You can get it here: http://marms.sourceforge.net/perl/ -- Mike Arms Mike,
Validate user from web form to active directory
Hi to all, could somebody send a piece of code to validate an username passwd from a web form with an active directory server?, only the cgi code is enought. And thanks. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: 'which' functionality in Perl
On approximately 9/30/2003 11:46 AM, came the following characters from the keyboard of Glenn Linderman: On approximately 9/30/2003 11:03 AM, came the following characters from the keyboard of Arms, Mike: Dax T. Games [EMAIL PROTECTED] wrote: How would I determine if a file existed in a directory in the PATH environment variable on a Windows box with Perl. If the file exists I want to return the full path to the file. The functionality I want is similar to 'which' on Unix/Linux. Dax, I second the folks recommending the Perl Power Tools (ppt) if you want a straight implementation of Unix commands in Perl. I wrote my own enhanced which.pl command which could do more than the standard Unix which: ... very interesting description deleted This may be overkill for your needs, but I have found this to be an extremely useful utility on my Win32 platform. I add to it occasionally when I find more things that I want it to be able to do. You can get it here: http://marms.sourceforge.net/perl/ Hi Mike, You have a very nice which.pl there, but I see two omissions, which may be resolved by the same coding... 1) You require that an executable have an extension from PATHEXT to be found... Windows doesn't. Extensionless executables are possible, and runnable. Further, extensions not on PATHEXT are runnable by specifying the extension when running it. 2) You require that an executable be specified to which without an extension... Windows permits specification of the extension... then you add each extension from PATHEXT in turn, and therefore do not find the executable. I think both of these could be resolved by implicitly adding a null or empty extension to your internal copy of PATHEXT ... I'm not sure whether Windows checks that first or last, but you should figure that out, and do the same. For example, I placed your which.pl in a directory on my path, but .PL is not in my PATHEXT. So I get the following results: which.pl which.pl = which.pl not found in PATH which.pl which = d:\...\which.exe d:\...\which.com which.pl which.exe = which.exe not found in PATH I wouldn't have expected which.pl to be listed by which.pl which, but I would expect it to be listed by which.pl which.pl. And I would expect which.pl which.exe to find my which.exe, even though I did specify the extension. Perhaps you would prefer that it not work as I suggest, but I think that my suggestions would make it work more like Windows does. And for a which.pl that seems to be trying to work well in a Windows environment... it would seem to me that it would be a good idea to work more like Windows does. Oh, and two more bizarrenesses Given a file foo.foo.exe on the path, which.pl foo = d:\...\foo.foo.exe This is not expected, nor would Windows find such a thing. Also, some more bizarreness: I installed the Win2K support tools from the installation media, its default path is C:\Program Files\Support Tools... and it contains a number of executables, including depends.exe. which.pl depends = depends not found in PATH however, another which.exe finds and reports it. I think you have a problem with paths containing spaces. -- Glenn -- http://nevcal.com/ === Like almost everyone, I receive a lot of spam every day, much of it offering to help me get out of debt or get rich quick. It's ridiculous. -- Bill Gates ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: removing empty directories
Because they only want the empty ones, and this code is cross platform? Ilene - Original Message - From: Messenger, Mark [EMAIL PROTECTED] To: John Deretich [EMAIL PROTECTED]; Perl-Win32-Admin-Request (E-mail) [EMAIL PROTECTED] Sent: Tuesday, September 30, 2003 4:57 PM Subject: RE: removing empty directories Dumb question: Why not use 'rd'? Rd is included in NT4/2000/XP. Example: `rd /s /q \c:\\some dir to delete\`; # /s = kill sub dirs/q = quiet. -Original Message- From: John Deretich [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2003 3:05 PM To: Perl-Win32-Admin-Request (E-mail) Subject: removing empty directories Hello, I was wondering if anyone has a script that will remove empty directories and subdirectories. The code that I am using will delete the entries at the first sublevel but not at multiple sublevels. Here's my code: opendir(EMPTYDIR, $searchdrive1) ; while ($directoryempty = readdir(EMPTYDIR)) { if ($directoryempty ne . $directoryempty ne ..) { $directoryempty = $searchdrive1 . \\ . $directoryempty; if (-d $directoryempty) { opendir(EMPTY, $directoryempty); while ($subdirectoryempty = readdir(EMPTY)) { if ($subdirectoryempty ne . $subdirectoryempty ne ..) { $subdirectoryempty = $directoryempty . \\ . $subdirectoryempty; system (rmdir \$subdirectoryempty\ ) || warn Cannot remove $subdirectoryempty: $! \n; } } system (rmdir \$directoryempty\ ) || warn Cannot remove $directoryempty: $! \n; } } } I have File::Path but when I run it, it will remove more than what I need. thanks, John ___ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Admin 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: OLE again
In these examples from recent mailings to the list my $IE = Win32::OLE-GetActiveObject( 'WebBrowser.Application' ); my $Excel = Win32::OLE-GetActiveObject('Excel.Application') Where can find a list of everything I can do with GetActiveObject in place of 'webbrowser.application' and 'excel.application' ? I tried GetActiveObject on the M$ web site and found: GetActiveObject Retrieves a pointer to a running object that has been registered with OLE. Which seems right but I missed where the running object was registered with OLE. The point in these example above was to start the application. A bit confused. Can anyone point me to the unconfuse station? ms ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Spreadsheet-like data entry/editing in PerlTk?
- Original Message - From: Lynn. Rickards [EMAIL PROTECTED] To: 'Dax T. Games' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, September 30, 2003 1:38 PM Subject: RE: Spreadsheet-like data entry/editing in PerlTk? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Dax T. Games Sent: Tuesday, September 30, 2003 8:12 AM To: [EMAIL PROTECTED] Subject: Spreadsheet-like data entry/editing in PerlTk? Does anyone know of a Tk widget or have some sample code that would allow data entry and editing like with a spreadsheet in PerlTk. Currently I am familiar with the HList widget but as far as I know it only will list what you populate it with you cannot enter data or edit data. Thanks, Dax http://www.cpan.org/modules/by-module/Tk/ Look for Tk-TableMatrix. Also available on ppm from AS. -Lynn. Correct you are, Lynn. Tk::TableMatrix is exactly what Dax needs. There are numerous sample scripts included with the source. So after you ppm it - download the CPAN source code for the demos. Jack ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs