Re: Date function
"Royer, Robby E (Compaq)" wrote: > > Can someone explain to me how I can convert a string that represents the > number of days since Jan 1 of the current year. The log file that I am > reading is reporting 23 as the day of the year, which would convert to Jan > 23, 2003. > > Is there a function. > > robby By using the built-in Time::Local module, a simple date math problem like this is trivial. Rick ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: How to execute a command under win98 via perl script?
On Wed, 27 Aug 2003, Tony Cheung wrote: > Hi, everybody > How to execute a command under win98 via perl script? Example: copy c:\a.txt d:\ > Thanks Look at the docs in perlfunc for the system() function and either use single quotes or escape the backslashes if the parameter string uses double quotes. [EMAIL PROTECTED] All opinions are my own and not necessarily those of my employer ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Obtaining a perl hash id in a call back function.
On Wed, 27 Aug 2003, Saber ZRELLI wrote: > > Hi all , > > > The problem is as follows : > > > i have several communication sockets , to each socket i attach a costumised > output window ( which is a perl object i've created ) . > and i store all the output windows in a hash called WIN_LIST , this is the > code snippet : > > >>> > $WIN_LIST{$sock}=new perl_modules::out_put_window(); > <<< > > then i attach a function to the event destroy of each output window ( > when i close the putput window i want perl to call a certain function ) > this is the snippet : > > >>> > $WIN_LIST{$sock}->display->bind ('' => \&remove_window); > <<< > > and this is the code of remove_window function : > > > >>> > sub remove_window { > > print " trying to remove $Tk::widget \n"; > foreach $k (keys %WIN_LIST) > { > if ( $WIN_LIST{$k} == $Tk::widget ) > { > delete $WIN_LIST{$k}; > $s->remove($SOCK_LIST{$k}); > delete $SOCK_LIST{$k}; > print " $Tk::widget Found in Hash and deleted \n"; > > > } > } > > > } > > <<< > > what i have noticed is : > > the $Tk::widget have this format : > while $WIN_LIST{$k} have this one : > > what i want to know , is how can i obtain the $WIN_LIST{$k} like format in > the remove_window function. > i tried to send the $WIN_LIST{$k} as a parameter in the callback > specification , but that caused instant call to the call back ( not caused > by the destroy event ). > If you want to handle each socket as it is closed then you need to create a custom DESTROY method for the object. If you simply want to release all win_list objects at the time you exit your script then code in an END block could perform this function. [EMAIL PROTECTED] All opinions are my own and not necessarily those of my employer ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: How to execute a command under win98 via perl script?
On Wed, 27 Aug 2003, Wenjie Wang wrote: > system "copy c:\a.txt d:\a.txt"; > This won't work due to unescaped backslashes in a double quoted string. [EMAIL PROTECTED] All opinions are my own and not necessarily those of my employer ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Invoke perl script from CGI and redirect STDOUT, STDERR to afile
On Wed, 27 Aug 2003, Savinder Puri wrote: > Hi All, > > Here's what I want to do: > > 1. A web-page invokes a CGI perl script (say cgi.pl), and passes certain user inputs > in the QUERYSTRING. > > 2. The CGI script does some pre-processing and invokes another perl script (say > a.pl), passing it the QUERYSTRING parameters. > > 3. Script a.pl creates redirects STDOUT and STDERR to a log-file. (create an > action-log, to aid debugging). > > > > The problem: > > Step 2 > > What is the best to invoke a perl script from CGI ? The perl script does a lot of > cpu and network intensive activity. The CGI should wait for the perl script to > finish, and then submit a webpage back. > > Step3 > > The print statements in a.pl are being printed onto the browser (even when STDOUT > ands STDERR are redirected to a file). > > How do i solve this ? > > Hope i made myself clear. > Don't use the STDERR and STDOUT filehandles in a.pl, instead open a different filehandle and send its output to a file. You may want to open it with append othersize the output of a subsequent use of the cgi script will overwrite that of the current. Note the STDOUT (and STDERR) of all the nested scripts are inhereted from the top level cgi script called by the web server. You should not mess with the STDOUT filehandle usless you use it to send output back to the browser. I suggest you use system() to call the embedded scripts. Use of backquotes messes with STDOUT. [EMAIL PROTECTED] All opinions are my own and not necessarily those of my employer ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Help with parsing file
> I have a large text file, which contains data in the form: > > parameter name="value" // comment about the line > > For example: > > LCD Display Modes="3" // Add the modes to allow them: 1=status 2=aids > 4=engine/brake temps > > I am trying to make a GUI that will allow you to see the parameter, default > and currect values, comment and will allow you to change the value. > > I can do the GUI part with no problem, but I'm wondering how to handle the > file part. I just need to know what's the best way of going about it. I.e. > how to get all the data into my script, and how to write it back out again. > > Should I read the whole file into an array, process each line into the GUI, > allow changes to each line, then delete the original file, and write the > array back out to a file? > > I just need a principle to work with, or a pointer to where to start > reading. > > Thanks. > Take a look at Tie::File, it will take care of the reading/writing part for you. Then all you need to do is write a little bit of code to parse a line into the elements you want to display, and another little bit to reformat them before updating the array (file). Steve ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Date function
Take a look on CPAN. Date::Manip comes to mind. Jim - Original Message - From: "Royer, Robby E (Compaq)" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, August 27, 2003 10:22 AM Subject: Date function > Can someone explain to me how I can convert a string that represents the > number of days since Jan 1 of the current year. The log file that I am > reading is reporting 23 as the day of the year, which would convert to Jan > 23, 2003. > > Is there a function. > > robby > ___ > 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
Date function
Can someone explain to me how I can convert a string that represents the number of days since Jan 1 of the current year. The log file that I am reading is reporting 23 as the day of the year, which would convert to Jan 23, 2003. Is there a function. robby ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RTF::TEXT::Converter
Greetings perlers, I'm using RTF::TEXT:Converter in a migration of data from RTF to Plain Text. The problem is that I cannot redirect the parsing to a file or a variable, even though I have changed the Output setting. Here's part of the code, I need to redirect from STDOUT to a variable preferably. Any help is highly appreciated. require RTF::TEXT::Converter; my $self = new RTF::TEXT::Converter(Output => \*STDOUT); $self->parse_string($tempo); Regards, - Juan Carlos Cruz Dada Senior Developer Cital Web Solutions ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Help with better way to do this
The below snippet works, but is very hard to customize and format into a table. How can this be redone? #!/Perl -w use strict; # - my $numbers ="04|09|15|16|21|23|25|29|38|40|41|42|54|55|56|62|64|65|67|68|73|80"; my $numbers2="02|04|11|15|16|23|44|54|62|73"; # - my %hash_lookup; $hash_lookup{$_} = "x" foreach (split(/\|/,$numbers)); my %hash_lookup2; $hash_lookup2{$_} = "x" foreach (split(/\|/,$numbers2)); # - my $count_to_eighty = 0; foreach my $key (1..80){ $count_to_eighty++; $key = "0".$key if ($key <= 9); # put a 0 in front of single nums my $from_numbers = (defined $hash_lookup{$key}) ? "$key-$key" : "$key"; my $from_numbers2 = (defined $hash_lookup2{$key}) ? "$key" : ""; print "$from_numbers-$from_numbers2 \n"; } This script just counts from 01 to 80 and matches $numbers to it then matches $numbers2 to $numbers.. Output looks like.. 01-# just count 02-02# count and $numbers 03- #count 04-04-04 #count $numbers and $numbers2 05- # and so on.. 06- 07- 08- 09-09- 10- 11-11 12- 13- 14- 15-15-15 16-16-16 17- 18- .. 80 Any help greatly appreciated Thanks in advance. Steve _ Get MSN 8 and enjoy automatic e-mail virus protection. http://join.msn.com/?page=features/virus ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Help with parsing file
Title: RE: Help with parsing file First, I'd change the // to # Then, I'd actually set the parameter like a scalar, i.e. $LCDDisplayModes=3; # Add the modes to allow them: 1=status 2=aids 4=engine/brake temps Then in the main script: require 'parameter_file'; -Original Message- From: Beckett Richard-qswi266 [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 27, 2003 8:15 AM To: '[EMAIL PROTECTED]' Subject: Help with parsing file Guys, I have a large text file, which contains data in the form: parameter name="value" // comment about the line For example: LCD Display Modes="3" // Add the modes to allow them: 1=status 2=aids 4=engine/brake temps I am trying to make a GUI that will allow you to see the parameter, default and currect values, comment and will allow you to change the value. I can do the GUI part with no problem, but I'm wondering how to handle the file part. I just need to know what's the best way of going about it. I.e. how to get all the data into my script, and how to write it back out again. Should I read the whole file into an array, process each line into the GUI, allow changes to each line, then delete the original file, and write the array back out to a file? I just need a principle to work with, or a pointer to where to start reading. Thanks. R. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Help with parsing file
Guys, I have a large text file, which contains data in the form: parameter name="value" // comment about the line For example: LCD Display Modes="3" // Add the modes to allow them: 1=status 2=aids 4=engine/brake temps I am trying to make a GUI that will allow you to see the parameter, default and currect values, comment and will allow you to change the value. I can do the GUI part with no problem, but I'm wondering how to handle the file part. I just need to know what's the best way of going about it. I.e. how to get all the data into my script, and how to write it back out again. Should I read the whole file into an array, process each line into the GUI, allow changes to each line, then delete the original file, and write the array back out to a file? I just need a principle to work with, or a pointer to where to start reading. Thanks. R. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: How to execute a command under win98 via perl script?
You got me on it:) Don't trust copy and paste. it was meant to save time, but might ends up spent more time to debug:( Regards, WWang - Wenjie Wang(a.k.a. William) [EMAIL PROTECTED] WANG Infonology Systems Ph: +61 2-98712018/0412688380 = :-Original Message- :From: [EMAIL PROTECTED] :[mailto:[EMAIL PROTECTED] Behalf Of :[EMAIL PROTECTED] :Sent: Wednesday, 27 August 2003 9:32 PM :To: [EMAIL PROTECTED] :Subject: Re: How to execute a command under win98 via perl script? : : : : : : : :Hi, : :don't forget to double '\' inside a "" quoted string. : :Regards, :Martin Kellner : : : : : : : : :Wenjie Wang: 27.08.2003 12:08 : :system "copy c:\a.txt d:\a.txt"; : : : :- :Wenjie Wang(a.k.a. William) [EMAIL PROTECTED] :WANG Infonology Systems Ph: +61 2-98712018/0412688380 := : : : -Original Message- : From: [EMAIL PROTECTED] : [mailto:[EMAIL PROTECTED] Behalf Of Tony : Cheung : Sent: Wednesday, 27 August 2003 5:51 PM : To: [EMAIL PROTECTED] : Subject: How to execute a command under win98 via perl script? : : Hi, everybody : How to execute a command under win98 via perl script? Example: copy : c:\a.txt d:\ : Thanks : : : : :** :This email and any files transmitted with it are confidential and :intended solely for the use of the individual or entity to whom they :are addressed. If you have received this email in error please notify :[EMAIL PROTECTED] :This footnote also confirms that this email message has been inspected :by SOPHOS Antivirus for the presence of computer viruses. :** : :___ :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: How to execute a command under win98 via perl script?
Hi, don't forget to double '\' inside a "" quoted string. Regards, Martin Kellner Wenjie Wang: 27.08.2003 12:08 system "copy c:\a.txt d:\a.txt"; - Wenjie Wang(a.k.a. William) [EMAIL PROTECTED] WANG Infonology Systems Ph: +61 2-98712018/0412688380 = -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Tony Cheung Sent: Wednesday, 27 August 2003 5:51 PM To: [EMAIL PROTECTED] Subject: How to execute a command under win98 via perl script? Hi, everybody How to execute a command under win98 via perl script? Example: copy c:\a.txt d:\ Thanks ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify [EMAIL PROTECTED] This footnote also confirms that this email message has been inspected by SOPHOS Antivirus for the presence of computer viruses. ** ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: How to execute a command under win98 via perl script?
Hi, doesn't system "copy c:\\a.txt d:\\"; work? Regards, Martin Kellner Tony Cheung: 27.08.2003 09:51 Hi, everybody How to execute a command under win98 via perl script? Example: copy c:\a.txt d:\ Thanks ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify [EMAIL PROTECTED] This footnote also confirms that this email message has been inspected by SOPHOS Antivirus for the presence of computer viruses. ** ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: How to execute a command under win98 via perl script?
system "copy c:\a.txt d:\a.txt"; -Wenjie Wang(a.k.a. William) [EMAIL PROTECTED]WANG Infonology Systems Ph: +61 2-98712018/0412688380= -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Tony CheungSent: Wednesday, 27 August 2003 5:51 PMTo: [EMAIL PROTECTED]Subject: How to execute a command under win98 via perl script? Hi, everybody How to execute a command under win98 via perl script? Example: copy c:\a.txt d:\ Thanks
How to execute a command under win98 via perl script?
Hi, everybody How to execute a command under win98 via perl script? Example: copy c:\a.txt d:\ Thanks
RE: Obtaining a perl hash id in a call back function (formats added)
Hi all , The problem is as follows : i have several communication sockets , to each socket i attach a costumised output window ( which is a perl object i've created ) . and i store all the output windows in a hash called WIN_LIST , this is the code snippet : >>> $WIN_LIST{$sock}=new perl_modules::out_put_window(); <<< then i attach a function to the event destroy of each output window ( when i close the putput window i want perl to call a certain function ) this is the snippet : >>> $WIN_LIST{$sock}->display->bind ('' => \&remove_window); <<< and this is the code of remove_window function : >>> sub remove_window { print " trying to remove $Tk::widget \n"; foreach $k (keys %WIN_LIST) { if ( $WIN_LIST{$k} == $Tk::widget ) { delete $WIN_LIST{$k}; $s->remove($SOCK_LIST{$k}); delete $SOCK_LIST{$k}; print " $Tk::widget Found in Hash and deleted \n"; } } } <<< what i have noticed is : the $Tk::widget have this format : Tk::Text=HASH(0x.) while $WIN_LIST{$k} have this one : perl_modules::out_put_window=HASH(0x.) what i want to know , is how can i obtain the $WIN_LIST{$k} like format in the remove_window function. i tried to send the $WIN_LIST{$k} as a parameter in the callback specification , but that caused instant call to the call back ( not caused by the destroy event ). - Saber ZRELLI Application Engineer. Consumer and Microcontroller Groups. STMicroelectronics. Email : [EMAIL PROTECTED] Phone : +216 22552432 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lee Goddard Sent: Wednesday, August 27, 2003 7:22 AM To: Su, Yu; [EMAIL PROTECTED] Subject: RE: TK::JPEG Have a look at ftp://theoryx5.uwinnipeg.ca/ They may have one. At 04:08 27/08/2003, Su, Yu wrote: >Hi, > >Does anyone know where I can get a TK::JPEG ppd package for ActivePerl >v5.8.0? I downloaded the source code (v2.014)from CPAN, got compiler >error: ___ 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
Obtaining a perl hash id in a call back function.
Hi all , The problem is as follows : i have several communication sockets , to each socket i attach a costumised output window ( which is a perl object i've created ) . and i store all the output windows in a hash called WIN_LIST , this is the code snippet : >>> $WIN_LIST{$sock}=new perl_modules::out_put_window(); <<< then i attach a function to the event destroy of each output window ( when i close the putput window i want perl to call a certain function ) this is the snippet : >>> $WIN_LIST{$sock}->display->bind ('' => \&remove_window); <<< and this is the code of remove_window function : >>> sub remove_window { print " trying to remove $Tk::widget \n"; foreach $k (keys %WIN_LIST) { if ( $WIN_LIST{$k} == $Tk::widget ) { delete $WIN_LIST{$k}; $s->remove($SOCK_LIST{$k}); delete $SOCK_LIST{$k}; print " $Tk::widget Found in Hash and deleted \n"; } } } <<< what i have noticed is : the $Tk::widget have this format : while $WIN_LIST{$k} have this one : what i want to know , is how can i obtain the $WIN_LIST{$k} like format in the remove_window function. i tried to send the $WIN_LIST{$k} as a parameter in the callback specification , but that caused instant call to the call back ( not caused by the destroy event ). - Saber ZRELLI Application Engineer. Consumer and Microcontroller Groups. STMicroelectronics. Email : [EMAIL PROTECTED] Phone : +216 22552432 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lee Goddard Sent: Wednesday, August 27, 2003 7:22 AM To: Su, Yu; [EMAIL PROTECTED] Subject: RE: TK::JPEG Have a look at ftp://theoryx5.uwinnipeg.ca/ They may have one. At 04:08 27/08/2003, Su, Yu wrote: >Hi, > >Does anyone know where I can get a TK::JPEG ppd package for ActivePerl >v5.8.0? I downloaded the source code (v2.014)from CPAN, got compiler >error: ___ 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: Query the OS for CD-ROM drive letter?
Yes, using Win32API::File::GetLogicalDrives: getLogicalDrives "@roots= getLogicalDrives()" Returns the paths to the root directories of all logical drives currently defined. This includes all types of drive lettters, such as floppies, CD-ROMs, hard disks, and network shares. A typical return value on a poorly equipped computer would be "("A:\\","C:\\")". Maybe-useful, maybe-useless code follows. hth lee %DRIVETYPES = ( 3=>1, 4=>1,6=>1, ); my $_drives = sub { eval('require Win32API::File'); return Win32API::File::getLogicalDrives(); }; foreach my $d (&$_drives){ ($d) =~ /^(\w+:)/; if ($DRIVETYPES{Win32API::File::GetDriveType($d)} and chdir $d){ # ... } } At 23:12 26/08/2003, Terry Fowler wrote: I'm writing a script to gather info from a CD and I know that the drive letter of the CD-ROM drive is going to vary from machine to machine. Is there a way in Perl to query the OS for the drive letter of any CD-ROM drives? Terry Fowler Win2K Pro Perl 5.6.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: TK::JPEG
Have a look at ftp://theoryx5.uwinnipeg.ca/ They may have one. At 04:08 27/08/2003, Su, Yu wrote: Hi, Does anyone know where I can get a TK::JPEG ppd package for ActivePerl v5.8.0? I downloaded the source code (v2.014)from CPAN, got compiler error: ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Spawning.
Hi all, How to spawn a subroutine which does some set of operations on particular machine? Thanks, --janardhan. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Invoke perl script from CGI and redirect STDOUT, STDERR to a file
Title: Message Hi All, Here's what I want to do: 1. A web-page invokes a CGI perl script (say cgi.pl), and passes certain user inputs in the QUERYSTRING. 2. The CGI script does some pre-processing and invokes another perl script (say a.pl), passing it the QUERYSTRING parameters. 3. Script a.pl creates redirects STDOUT and STDERR to a log-file. (create an action-log, to aid debugging). The problem: Step 2 What is the best to invoke a perl script from CGI ? The perl script does a lot of cpu and network intensive activity. The CGI should wait for the perl script to finish, and then submit a webpage back. Step3 The print statements in a.pl are being printed onto the browser (even when STDOUT ands STDERR are redirected to a file). How do i solve this ? Hope i made myself clear. Thanks, Savinder.
RE: Win32::API help
Thanks Bill, It works ! Thanks a lot again ! With Best Regards, V.S. Jangale ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Command line options question
On Tue, 26 Aug 2003, Medlen, Jiri wrote: > Hi, > > I'm trying to simply capture VBAV29933 using Command line option > > result_sale.tmp contains > jmedlenproverisign< > /Partner>0 >MatchNo > MatchService Not > RequestedApprovedVBAV29933 Code>894PNI000 ata Name="IAVS" > Value="N"> > > > > perl -p -i.bak -e "s/(.*)<\/PNRef>/$1/g" result_sale.tmp > jiri.txt > Does not work > > Any ideas? > Instead try: perl -n -e "print $1 if /(.*)<\/PNRef>s" result_sale.tmp > jiri.txt [EMAIL PROTECTED] All opinions are my own and not necessarily those of my employer ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs