Re: [PBML] Re:detect the path of a directory
On Tue, 15 Jan 2002, Jorge Goncalvez wrote: > > Hi, > I am under Windows and What I wanted is to detect where a directory is > stored(in fact I wanted his path, like for exemple I wanted to detect where the > directory OXE is,and i wanted his path that could be c:/OXE, or D:/OXE, Or > E:/OXE or X:/Y/OXE etc... > Is there a way to do this in perl Thanks in advance for your precious help. > You can "execute" a cd command with either backticks or a system call to determine the current drive. However be aware that perl (at least 5.3) doesn't preserve the current drive like it does the current directory. [EMAIL PROTECTED] All opinions are my own and not necessarily those of my employer ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: problem with eval
You might also want to play with "require". That would allow you to "execute" the entire contents of the file in one operation. However, you should be aware that there there are some scoping differences between "eval" and "require". You'll also have to add an addition line to the file to make the "require" work correctly, that line is: 1; [EMAIL PROTECTED] All opinions are my own and not necessarily those of my employer On Tue, 15 Jan 2002, thiyag wrote: > i have a file with perl statments,I want them to be access few lines(depends >dynamically) in my programe , > > > can anyone suggest me how to go about with it...! i tried reading the file line by >line extracting the needed line's into an array and then executing each element with >eval ( )...but it did't work . > Get Your Private, Free E-mail from Indiatimes at http://email.indiatimes.com > Buy Music, Video, CD-ROM, Audio-Books and Music Accessories from >http://www.planetm.co.in > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
HELP: MemMap module
Hello All: I wanted to get the MemMap module to implement shared memory in my Perl script on NT. I am unable to get it from amine's website as the Zip is not present. Does anybody have the MemMap module or has any clues. Thanks in advance. Ashish Tiwari ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: what's the difference between .pm and .pl ???
Tony, Aside from the fact that a Perl module must return true, the difference in a Perl script (*.pl) and a Perl module (*.pm) is mainly one of intended use. Both scripts and modules can define global and local variables, subroutines, and classes. Both can contain top-level code (i.e., not inside subroutines) that will execute when the file is loaded. We normally think of the "real" work as being done in the *.pl script while the *.pm module serves as a subroutine library. However, you could write a trivial script which contained a single require statement for a module where the module then did everything. In practice, the top-level code in a module--if any--is there to perform one time initialization when the module is loaded. For example, some of the Net::* modules probe the network when they are loaded, even if they are never called. (This is how you can sometimes get complie time errors for things you never heard of.) If the module loaded correctly (which really means the initialization succeeded), then the module returns true. If something failed, the module returns false, and the calling script will abort. Therefore, you will be that most modules have 1; as their last line to be sure they return true to the using (module loaded as compile time) or requiring (module loaded during execution) script. Merrill -Original Message- From: tony [mailto:[EMAIL PROTECTED]] Sent: Monday, January 14, 2002 7:03 PM To: [EMAIL PROTECTED] Subject: what's the difference between .pm and .pl ??? ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: problem with eval
No, I don't think do('file.pl') is called for, because the op states he only wants only some of the lines from the file. Of course, he could _put_ these lines in another file and do('_that_'). Might even solve his problem. It would really help to see the code and know what is allowed in all such code. From perlfaq8, "Whats the difference between require and use?": do $file is like eval cat $file, except the former: 1.1: searches @INC and updates %INC. 1.2: bequeaths an *unrelated* lexical scope on the evaled code. Please. Post in plain text. Ugh. -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Venkataramana MokkapatiSent: Tuesday, January 15, 2002 9:16 AMTo: Ron Hartikka; thiyag; perl-win32-users Mailing ListSubject: Re: problem with eval do('file.pl') - Original Message - From: Ron Hartikka Sent: Tuesday, January 15, 2002 5:50 AM To: thiyag; perl-win32-users Mailing List Subject: RE: problem with eval Seems like a hard way to program! But, maybe it's right for your situation. Please post more if you can. What do you mean by "it didn't work"? Try printing the values returned by eval() - undefined value message indicates bad code. -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of thiyagSent: Tuesday, January 15, 2002 5:41 AMTo: perl-win32-users Mailing ListSubject: problem with eval i have a file with perl statments,I want them to be access few lines(depends dynamically) in my programe , can anyone suggest me how to go about with it...! i tried reading the file line by line extracting the needed line's into an array and then executing each element with eval ( )...but it did't work . Get Your Private, Free E-mail from Indiatimes at http://email.indiatimes.comBuy Music, Video, CD-ROM, Audio-Books and Music Accessories from http://www.planetm.co.in Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com
Re: Win32::GUI, msvcrt.dll & Win98
Thank you Johan & Rob, I did try that & I no longer received the error. However now I get another error... "win32::GUI::Windows=HASH(0x17ffa7c)" is not exported by the Win32::GUI module" I guess i need to try and get the most recent documentation from dada and see what's up... Thank you all for your help, it will be Tk for a little while yet, Mike At 05:02 PM 1/15/02 +1100, you wrote: >- Original Message - >From: "Miguel E. Guajardo" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> > > > >Try (as Johan suggested) : > >$main->AddLabel( -name => 'anything', > -text => "Hello, world"); > >This was unnecessary with earlier versions. > >Cheers, >Rob > > >___ >Perl-Win32-Users mailing list >[EMAIL PROTECTED] >http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users Miguel (Mike) E. Guajardo KERA / KDTN Engineering 3000 Harry Hines Blvd. Dallas, Texas 75201 Phone : 214-740-9313 [EMAIL PROTECTED] ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
[PBML] Re:detect the path of a directory
Hi, I am under Windows and What I wanted is to detect where a directory is stored(in fact I wanted his path, like for exemple I wanted to detect where the directory OXE is,and i wanted his path that could be c:/OXE, or D:/OXE, Or E:/OXE or X:/Y/OXE etc... Is there a way to do this in perl Thanks in advance for your precious help. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: problem with eval
do('file.pl') - Original Message - From: Ron Hartikka Sent: Tuesday, January 15, 2002 5:50 AM To: thiyag; perl-win32-users Mailing List Subject: RE: problem with eval Seems like a hard way to program! But, maybe it's right for your situation. Please post more if you can. What do you mean by "it didn't work"? Try printing the values returned by eval() - undefined value message indicates bad code. -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of thiyagSent: Tuesday, January 15, 2002 5:41 AMTo: perl-win32-users Mailing ListSubject: problem with eval i have a file with perl statments,I want them to be access few lines(depends dynamically) in my programe , can anyone suggest me how to go about with it...! i tried reading the file line by line extracting the needed line's into an array and then executing each element with eval ( )...but it did't work . Get Your Private, Free E-mail from Indiatimes at http://email.indiatimes.comBuy Music, Video, CD-ROM, Audio-Books and Music Accessories from http://www.planetm.co.in Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com
RE: problem with eval
Seems like a hard way to program! But, maybe it's right for your situation. Please post more if you can. What do you mean by "it didn't work"? Try printing the values returned by eval() - undefined value message indicates bad code. -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of thiyagSent: Tuesday, January 15, 2002 5:41 AMTo: perl-win32-users Mailing ListSubject: problem with eval i have a file with perl statments,I want them to be access few lines(depends dynamically) in my programe , can anyone suggest me how to go about with it...! i tried reading the file line by line extracting the needed line's into an array and then executing each element with eval ( )...but it did't work . Get Your Private, Free E-mail from Indiatimes at http://email.indiatimes.comBuy Music, Video, CD-ROM, Audio-Books and Music Accessories from http://www.planetm.co.in
Re: problem with eval
"thiyag" <[EMAIL PROTECTED]> > i have a file with perl statments,I want them to be access few line > (depends dynamically) in my programe , > can anyone suggest me how to go about with it...! i tried reading the > file line by line extracting the needed line's into an array and then > executing each element with eval ( )...but it did't work . There's no reason this won't work, but you you may have to be careful about several things, such as the scoping of variables. You may find that concatenating the list into a string and "eval"-ing that produces better results. You should also check $@ after each "eval"; if your code fails to compile this is the only way you will know. Here's a short working script. Note the games played with backslashes to get the code into the list correctly. This would presumably not be a problem if the script was being read from a file. @ARGV = qw{Hello World!} unless @ARGV; my @stuff = ( "\$foo = join ' ', \@ARGV;", "print qq{\$foo\\n};", ); print "Foreach -\n"; foreach (@stuff) {eval $_; die $@ if $@;} print "Eval array\n"; print eval @stuff; die $@ if $@; print "Eval string\n"; eval "@stuff"; die $@ if $@; Here's the output: C:\>perl trw.pl Foreach - Hello World! Eval array Eval string Hello World! Iterating over the list works, but be aware that it would print a blank line if the first line was "my $foo = ..." rather than just "$foo = ...". The second produces no output, because "eval" supplies scalar context, so that it's equivalent to "eval 2" (since there are two elements in the list). The third should work as expected even in the presence of "my" variables, since they all get evaluated in the same scope. I will leave it to others to discuss the merits of "@stuff" versus join ' ', @stuff Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
problem with eval
i have a file with perl statments,I want them to be access few lines(depends dynamically) in my programe , can anyone suggest me how to go about with it...! i tried reading the file line by line extracting the needed line's into an array and then executing each element with eval ( )...but it did't work . Get Your Private, Free E-mail from Indiatimes at http://email.indiatimes.comBuy Music, Video, CD-ROM, Audio-Books and Music Accessories from http://www.planetm.co.in