Re: Date and Time
Do you want$date = "@months[$mon]/$mday/$year"; or $date = "$months[$mon]/$mday/$year"; Rgds, Connie - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, July 10, 2002 10:57 AM Subject: Date and Time > > Hi > > I'm trying to get my script to recognize the date and time. > I thought I had it but I keep getting errors all over. > > Please take a look and tell me whats wrong > > Thanks > > # Here we define the variables > > use strict; > > my $htpasswd = 'c:\apache\htdocs\members\.htpasswd'; > my $database = 'c:\apache\members.db'; > > print "Content-type: text/html\n\n"; > > print 'Please write this down as it will not be emaild ', "\n"; > print 'for your own security ', "\n"; > > # Here is the random gereration string. > > my ($username, $password) = (random_string(), random_string()); > print "Username: $username\n"; > print "Password: $password\n"; > > sub random_string { > > my($string) = ''; > my($length) = 8; > my(@chars) = ('A' .. 'Z', 'a' .. 'z', 0 .. 9); > while (length($string) != $length) { > $string .= $chars[ rand @chars ]; > } > return($string); > } > > > # everything ok, let's write to database. > > open (DATABASE, ">>$database"); > flock (DATABASE, 2); > print DATABASE "$username|$password|$date\n"; > flock (DATABASE, 8); > close (DATABASE); > > # everything ok, now we write to the password file. > > my $uselog = 1; > > if ($uselog eq '1') { >open (LOG, ">>$htpasswd"); >print LOG "$username:$password:$date\n"; >close (LOG); > } > > sub get_date { > ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = > localtime(time); > @months = > ("01","02","03","04","05","06","07","08","09","10","11","12"); > @digits = split(//,$sec); > $size = @digits; > if ($size == 1) { > $sec = "0$sec"; > } > @digits = split(//,$min); > $size = @digits; > if ($size == 1) { > $min = "0$min"; > } > $year=$year+1900; > $date = "@months[$mon]/$mday/$year"; > } > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: help dereferencing arrayref so I can put the value into a hash
Funny. This simple test works for me: use strict; use warnings; my $t = &fun; print @$t[0]; # prints a sub fun { my @arr = qw(a b c d e); return \@arr; } hth Toby -Original Message- From: Zachary Buckholz [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 10, 2002 4:31 PM To: [EMAIL PROTECTED] Subject: help dereferencing arrayref so I can put the value into a hash I understand how to use a foreach on a reference to an array as follows: my $avg_resp_time = get_avg_resp_time($durations, $url_id); foreach my $avg_resp(@$avg_resp_time) { print "AVG = $avg_resp\n"; } But how do I directly access one array value from the reference to the array? print "DEBUG TEST @$avg_resp_time[0]\n";Fails print "DEBUG TEST @$avg_resp_time->[0]\n";Fails print "DEBUG TEST @{$avg_resp_time[0]}\n";Fails I have bookmarked ch04_07.htm of the Perl CD "Data Structure Code Examples" but I just don't understand it. I am trying to setup a hash for use in HTML::Template as follows my $email_vars = { chk_freq => $chk_freq, url_timeout => $url_timeout, url => $url, url_protocol => $url_protocol, mc_email => $mc_email, full_detail => $full_detail, avg_resp_time=> [ qw(@$avg_resp_time[0] @$avg_resp_time[1] @$avg_resp_time[2] @$avg_resp_time[3] @$avg_resp_time[4] @$avg_resp_time[5] @$avg_resp_time[6]) ], sum_errors => $sum_errors, pct_up_time => $pct_up_time, } Thanks zack -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Date and Time
are you trying to get the localtime in readable format? if so try this print scalar(localtime); Tor. [EMAIL PROTECTED] wrote: > > Hi > > I'm trying to get my script to recognize the date and time. > I thought I had it but I keep getting errors all over. > > Please take a look and tell me whats wrong > > Thanks > > # Here we define the variables > > use strict; > > my $htpasswd = 'c:\apache\htdocs\members\.htpasswd'; > my $database = 'c:\apache\members.db'; > > print "Content-type: text/html\n\n"; > > print 'Please write this down as it will not be emaild ', "\n"; > print 'for your own security ', "\n"; > > # Here is the random gereration string. > > my ($username, $password) = (random_string(), random_string()); > print "Username: $username\n"; > print "Password: $password\n"; > > sub random_string { > > my($string) = ''; > my($length) = 8; > my(@chars) = ('A' .. 'Z', 'a' .. 'z', 0 .. 9); > while (length($string) != $length) { > $string .= $chars[ rand @chars ]; > } > return($string); > } > > # everything ok, let's write to database. > > open (DATABASE, ">>$database"); > flock (DATABASE, 2); > print DATABASE "$username|$password|$date\n"; > flock (DATABASE, 8); > close (DATABASE); > > # everything ok, now we write to the password file. > > my $uselog = 1; > > if ($uselog eq '1') { >open (LOG, ">>$htpasswd"); >print LOG "$username:$password:$date\n"; >close (LOG); > } > > sub get_date { > ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = > localtime(time); > @months = > ("01","02","03","04","05","06","07","08","09","10","11","12"); > @digits = split(//,$sec); > $size = @digits; > if ($size == 1) { > $sec = "0$sec"; > } > @digits = split(//,$min); > $size = @digits; > if ($size == 1) { > $min = "0$min"; > } > $year=$year+1900; > $date = "@months[$mon]/$mday/$year"; > } > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
help dereferencing arrayref so I can put the value into a hash
I understand how to use a foreach on a reference to an array as follows: my $avg_resp_time = get_avg_resp_time($durations, $url_id); foreach my $avg_resp(@$avg_resp_time) { print "AVG = $avg_resp\n"; } But how do I directly access one array value from the reference to the array? print "DEBUG TEST @$avg_resp_time[0]\n";Fails print "DEBUG TEST @$avg_resp_time->[0]\n";Fails print "DEBUG TEST @{$avg_resp_time[0]}\n";Fails I have bookmarked ch04_07.htm of the Perl CD "Data Structure Code Examples" but I just don't understand it. I am trying to setup a hash for use in HTML::Template as follows my $email_vars = { chk_freq => $chk_freq, url_timeout => $url_timeout, url => $url, url_protocol => $url_protocol, mc_email => $mc_email, full_detail => $full_detail, avg_resp_time=> [ qw(@$avg_resp_time[0] @$avg_resp_time[1] @$avg_resp_time[2] @$avg_resp_time[3] @$avg_resp_time[4] @$avg_resp_time[5] @$avg_resp_time[6]) ], sum_errors => $sum_errors, pct_up_time => $pct_up_time, } Thanks zack -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Read and write staroffice spreadsheet.
Hi, I am working on Sun Unix system. I want to use Perl to do the following tasks: 1) Automatically detect the new spreadsheet files (from staroffice, could be in .csv format) in a specified directory. 2) Locate a specified column in the spreadsheet. 3) Extract the column, clean it, and save them into a speficifed file. Do you know any free source code, in perl, that could be used to fulfil part of these tasks? Thanks a lot, Chen
Date and Time
Hi I'm trying to get my script to recognize the date and time. I thought I had it but I keep getting errors all over. Please take a look and tell me whats wrong Thanks # Here we define the variables use strict; my $htpasswd = 'c:\apache\htdocs\members\.htpasswd'; my $database = 'c:\apache\members.db'; print "Content-type: text/html\n\n"; print 'Please write this down as it will not be emaild ', "\n"; print 'for your own security ', "\n"; # Here is the random gereration string. my ($username, $password) = (random_string(), random_string()); print "Username: $username\n"; print "Password: $password\n"; sub random_string { my($string) = ''; my($length) = 8; my(@chars) = ('A' .. 'Z', 'a' .. 'z', 0 .. 9); while (length($string) != $length) { $string .= $chars[ rand @chars ]; } return($string); } # everything ok, let's write to database. open (DATABASE, ">>$database"); flock (DATABASE, 2); print DATABASE "$username|$password|$date\n"; flock (DATABASE, 8); close (DATABASE); # everything ok, now we write to the password file. my $uselog = 1; if ($uselog eq '1') { open (LOG, ">>$htpasswd"); print LOG "$username:$password:$date\n"; close (LOG); } sub get_date { ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); @months = ("01","02","03","04","05","06","07","08","09","10","11","12"); @digits = split(//,$sec); $size = @digits; if ($size == 1) { $sec = "0$sec"; } @digits = split(//,$min); $size = @digits; if ($size == 1) { $min = "0$min"; } $year=$year+1900; $date = "@months[$mon]/$mday/$year"; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Date and Time
Hi I'm trying to get my script to recognize the date and time. I thought I had it but I keep getting errors all over. Please take a look and tell me whats wrong Thanks # Here we define the variables use strict; my $htpasswd = 'c:\apache\htdocs\members\.htpasswd'; my $database = 'c:\apache\members.db'; print "Content-type: text/html\n\n"; print 'Please write this down as it will not be emaild ', "\n"; print 'for your own security ', "\n"; # Here is the random gereration string. my ($username, $password) = (random_string(), random_string()); print "Username: $username\n"; print "Password: $password\n"; sub random_string { my($string) = ''; my($length) = 8; my(@chars) = ('A' .. 'Z', 'a' .. 'z', 0 .. 9); while (length($string) != $length) { $string .= $chars[ rand @chars ]; } return($string); } # everything ok, let's write to database. open (DATABASE, ">>$database"); flock (DATABASE, 2); print DATABASE "$username|$password|$date\n"; flock (DATABASE, 8); close (DATABASE); # everything ok, now we write to the password file. my $uselog = 1; if ($uselog eq '1') { open (LOG, ">>$htpasswd"); print LOG "$username:$password:$date\n"; close (LOG); } sub get_date { ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); @months = ("01","02","03","04","05","06","07","08","09","10","11","12"); @digits = split(//,$sec); $size = @digits; if ($size == 1) { $sec = "0$sec"; } @digits = split(//,$min); $size = @digits; if ($size == 1) { $min = "0$min"; } $year=$year+1900; $date = "@months[$mon]/$mday/$year"; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: executables
Hi, Thanks for the mail. On Sunday 07 July 2002 11:04 pm, Jenda Krynicky wrote: > There is PerlApp and Perl2Exe. > > PerlApp is part of the ActiveState Perl Development Kit - > http://www.activestate.com/Products/Perl_Dev_Kit/ What is PerlApp > Perl2Exe is sold by IndigoStar - http://www.indigostar.com/ Is it a free version? Is there any other free software available? ALso a bit OT but can anyone tell if there exist a software which will convert shell scripts to executables? Thanks a lot and bye. -Payal -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to make the PC Speaker ring a beep sound?
Thanks alot Victor, but... doesn't chr(7) is actually "\a" ? =) Rgds, Connie - Original Message - From: <[EMAIL PROTECTED]> To: "Connie Chan" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, July 10, 2002 11:54 AM Subject: Re: How to make the PC Speaker ring a beep sound? > print chr(7); > > > Tor. > > Connie Chan wrote: > > > > Hi all, > > > > I am trying to write a script for sound alarm function. > > > > I've tried use print "\a", but that goes too strange... > > the sound output goes out by my sound card. So > > would you tell if that's the normal result of print "\a" ? > > > > Actually, I hope the sound output is by my PC speaker. > > and I would like to use the BEEP sound instead. Is that > > possible ? Besides, can I control the alarm length and > > the alarm tone ? > > > > Thanks for any comment, > > Connie > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to make the PC Speaker ring a beep sound?
print chr(7); Tor. Connie Chan wrote: > > Hi all, > > I am trying to write a script for sound alarm function. > > I've tried use print "\a", but that goes too strange... > the sound output goes out by my sound card. So > would you tell if that's the normal result of print "\a" ? > > Actually, I hope the sound output is by my PC speaker. > and I would like to use the BEEP sound instead. Is that > possible ? Besides, can I control the alarm length and > the alarm tone ? > > Thanks for any comment, > Connie -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to make the PC Speaker ring a beep sound?
Hi all, I am trying to write a script for sound alarm function. I've tried use print "\a", but that goes too strange... the sound output goes out by my sound card. So would you tell if that's the normal result of print "\a" ? Actually, I hope the sound output is by my PC speaker. and I would like to use the BEEP sound instead. Is that possible ? Besides, can I control the alarm length and the alarm tone ? Thanks for any comment, Connie
Problem adding to @INC
Hi, I'm very new to perl, although I've used many other languages for CGI/DB programming. I think this must be a simple problem, but I've tried all my reference books without any luck. I've been using some modules I wrote (not using h2x yet) on my test server/work computer without any problem. I've always left the modules in the same directory as the .pl file, and perl would find it without any errors. I test on a Win XP Home Ed running ActivePerl 5.6, and Apache. I then tried to send it to a production server, same files, running Win NT, IIS, and ActivePerl. The only scripts that fail are the ones that try to use modules in the same directory. I get the error: __START__ Can't locate TemplateHandler.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at c:\websites\blessinganimal\cgi-bin\makechanges\edit.plx line 15. BEGIN failed--compilation aborted at c:\websites\blessinganimal\cgi-bin\makechanges\edit.plx line 15. __END__ (NOTE, I write my files as *.pl extensions, but to get CGI error messages (as opposed to no output), I have to save a copy with an 'plx' for some reason...that I really should know) The code I'm running looks like (please excuse the mess): __START__ use warnings; use strict; print "Content-Type: text/plain\n\n"; #to simplify CGI output $main::INC[$#main::INC] = "C:/websites/blessinganimal/cgi-bin/makechanges"; # compiles at least... use TemplateHandler;#this causes all the trouble print "inc is @INC"; #prints a string with all items #seperated with a space, including "C:/websites/blessinganimal..." foreach my $item (@main::INC) { print "'$item'\n"; #prints it all } print "Hello World"; __END__ If I leave 'use TemplateHandler;' commented out, it runs. If I don't it generates the error. The output that results if I comment out the 'use TemplateHandler;' line is: inc is C:/Perl/lib C:/Perl/site/lib C:/websites/blessinganimal/cgi-bin/makechanges'C:/Perl/lib' 'C:/Perl/site/lib' 'C:/websites/blessinganimal/cgi-bin/makechanges' Hello World This is running on a server farm that doesn't give the the capacity to tweak anything outside of the user directory. Can anyone point me in the right direction? Adding to the @INC array doesn't seem to effect anything, and I don't know what else to try. Thanks! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: seek function call
> http://search.cpan.org/search?dist=File-ReadBackwards Oh, well, if you're going to go looking for CPAN modules, take a look at Mark-Jason Dominus' stellar Tie::File. xoxo, Andy -- 'Andy Lester[EMAIL PROTECTED] Programmer/author petdance.com Daddy parsley.org/quinn Jk'=~/.+/s;print((split//,$&) [unpack'C*',"n2]3%+>\"34.'%&.'^%4+!o.'"]) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: seek function call
William Black wrote: > > Hi all, Hello, > I have a quick question about seek(). If I have a file with 100 lines of > data and I want to seek to the last line of the file and read it. How is > this done? Below is what I'm trying to do. A little help please. use File::ReadBackwards; my $bw = File::ReadBackwards->new( 'x.pl' ) or die "Cannot read 'x.pl': $!"; my $last_line = $bw->readline; http://search.cpan.org/search?dist=File-ReadBackwards John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: getting a child process's pid
"Daryl J. Hoyt" wrote: > > Hi, Hello, > I have a problem I can not seem to figure out. I need run an executable > from a Perl script and I want it to return the PID for the executable. I > looked at the docs for fork(), but if I did something like: > if($PID = fork) > { > system("foo.exe"); > } > I think it would return the PID for the fork in the if statement and not the > one from the system call. Is there any way to get the PID from the child? > Any help would be greatly appreciated. The problem is that system() forks as well. Use exec() and the PID returned from fork() will be the PID that "foo.exe" is running as. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Avoiding Duplicate Entries
Joshua Scott wrote: > > I'm very new to Perl programming so please bear with me. I'm working on a > program that will open up a certain logfile, read the contents, upload > certain content to a database and update the status to the same database. > > The goal is to run this program once a week. Currently the program just > uploads all matching selections from the file every time it is run. My > query to this group is what is the best way to code this such that I only > get the data that has changed from the last time the logfile was read. > > I realize that this may be a generic request, but I just want to get some > ideas for this before I dive in and try to do it myself. One way would be to cache the last line read and the next time you read the file loop until that line is encountered and only process the lines after it. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FW: seek function call
Sorry my bad, this doesn't work with lines as Andy Lester pointed out. When i tested it i had a file with one char on each line. My apologies :( Toby -Original Message- From: Toby Stuart [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 10, 2002 11:04 AM To: '[EMAIL PROTECTED]' Cc: '[EMAIL PROTECTED]' Subject: RE: seek function call change: seek(LOG,0,2); to: seek(LOG,-1,2); hth toby -Original Message- From: William Black [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 10, 2002 10:42 AM To: [EMAIL PROTECTED] Subject: RE: seek function call Hi all, I have a quick question about seek(). If I have a file with 100 lines of data and I want to seek to the last line of the file and read it. How is this done? Below is what I'm trying to do. A little help please. File x.pl: a b c d e open(LOG,"x.pl"); seek(LOG,0,2); # I thought 2 meant the end of the file. $line=; print"$line": close(LOG); William Black _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: seek function
> I have a file that has roughly 100 lines. I want to use the seek function > to seek to the end of the file and read the last line into a var and pring > it out. Can someone help? That's not what the seek function does. The seek function finds a specific byte position in a file, and you're working on a line-by-line basis. If you want the last line, you have to read thru the file and hold on to the last line: open( IN, $filename ) or die "Couldn't open $filename: $!"; my $last; while ( ) { $last = $_; } print "Last line is:\n$last\"; Also, if you're using unix, you can simply say tail -1 filename xoxo, Andy -- 'Andy Lester[EMAIL PROTECTED] Programmer/author petdance.com Daddy parsley.org/quinn Jk'=~/.+/s;print((split//,$&) [unpack'C*',"n2]3%+>\"34.'%&.'^%4+!o.'"]) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: seek function call
change: seek(LOG,0,2); to: seek(LOG,-1,2); hth toby -Original Message- From: William Black [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 10, 2002 10:42 AM To: [EMAIL PROTECTED] Subject: RE: seek function call Hi all, I have a quick question about seek(). If I have a file with 100 lines of data and I want to seek to the last line of the file and read it. How is this done? Below is what I'm trying to do. A little help please. File x.pl: a b c d e open(LOG,"x.pl"); seek(LOG,0,2); # I thought 2 meant the end of the file. $line=; print"$line": close(LOG); William Black _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
re: seek function
Hi all, Quick question. I have a file that has roughly 100 lines. I want to use the seek function to seek to the end of the file and read the last line into a var and pring it out. Can someone help? Thanks, William Black _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: seek function call
Hi all, I have a quick question about seek(). If I have a file with 100 lines of data and I want to seek to the last line of the file and read it. How is this done? Below is what I'm trying to do. A little help please. File x.pl: a b c d e open(LOG,"x.pl"); seek(LOG,0,2); # I thought 2 meant the end of the file. $line=; print"$line": close(LOG); William Black _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
getting a child process's pid
Hi, I have a problem I can not seem to figure out. I need run an executable from a Perl script and I want it to return the PID for the executable. I looked at the docs for fork(), but if I did something like: if($PID = fork) { system("foo.exe"); } I think it would return the PID for the fork in the if statement and not the one from the system call. Is there any way to get the PID from the child? Any help would be greatly appreciated. Thanks, Daryl
Avoiding Duplicate Entries
I'm very new to Perl programming so please bear with me. I'm working on a program that will open up a certain logfile, read the contents, upload certain content to a database and update the status to the same database. The goal is to run this program once a week. Currently the program just uploads all matching selections from the file every time it is run. My query to this group is what is the best way to code this such that I only get the data that has changed from the last time the logfile was read. I realize that this may be a generic request, but I just want to get some ideas for this before I dive in and try to do it myself. I appreciate any assistance provided. Joshua Scott Security Systems Analyst, CISSP 626-568-7024 ==NOTICE - This communication may contain confidential and privileged information that is for the sole use of the intended recipient. Any viewing, copying or distribution of, or reliance on this message by unintended recipients is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. ==
Win32::AdminMisc Help!
I've got a script that uses Win32::AdminMisc from www.roth.net and when I originally installed the module on Win2K/ActiveState with ppm it worked fine. I need to reinstall the module and www.roth.net appears to be down. When I use ppm to perform the install the install fails with this error: Error installing package 'win32-adminmisc.ppd': Error reading http://www.roth.net/perl/packages/x86/ Win32/AdminMisc_5006.tar.gz. I can't get www.roth.net to reply to a ping...its like it is completely gone! So I went to CPAN and found the module here: http://search.cpan.org/search?dist=Win32_AdminMisc but I don't understand how to install it without ppm. Where should I put the files? I've tried putting the unzipped files all over perl/lib and perl/site/lib but I keep getting an error that it can't locate a loadable object for Win32::AdminMisc (which is progress, it used to say that it couldn't find the module). It looks like it sees the module but part of it is missing. Does anyone have a ppm version of this module that installs with www.roth.net or can offer advice about how to install the CPAN version? I'm running ActiveState Perl (newest version) on Win2K installed to c:\perl and the only modification from default install I've made is to use ppm to install win32::ole Thanks ~Mike -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Docs on how to use the Win32:ChangeNotify module
From: Felix Geerinckx <[EMAIL PROTECTED]> > on Tue, 09 Jul 2002 20:26:12 GMT, Jenda Krynicky wrote: > > > You mean that you get notified of a change, start processing it and > > before you have the chance to start waiting again another change > > occures but you do not notice it at all? Well I don't really know. > > I did some additional research in Dave Roth's Win32 Perl Programming > book. Unfortunately, my first edition still discusses the now > deprecated FindFirst and FindNext methods, but it seems changes are > queued, as can be illustrated by the following small program: Agr. Seems you are right. Why don't they write it in the docs??? So I guess most usualy the two threads are unnecessary :-( Thanks, Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Docs on how to use the Win32:ChangeNotify module
on Tue, 09 Jul 2002 20:26:12 GMT, Jenda Krynicky wrote: > You mean that you get notified of a change, start processing it and > before you have the chance to start waiting again another change > occures but you do not notice it at all? Well I don't really know. I did some additional research in Dave Roth's Win32 Perl Programming book. Unfortunately, my first edition still discusses the now deprecated FindFirst and FindNext methods, but it seems changes are queued, as can be illustrated by the following small program: #! perl -w use strict; use Win32::ChangeNotify; my $notify = Win32::ChangeNotify->new('d:/',0,"FILE_NAME"); open FILE, '>d:/foo'; close FILE; while ($notify->wait == 1) { $notify->reset; print STDERR "Change occurred\n"; # Do processing here ... } die "Should never arrive here!\n"; The monitoring process starts (restarts) after the call to new (reset), and (according to Roth) up to one change event is queued (which makes sense, because you will have the check the entire directory for changes anyway). When I run this program, it immediately prints "Change occurred\n", and after the call to the reset method, it starts monitoring again, queueing when necessary. So no race conditions, which is nice :-) -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Docs on how to use the Win32:ChangeNotify module
From: Felix Geerinckx <[EMAIL PROTECTED]> > on Tue, 09 Jul 2002 16:01:12 GMT, Jenda Krynicky wrote: > > > So, your process gets notified if something happens in the > > directory, it has to find out what was it by itself. > > I wonder how one could avoid race conditions when using ChangeNotify. You mean that you get notified of a change, start processing it and before you have the chance to start waiting again another change occures but you do not notice it at all? Well I don't really know. I am using Win32::ChangeNotify a bit lately and I always use two threads. One ("watcher") only waits for the changes, prints a change message to the pipe and goes waiting again (so the chance that something happens while it's busy is slim) and the other thread ("worker") reads the messages and other commands from the pipe and processes them. Actually if the worker thread starts scaning the directory for change after a tiny timeout (that is AFTER the watcher started waiting again) it will see even the change that was overlooked by watcher. Or did you mean some other race condition? Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
I need advise Redhat7.1/MYSQL/PERL updates DB on Lotus Notes on NT box
I need advise Redhat7.1/MYSQL/PERL updates DB on Lotus Notes on NT box, is this project hopeless ? Any Ideas where to start?
Re: Docs on how to use the Win32:ChangeNotify module
on Tue, 09 Jul 2002 16:01:12 GMT, Jenda Krynicky wrote: > So, your process gets notified if something happens in the directory, > it has to find out what was it by itself. I wonder how one could avoid race conditions when using ChangeNotify. -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Variables and databases
Janek Schleicher wrote at Tue, 09 Jul 2002 18:48:00 +0200: > rand($#chars) gives a random > number in the range of 0 .. $#chars-1 Sorry not completely correct, rand($#chars) gives a random number < $#chars, what is in chars[ rand($#chars) ] implicitly rounded down. However, the last element of the array will never be choosen. Cheerio, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Variables and databases
jffusion wrote at Tue, 09 Jul 2002 17:33:35 +0200: > Hi > > I have my script to generate a random username and password and print it in the >browser window > > print 'Username: ', random_string(), "\n"; > print 'Password: ', random_string(), "\n"; > > sub random_string { > > my($string) = ''; > my($length) = 8; > my(@chars) = ('A' .. 'Z', 'a' .. 'z', 0 .. 9); > while (length($string) != $length) { > $string .= $chars[ rand($#chars) ]; > } > return($string); > } > } I would be really too lazy to write my own random routine. Just have a look to String::Random from CPAN. However it seems that there's a bug in your random_routine, too. rand($#chars) gives a random number in the range of 0 .. $#chars-1 what will mean, there's never a 9 in your random string. You surely meant $string .= $chars[ rand @chars ]; Greetings, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: changing %ENV in parent
At 08:37 AM 7/9/02 -0500, David T-G wrote: >Peter, et al -- > >...and then Peter Scott said... >% >% At 09:33 AM 7/6/02 -0500, David T-G wrote: >% >I want to add to $ENV{'PATH'} in the parent process from my script. >% >Generally I know this isn't allowed, but I wonder if there's a way to do >% >it. >% >% No. It's a Unix FAQ and Perl can't do it any more than any other >% language. See 2.8 in http://www.faqs.org/faqs/unix-faq/faq/part2/ > >Yeah. I was hoping for a way to > > . myscript.pl bash > source myscript.pl tcsh > >or maybe > > `myscript.pl bash` > `myscript.pl tcsh` > >for that would make it work, but I haven't found anything yet. sh-2.05a$ echo $PATH /usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/peter/bin:. sh-2.05a$ cat stage1 PATH=`stage2` export PATH sh-2.05a$ cat stage2 #!/usr/bin/perl -l print join ":" => qw(/sbin /usr/local/bin /etc); sh-2.05a$ . stage1 sh-2.05a$ echo $PATH /sbin:/usr/local/bin:/etc -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Daemonize a process in Windows
I've used the daemonize subroutine described in the PERL manpages on Unix to completely disassociate a child process from a parent. Will this process work under a Windows environment? If not, what is the best way to do this? Thank you, Joshua Scott Security Systems Analyst, CISSP 626-568-7024 ==NOTICE - This communication may contain confidential and privileged information that is for the sole use of the intended recipient. Any viewing, copying or distribution of, or reliance on this message by unintended recipients is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. ==
Re: Docs on how to use the Win32:ChangeNotify module
> I'm trying to put together a little perl script. I'm new to perl, but > was shown the Win32:ChangeNotify module as something I could use to > watch a directory for new files to act upon. > > The documentation I have so far on Win32:ChangeNotify is > http://search.cpan.org/doc/GSAR/libwin32-0.18/ChangeNotify/ChangeNotif > y.pm . This page has given me _some_ info, but not enough for me. > Where can I find more info? I've looked at the learn.perl.org, > www.perldoc.com, www.perlarchives.com . I can't really find anything > of any use!! > > My immediate question is: once I've done a "$notify->wait" line, what > happens next? > > Do I assume that "$notify->wait" waits for a value to be returned by > "$notify = Win32::ChangeNotify->new($path,$watchsubtree,$events);" and > that the value will indicate what has changed (ie the file name of a > new file)? No it'll not return the name of the file that was changed/added. The underlying API functions do not support that. The return values will be +1The object is signalled -1The object is an abandoned mutex 0Timed out undef An error occurred See perldoc Win32::IPC So, your process gets notified if something happens in the directory, it has to find out what was it by itself. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Variables and databases
From: [EMAIL PROTECTED] > Now I need to define the username and password generated so that they > are written to the htaccess, htpasswd, and members.db file > > here is the script > > # everything ok, let's write to database and send welcome email > open (DATABASE, ">>$database"); > flock (DATABASE, 2); > print DATABASE "$username|$password\n"; > flock (DATABASE, 8); > close (DATABASE); 1) Do not use the numbers, use named constants instead. What if the numbers are different on a different system? use Fcntl qw(:flock); flock (DATABASE, LOCK_EX); 2) Do NOT unlock the file. Simply close the filehandle and it'll be unlocked for you PROPERLY. If you do it like you did you could screw up the file. Keep in mind that the data you printed do not have to be writtent to the file already. They may still be in cache! Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Variables and databases
On Jul 9, [EMAIL PROTECTED] said: >print 'Username: ', random_string(), "\n"; >print 'Password: ', random_string(), "\n"; > [snip] > ># everything ok, let's write to database and send welcome email >open (DATABASE, ">>$database"); >flock (DATABASE, 2); >print DATABASE "$username|$password\n"; >flock (DATABASE, 8); >close (DATABASE); You didn't store the values in $username and $password. You just printed them. my ($username, $password) = (random_string(), random_string()); print "Username: $username\n"; print "Password: $password\n"; # then open the database and print to it like you did above -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** what does y/// stand for? why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Variables and databases
Hi I have my script to generate a random username and password and print it in the browser window Now I need to define the username and password generated so that they are written to the htaccess, htpasswd, and members.db file here is the script # Here we define the variables $htpasswd = 'c:\apache\htdocs\members/.htpasswd'; $database = 'c:\apache\members.db'; # Here is the random gereration string use strict; print 'Please write this down as it will not be emaild ', "\n"; print 'for your own security ', "\n"; print 'Username: ', random_string(), "\n"; print 'Password: ', random_string(), "\n"; sub random_string { my($string) = ''; my($length) = 8; my(@chars) = ('A' .. 'Z', 'a' .. 'z', 0 .. 9); while (length($string) != $length) { $string .= $chars[ rand($#chars) ]; } return($string); } # everything ok, let's write to database and send welcome email open (DATABASE, ">>$database"); flock (DATABASE, 2); print DATABASE "$username|$password\n"; flock (DATABASE, 8); close (DATABASE); $uselog = 1; # Encrypts Password For Use With .htaccess Files. if ($uselog eq '1') { open (LOG, ">>$htpasswd"); print LOG "$username:$password\n"; close (LOG); I'm just not sure how to make it so that after the random generation they are also written to the specifyd file Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Docs on how to use the Win32:ChangeNotify module
Hi all: I'm trying to put together a little perl script. I'm new to perl, but was shown the Win32:ChangeNotify module as something I could use to watch a directory for new files to act upon. The documentation I have so far on Win32:ChangeNotify is http://search.cpan.org/doc/GSAR/libwin32-0.18/ChangeNotify/ChangeNotify.pm . This page has given me _some_ info, but not enough for me. Where can I find more info? I've looked at the learn.perl.org, www.perldoc.com, www.perlarchives.com . I can't really find anything of any use!! My immediate question is: once I've done a "$notify->wait" line, what happens next? Do I assume that "$notify->wait" waits for a value to be returned by "$notify = Win32::ChangeNotify->new($path,$watchsubtree,$events);" and that the value will indicate what has changed (ie the file name of a new file)? If this assumption is correct, then the documentation I've seen so far is very in-adequate. In any event, where can I find better documentation? I have the hardcopy perl books: Programming Perl by O'Reilly, Beginning Perl by Simon Cozens. I've just ordered "Perl Cookbook". Regs Rupert Heesom Asst Distribution Engineer Adventist World Radio -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Regex exception
I do it this way (working in production code): opendir(DIR, "$dir"); while (defined ($filename = readdir DIR)) { next if $filename =~ $pattern; unlink($filename); } } close(DIR); --- Jason H. Frisvold Senior ATM Engineer Engineering Dept. Penteledata CCNA Certified - CSCO10151622 [EMAIL PROTECTED] --- "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world." -- Albert Einstein [1879-1955] -Original Message- From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 09, 2002 10:20 AM To: Jaime Hourihane Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: Regex exception On Jul 9, Jaime Hourihane said: >opendir(DIR, $dir) || die .. >while() { You can't use <> on dirhandles. >unless ~= $pattern { > unlink or remove here >} And at least try to post well-formed pseudocode. >} -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** what does y/// stand for? why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Regex exception
On Jul 9, Jaime Hourihane said: >opendir(DIR, $dir) || die .. >while() { You can't use <> on dirhandles. >unless ~= $pattern { > unlink or remove here >} And at least try to post well-formed pseudocode. >} -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** what does y/// stand for? why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Regex exception
or what about unless... opendir(DIR, $dir) || die .. while() { unless ~= $pattern { unlink or remove here } } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Regex exception
because you aren't in the dir... you would need chdir($dir) or die "can't chdir to $dir: $!\n"; before all that to work. and that should be unlink or die "$_: $!"; > -Original Message- > From: Jaime Hourihane [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 09, 2002 9:58 AM > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: Regex exception > > > or what about unless... > > opendir(DIR, $dir) || die .. > while() { > unless ~= $pattern { >unlink or remove here > } > > } > The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: mod_perl and inheritance
> -Original Message- > From: PURMONEN, Joni [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 09, 2002 9:55 AM > To: '[EMAIL PROTECTED]' > Subject: RE: mod_perl and inheritance > > > > Need to see the script and the error messages. Is > Apache::Registry the > handler? > > Yes it is. > > The error messages just complain about not being able to > locate a given > method, which should be inherited (and is inherited if I move > the script to > CGI area). > > the script runs to couple thousand lines, so I rather not > mail it around. > All obvious typos etc. mistakes have been eliminated though, > I promise :) Can you construct a short sample script that exhibits the problem? And post the exact error messages that it generates? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sorting files by date (contained in file)
Shannon Murdoch wrote: > > Hi all, Hello, > I have a list of 40 or so files that need to be sorted into an array by > article date (found in first line of each file in the form DD-MM-). > I can't figure out how to go about it successfully... Can anyone help me out > please?? > > Thanks in advance! > > Current method is as follows: use warnings; use strict; > use Time::Local; > > @list = glob("*.txt"); ## makes an array of files ending in .txt eg 03.txt > > foreach $file (@list) { ##find dates... > open(FEEDBACK,"$file"); You should _always_ check the return value from open. open FEEDBACK, $file or die "Cannot open $file: $!"; > while(){ If you only need the first line there is no reason to use a while loop. > chomp($_); > @feedbackdate = split(/-/,$_); ## eg @feedbackdate = ('07','02','1982') > $epochseconds = timelocal(1, 1, 1, $feedbackdate[0], $feedbackdate[1]-1, > $feedbackdate[2]-1900); > @feedbackdate = (); ##empty the hash for next loop. > $filelisthash{$file} = $epochseconds; > last; > } > close(FEEDBACK); > } #end loop > > @list = (); ##prepare the list array > > foreach $file_num (sort { $a cmp $b } keys %filelisthash) { > push(@list,$file_num); > } > > print @list; #!/usr/bin/perl use warnings; use strict; use Time::Local; my @filelist; for my $file ( glob '*.txt' ) { open FEEDBACK, $file or die "Cannot open $file: $!"; my $line = ; close FEEDBACK; my ( $day, $mon, $year ) = $line =~ /(\d+)/g; my $seconds = timelocal( 0, 0, 0, $day, $mon - 1, $year - 1900 ) push @filelist, [ $seconds, $file ]; } for my $file ( sort { $a->[0] <=> $b->[0] } @filelist ) { print "$file->[1]\n"; } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: mod_perl and inheritance
> Need to see the script and the error messages. Is Apache::Registry the handler? Yes it is. The error messages just complain about not being able to locate a given method, which should be inherited (and is inherited if I move the script to CGI area). the script runs to couple thousand lines, so I rather not mail it around. All obvious typos etc. mistakes have been eliminated though, I promise :) Cheers, Joni -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: mod_perl and inheritance
> -Original Message- > From: PURMONEN, Joni [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 09, 2002 9:21 AM > To: '[EMAIL PROTECTED]' > Subject: mod_perl and inheritance > > > Hello all, > > I just moved my perfectly functioning script from normal CGI area to > mod_perl area and the whole thing stopped working. > > This is the first time when I am using multiple classes and > inheritance in > mod_perl and it seems like the inheritance is the culprit. I > tried to search > the web for answers, but no luck there yet. > > The inheritance works fine as normal CGI, but when tested in > mod_perl it > complains that it can't locate the methods which should be inherited. > > Is there anything obvious I might be doing wrong? Is there > anything special > I should take into account when using inheritance in mod_perl? Need to see the script and the error messages. Is Apache::Registry the handler? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Regex exception
why not use foreach() glob() and unlink() instead so it's all done in perl? foreach $file (glob("e:/dir/*.ldb")){ next if $file =~ /exception pattern here/; unlink($file) or die "Cannot unlink $file: $!\n"; } > -Original Message- > From: Ned Cunningham [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 09, 2002 9:35 AM > To: '[EMAIL PROTECTED]' > Subject: Regex exception > > > HI all. > > A simple question. > > I need to use a system command to delete all files in a > directory except > one. > > Foobar.ldb > Barfoo.ldb > Raboof.ldb > Keep.ldb > > I want to delete all except the keep.ldb and there could be > various other > files. > > I am trying to use this command > > Any help??? > > System("erase /f e:\\dir\\*.ldb"); > > Or > (`erase /f "e:\\dir\\*.ldb"`) > > How do I substitute for the * > > $file =~ (/keep/I); > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: changing %ENV in parent
Peter, et al -- ...and then Peter Scott said... % % At 09:33 AM 7/6/02 -0500, David T-G wrote: % >I want to add to $ENV{'PATH'} in the parent process from my script. % >Generally I know this isn't allowed, but I wonder if there's a way to do % >it. % % No. It's a Unix FAQ and Perl can't do it any more than any other % language. See 2.8 in http://www.faqs.org/faqs/unix-faq/faq/part2/ Yeah. I was hoping for a way to . myscript.pl bash source myscript.pl tcsh or maybe `myscript.pl bash` `myscript.pl tcsh` for that would make it work, but I haven't found anything yet. The script spits out PATH=/new/info/in/path:$PATH (in bash mode, anyway) and the like and I've tried loading *that* with all sorts of eval `myscript.pl bash` and the like but I still can't get it to work (whether I spit out a comment or a VAR=value line, bash complains "command not found"). It sounds like I've hit on a curious shell challenge, and I hope I don't have to resort to myscript.pl bash > $HOME/.includeme.bash myscript.pl tcsh > $HOME/.includeme.tcsh and . $HOME/.includeme.bash source $HOME/.includeme.tcsh in my scripts; sure, I'd save on the time to start perl every time I run a script, but I'd have to have a cron job to make sure that the includeme files are kept up to date instead of spitting out the data dynamically. Anyway, this thread careening off-topic and I should let it die :-) % -- % Peter Scott % Pacific Systems Design Technologies % http://www.perldebugged.com/ Thanks & HAND :-D -- David T-G * It's easier to fight for one's principles (play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie (work) [EMAIL PROTECTED] http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg27192/pgp0.pgp Description: PGP signature
AW: how to print out a variable if theres a . in it?
Yea, thats it! So the params i givbe to a subroutine are stored in an array? That´s probably why $_ doesn´t work, right? I need the subroutine for later additions. As I told i wan´t to do "foolish things" to the file later,... :-) It´s just a test like it is... -Ursprüngliche Nachricht- Von: Nikola Janceski [mailto:[EMAIL PROTECTED]] Gesendet: Dienstag, 9. Juli 2002 15:35 An: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]; [EMAIL PROTECTED] Betreff: RE: how to print out a variable if theres a . in it? print "Yeeehaaa: $_[0] \n"; would be more correct than $SNR_LOG, else what's the point of the subroutine? > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 09, 2002 9:32 AM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: RE: how to print out a variable if theres a . in it? > > > change the line > print "Yeeehaaa: $_ \n"; > to > print "Yeeehaaa: $SNR_LOG \n"; > > and it will work fine. > -Original Message- > From: Theuerkorn Johannes [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 09, 2002 8:10 AM > To: '[EMAIL PROTECTED]' > Subject: how to print out a variable if theres a . in it? > > > Hello List, > > I have a (probably) simple problem: > > I´am parsing trough a directory an want to print out every > filename that exists. (later I want to open those files) > Problem is, i have filenames like > snr_log.csv,repact.csv,,foo.csv,bar.csv all with a period in > between... > What I get is an error as follows up... > > Any Suggestions? > > ERROR: > ## > perl -w verzeichnis.pl > Use of uninitialized value in concatenation (.) at > verzeichnis.pl line 15. > Yeeehaaa: > Use of uninitialized value in concatenation (.) at > verzeichnis.pl line 15. > Yeeehaaa: > Use of uninitialized value in concatenation (.) at > verzeichnis.pl line 15. > Yeeehaaa: > Use of uninitialized value in concatenation (.) at > verzeichnis.pl line 15. > Yeeehaaa: > Use of uninitialized value in concatenation (.) at > verzeichnis.pl line 15. > Yeeehaaa: > Use of uninitialized value in concatenation (.) at > verzeichnis.pl line 15. > Yeeehaaa: > Use of uninitialized value in concatenation (.) at > verzeichnis.pl line 15. > Yeeehaaa: > ## > > > this is verzeichnis.pl > # > > #/usr/bin/perl -w > > use strict; > > my $qis_root = "/home/user1/DiREx/test"; > my $SNR_LOG; > chdir($qis_root)|| die "can´t change to $qis_root!"; > > while (defined($SNR_LOG = <*>)){ > #print "$dateien\n"; > parse_logs($SNR_LOG); > } > sub parse_logs{ > > print "Yeeehaaa: $_ \n"; > > } > ## > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Regex exception
HI all. A simple question. I need to use a system command to delete all files in a directory except one. Foobar.ldb Barfoo.ldb Raboof.ldb Keep.ldb I want to delete all except the keep.ldb and there could be various other files. I am trying to use this command Any help??? System("erase /f e:\\dir\\*.ldb"); Or (`erase /f "e:\\dir\\*.ldb"`) How do I substitute for the * $file =~ (/keep/I); -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how to print out a variable if theres a . in it?
print "Yeeehaaa: $_[0] \n"; would be more correct than $SNR_LOG, else what's the point of the subroutine? > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 09, 2002 9:32 AM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: RE: how to print out a variable if theres a . in it? > > > change the line > print "Yeeehaaa: $_ \n"; > to > print "Yeeehaaa: $SNR_LOG \n"; > > and it will work fine. > -Original Message- > From: Theuerkorn Johannes [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 09, 2002 8:10 AM > To: '[EMAIL PROTECTED]' > Subject: how to print out a variable if theres a . in it? > > > Hello List, > > I have a (probably) simple problem: > > I´am parsing trough a directory an want to print out every > filename that exists. (later I want to open those files) > Problem is, i have filenames like > snr_log.csv,repact.csv,,foo.csv,bar.csv all with a period in > between... > What I get is an error as follows up... > > Any Suggestions? > > ERROR: > ## > perl -w verzeichnis.pl > Use of uninitialized value in concatenation (.) at > verzeichnis.pl line 15. > Yeeehaaa: > Use of uninitialized value in concatenation (.) at > verzeichnis.pl line 15. > Yeeehaaa: > Use of uninitialized value in concatenation (.) at > verzeichnis.pl line 15. > Yeeehaaa: > Use of uninitialized value in concatenation (.) at > verzeichnis.pl line 15. > Yeeehaaa: > Use of uninitialized value in concatenation (.) at > verzeichnis.pl line 15. > Yeeehaaa: > Use of uninitialized value in concatenation (.) at > verzeichnis.pl line 15. > Yeeehaaa: > Use of uninitialized value in concatenation (.) at > verzeichnis.pl line 15. > Yeeehaaa: > ## > > > this is verzeichnis.pl > # > > #/usr/bin/perl -w > > use strict; > > my $qis_root = "/home/user1/DiREx/test"; > my $SNR_LOG; > chdir($qis_root)|| die "can´t change to $qis_root!"; > > while (defined($SNR_LOG = <*>)){ > #print "$dateien\n"; > parse_logs($SNR_LOG); > } > sub parse_logs{ > > print "Yeeehaaa: $_ \n"; > > } > ## > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how to print out a variable if theres a . in it?
change the line print "Yeeehaaa: $_ \n"; to print "Yeeehaaa: $SNR_LOG \n"; and it will work fine. -Original Message- From: Theuerkorn Johannes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 09, 2002 8:10 AM To: '[EMAIL PROTECTED]' Subject: how to print out a variable if theres a . in it? Hello List, I have a (probably) simple problem: I´am parsing trough a directory an want to print out every filename that exists. (later I want to open those files) Problem is, i have filenames like snr_log.csv,repact.csv,,foo.csv,bar.csv all with a period in between... What I get is an error as follows up... Any Suggestions? ERROR: ## perl -w verzeichnis.pl Use of uninitialized value in concatenation (.) at verzeichnis.pl line 15. Yeeehaaa: Use of uninitialized value in concatenation (.) at verzeichnis.pl line 15. Yeeehaaa: Use of uninitialized value in concatenation (.) at verzeichnis.pl line 15. Yeeehaaa: Use of uninitialized value in concatenation (.) at verzeichnis.pl line 15. Yeeehaaa: Use of uninitialized value in concatenation (.) at verzeichnis.pl line 15. Yeeehaaa: Use of uninitialized value in concatenation (.) at verzeichnis.pl line 15. Yeeehaaa: Use of uninitialized value in concatenation (.) at verzeichnis.pl line 15. Yeeehaaa: ## this is verzeichnis.pl # #/usr/bin/perl -w use strict; my $qis_root = "/home/user1/DiREx/test"; my $SNR_LOG; chdir($qis_root)|| die "can´t change to $qis_root!"; while (defined($SNR_LOG = <*>)){ #print "$dateien\n"; parse_logs($SNR_LOG); } sub parse_logs{ print "Yeeehaaa: $_ \n"; } ## -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re:how to print out a variable if theres a . in it?
>>this is verzeichnis.pl # #/usr/bin/perl -w use strict; my $qis_root = "/home/user1/DiREx/test"; my $SNR_LOG; chdir($qis_root)|| die "can´t change to $qis_root!"; while (defined($SNR_LOG = <*>)){ #print "$dateien\n"; parse_logs($SNR_LOG); } sub parse_logs{ print "Yeeehaaa: $_ \n"; } ## << I would suggest doing it this way. This opens the dir, read's the files and gets rid of the . and .. which will be includeded in it. Hope that helps.. Joe #/usr/bin/perl -w use strict; my $qis_root = "/home/user1/DiREx/test"; my $SNR_LOG; opendir(IMD, $qis_root) || die("Cannot open directory"); @thefiles= readdir(IMD); closedir(IMD); foreach $f (@thefiles) { unless ( ($f eq ".") || ($f eq "..") ) { print "$f"; } }
mod_perl and inheritance
Hello all, I just moved my perfectly functioning script from normal CGI area to mod_perl area and the whole thing stopped working. This is the first time when I am using multiple classes and inheritance in mod_perl and it seems like the inheritance is the culprit. I tried to search the web for answers, but no luck there yet. The inheritance works fine as normal CGI, but when tested in mod_perl it complains that it can't locate the methods which should be inherited. Is there anything obvious I might be doing wrong? Is there anything special I should take into account when using inheritance in mod_perl? Many thanks, Joni -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to print out a variable if theres a . in it?
Hello List, I have a (probably) simple problem: I´am parsing trough a directory an want to print out every filename that exists. (later I want to open those files) Problem is, i have filenames like snr_log.csv,repact.csv,,foo.csv,bar.csv all with a period in between... What I get is an error as follows up... Any Suggestions? ERROR: ## perl -w verzeichnis.pl Use of uninitialized value in concatenation (.) at verzeichnis.pl line 15. Yeeehaaa: Use of uninitialized value in concatenation (.) at verzeichnis.pl line 15. Yeeehaaa: Use of uninitialized value in concatenation (.) at verzeichnis.pl line 15. Yeeehaaa: Use of uninitialized value in concatenation (.) at verzeichnis.pl line 15. Yeeehaaa: Use of uninitialized value in concatenation (.) at verzeichnis.pl line 15. Yeeehaaa: Use of uninitialized value in concatenation (.) at verzeichnis.pl line 15. Yeeehaaa: Use of uninitialized value in concatenation (.) at verzeichnis.pl line 15. Yeeehaaa: ## this is verzeichnis.pl # #/usr/bin/perl -w use strict; my $qis_root = "/home/user1/DiREx/test"; my $SNR_LOG; chdir($qis_root)|| die "can´t change to $qis_root!"; while (defined($SNR_LOG = <*>)){ #print "$dateien\n"; parse_logs($SNR_LOG); } sub parse_logs{ print "Yeeehaaa: $_ \n"; } ## -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Request
I somehow doubt this rant will automatically manifest itself into the consciousness of all future senders of subject-deficient emails (and "Request" really doesn't seem any more germane than "Probably impossible"). That also begs the question of what becomes acceptable, and to whom; and how to pre-impart that knowledge to all future submitters. It would indeed be nice if everyone could express their requests with focused clarity and succinctness, but ain't gonna happen Of all the things truly worth getting upset about, I politely suggest that this doesn't belong at the top of any list. Joe -Original Message- From: Jenda Krynicky [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 09, 2002 7:18 AM To: [EMAIL PROTECTED] Subject: Request Do use meaningfull subjects !!! Do use meaningfull subjects !!! Do use meaningfull subjects !!! Do use meaningfull subjects !!! Do use meaningfull subjects !!! Do use meaningfull subjects !!! Do use meaningfull subjects !!! Today I deleted 2/3 of the mails that came over night without reading. I do not have time to wonder what's your "real beginner's question", whats "Probably impossible" or what "Few more questions" do you have. Tha subject of the email is not a worthless nonsense that should be ignored. It's a very important of your message, often the only part that's read! Jenda P.S.: If I sound upset, it's because I am. === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Request
on Tue, 09 Jul 2002 12:18:16 GMT, [EMAIL PROTECTED] (Jenda Krynicky) wrote: > Do use meaningfull subjects !!! You are absolutely right of course, but please follow your own advice. ('Request' doesn't look that meaningful to me ;-) -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HOW TO capture an EXACT perl command line?
From: Peter Scott <[EMAIL PROTECTED]> > At 07:50 PM 7/8/02 -0700, charlie strauss wrote: > >as you know, when a perl command runs the arguments on the command > >line are split on whitespace and placed in @ARGV > > > >What I want instead is to know the exact input command line, before > >it is split on white space. > > You can't do this. The shell does the whitespace splitting and > dequoting before the program sees the arguments. It makes no > difference what language the program is written in. Your only hope is > to use some kind of lobotomized shell that doesn't do any of that. I > don't know of one, but in any case I doubt that you're in a position > to dictate the shell. Better find another approach. Well ... you are right ... but only on certain OSes. If your are running some version of Unix, the you are right that the shell parses the parameters, globs them (processes the wildcards) and passes the list to the process. On the other hand under Windows (unless you are using cygwin) the shell only processes the redirections and similar stuff and passes the rest to the process UNMODIFIED. The process then splits the command line anyway it pleases. You can access the unparsed command line using the GetCommandLine() Win32 API function. From Perl you can do that like this: use Win32::API; my $GetCommandLine = Win32::API->new('kernel32', 'GetCommandLine', [ ] , 'P' ); $cmdline = $GetCommandLine->Call(); I cannot speak about other OSes, but I'd think it's more likely they'll work the Unix way. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Request
Do use meaningfull subjects !!! Do use meaningfull subjects !!! Do use meaningfull subjects !!! Do use meaningfull subjects !!! Do use meaningfull subjects !!! Do use meaningfull subjects !!! Do use meaningfull subjects !!! Today I deleted 2/3 of the mails that came over night without reading. I do not have time to wonder what's your "real beginner's question", whats "Probably impossible" or what "Few more questions" do you have. Tha subject of the email is not a worthless nonsense that should be ignored. It's a very important of your message, often the only part that's read! Jenda P.S.: If I sound upset, it's because I am. === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Enumerate Printers
on Mon, 08 Jul 2002 17:23:15 GMT, [EMAIL PROTECTED] (Keith) wrote: > Is there a way to enumerate printers on a NT/W2K print server via > PERL?? It's Perl, not PERL. See perldoc Win32::Netresource especially the second example, which almost does what you want. -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: new window
There are two ways to open a new window and fill it with cgi generated output. case 1: you have a web page. someonce clicks a link that is hyperlinked to the cgi. If you ALWAYS will want whatever the cgi returns to go to anew window then in the original page add TARGET = "my_new_page" inside the tag that links to the cgi. case 2: you dont ALWAYS want to open the cgi data in a new window, but instead want the CGI to decide on the fly when it will or wont open a new window. This case is much tougher. In fact its impossible, but you can do a workaround in javascript. Have the CGI first return a java script program the refreshes the old page and then opens a new window. the new window can either get its content directly from the java script, or it can make a second call to the cgi. On Mon, 8 Jul 2002 23:08:27 -0500 Mariusz <[EMAIL PROTECTED]> wrote: How can I execute the cgi and print the HTML text into a new window? In other words, can I open new browser window using perl? thank you, M -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]