Re: Help with executing a command on remote machine using Net::Telnet
As specified in the Net::Telnet docs, your prompt should be a match string. Try something like:- prompt ='/c:.*?/' #untested on a full session but does not throw an error when called as below Andy - Original Message - From: Satish Vadlamani [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, July 01, 2001 4:52 AM Subject: Help with executing a command on remote machine using Net::Telnet Hi: I am having trouble sending a command to the remote machine (both machines win2000). I don't want any interaction. I just want to send a command to be executed on the remote machine. I am getting the following error: bad match operator: opening delimiter missing: c:.*\\ at C:\MATRIX~1\DF\controls\scripts\RUN_PR~3.PL line 17 Here is the relevant part of my program. Thanks a lot if you can be of help. use Cwd; use File::Basename; use Env; use Cwd; use File::Copy ; use File::Path ; use strict; use Data::Dumper; use Time::Local; use Win32; use Date::Calc; use Net::Telnet; $\ = \n; my $t; $t = Net::Telnet-new (Timeout = 10, Host = 'MatrixDev', Prompt = 'c:.*\\\' ); my $user_name = administrator; my $password = ; $t-login($user_name,$password); #my $change_dir = $t-cmd(cd c:/MatrixDev/DF/controls/scripts); #my $result = $-cmd(run_prod_secondary_aa.pl); _ Get your FREE download of MSN Explorer at http://explorer.msn.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: Regex (and substitution) help
Denis I think this will do the deal for you:- $tagger = "See SAY_PLEASE_TXT and SAY_HELLO_TXT."; $tagger =~ s/\b([A-Z]+_[A-Z_]+)\b/^$1^/g; print "$tagger\n"; Andy - Original Message - From: "Denis Pleic" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 18, 2001 5:49 PM Subject: Regex (and substitution) help Hi Perlers, I need some help with a regex I can't figure out. In short, I need to enclose all occurences of certain "label" strings in a text file into '^' marks. I.e., for example: "See SAY_PLEASE_TXT and SAY_HELLO_TXT." Those string codes *always* come in all caps, and with *at least* one underscore character. The strings in capitals (with underscores) refer to string codes, which should be enclosed in special '^' marks, so that the above example should be changed to: "See ^SAY_PLEASE_TXT^ and ^SAY_HELLO_TXT^." I've managed to find some clues in Perl Cookbook, and got some results with modified "all caps" recipe: s/[^\Wa-z0-9]+\_/^$1^/g but, instead of enclosing the label into carets, it *replaces* the found text - and, besides, it does not find the whole string. In short, the above produces: "See ^^TXT and ^^TXT." which is definitely NOT what I wanted :-))) So, if anyone has any ideas and suggestions, I'd be more than grateful... TIA, Denis - -- Croatian Translation Language Services -- * [EMAIL PROTECTED] + Denis Pleic | Phone: (+385) 42 230-751 Vodnikova 15 | Fax: (+385) 42 231 598 HR-42000 Varazdin| Mobile: (+385) 98 798 323 CROATIA | http://www.open.hr/~dpleic/indx-e.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: [An open complaint (was RE: An Index of Incivility in the Perl Com munity )] [more rant, please ignore]
Chris I laughed my ass off when I read this about the 'young lady' syndrome, because it's just so true. I was just thinking the same thing the other week! :-) Too darn funny. Just think how many more detailed, patient and considerate answers they could get if they included a site URL in their signature at the end, something like http://www.emma-jean-monroe.com/pics ! On a more serious note, I have no problem with any question, no matter how simple, except for one situation - where the questioner plainly ends up wanting you to write the code for them almost from start to finish, which I think gets a bit much. Andy (aka Danni-Christi Ashe-Canyon) - Original Message - From: Chris Pettit [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 11, 2001 11:29 PM Subject: RE: [An open complaint (was RE: An Index of Incivility in the Perl Com munity )] [more rant, please ignore] John -- You forgot to mention how the 'seemingly' young ladies can get the most trite question answered with the finest of detail, patience and consideration. Well my new 'handle' is going to be Emma-Jean Monroe[FSU] or LinMing[UCLA], no one will suspect I'm one of the Un-Showered, long-in-the-tooth X-something engineering propeller heads. Ehh, real mean use Raid for after-shave. What-me-shave?? I can't ever remember a post like, Look, you stringy haired Bimbo, why don't you try RTFM. And, lose the hair spray, you've been doing to too much Apocolyptica or what ??? clp -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of JOHN PETRI Sent: Monday, June 11, 2001 10:51 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [An open complaint (was RE: An Index of Incivility in the Perl Com munity )] For questions that are unworthy, just ignore the question. Need to toughen of that thin skin? Participate in alt.politics. A week should do it if your a regular kind of guy. One day if you hate Jews, Homosexuals or belong to a local NAZI group. If you are a rookie, say so, apologize (for what I don't know) and ask your question. Some (said some folks) of these Perl guys have no life and sit on these lists all day. It's their alt.polictics and they dump here. If you are a rookie, say so, apologize, ask your question and then say you didn't understand the documentation. Wouldn't be much of a lie, since many don't. I don't. Wall is one of the cutest writers out there - forever going on, much like this post, about this or that. I swear there must be a pie recipe in there somewhere between his clever use of the language - something perl guys do. They even write poety with it. Now is that normal? If you are a pro, change your name often so you can claim to be a rookie and go ahead and ask that question. Just remember rookies, getting mashed by someone probably means he bald, humped backed (from programming all day) and doesn't shower. Well probably not. But it works for me. Like pretending all the audience is in their shorts. Oh, and if you get flamed, just ask the question again and ignor the humpback. Someone else will answer it. There are alot of good folks out their with good posture and sweet smelling (I assume - never smelled our Perl pro - but he does have thick glasses and doesn't mingle well. :-) PS Gotta say I've been ignored but never trashed on this list. I've even written authors of various mods and they answer. Imaging that. And when, months later, I see how tiresome that question must have been, I think their really nice, showered guys.[EMAIL PROTECTED] wrote: From: Lee Goddard [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: RE: An Index of Incivility in the Perl Community Date: Mon, 11 Jun 2001 11:49:29 +0100 FWIW Mostly hogswash. I learnt Perl from scratch without a book, and got all the help I needed from mailing lists and Usenet. Okay, I didn't ask anyone to complete my scripts or explain what an array is, but I'm not especially bright, just applied common sense. The very high number of lazy people asking questions they could themselves find answers to in the perldocs is a good enough reason to either ignore them or reply RTFM - or better, Go To Learn.Perl.Org. Okay, folks. I seem to have found my civility breaking point. Look, whether you like it or not we are always going to get those questions that lead one to spout out RTFM. I suggest, however, that we bite our tongue and answer the F'n question instead. rant with malice I don't know how many questions I have personally answered because some poor newbie came to me with his tail between his legs because he was scolded by the so called Perl gurus. If this is the attitude that we as a community are going to promote then I suppose I should pack it in right now. I don't know why so many of us have this arrogant, holier than thou attitude. Quite
Re: Win32::ODBC with Access2000
Ronnie Absolutely, Yes - 2000 and 97 use different versions of the Jet database engine and hence a different ODBC driver, although the later driver is meant to be, somewhat, backward compatible. There is no way, that I know of, to have the same driver accessing both types of file successfully without either converting the file types on the fly or (sometimes) trashing the 97 db into read-only, which is little use to most people. You can sometimes, under relatively restricted circumstances, use the driver with both types of db's but it seems to depend on the type of actions you are taking. For a detailed list of the known MDAC version problems you should look at the Mickeysoft Knowledge Base - last I checked there were 22 known probs with MDAC 2.1 and over 50 with 2.5, which I think is the version which comes with 2000. Now I'm not certain about this bit, but I think there may also be a problem trying to have both the 97 and the 2000 Access ODBC driver co-exist on the same machine, again due to having two Jet versions duking it out - this is probably a suck-it-and-see but could have some nasty consequences so don't try it on any machine you value running perfectly too much. hth a bit Andy - Original Message - From: Ronnie Jones [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 12, 2001 10:17 AM Subject: Win32::ODBC with Access2000 I am having a little difficulty with Access 2000 and ODBC. I am using the script from roth.net called ODBCQRY.pl to test the ODBC setup on my desktop. Using Win2000, it came with one system DSN by default called ECDCMusic which pointed to a database on the local drive. So I set up a new DSN to point to this same database and bingo! I now see two DSN in the select box on the first page of the cgi script ODBCQRY.pl. It just queried for available DSN's. All is well. So I put another access database in the same folder as the ECDC database and built a new DSN(I am sure it was an Access 97 database). All is well again. Now I use Access 2000 to open the new database and save as a different file, point the DSN to the new file and I get the error that is cannot open the file. Access tells me it is converting this file. I have a need to view Access 2000 and Access 97 databases. Do I need to use a different driver? Ronnie Jones ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Tk and fork()
Stupid question of the week:- :-) Anyone had any problems (or success) writing a forking Tk script. I get loads of 'unable to release shared object' errors in Tk.pm (line 96 if memory serves me right) when trying to deal with forking and everything eventually crashes and burns on me - my inclination is that the child is not getting a complete copy of the resources independantly and therefore this can never work. The widgets must have some WinAPI stuff which is fixed - I think. I know this is a very broad question - I'm open to facts, opinions and educated guesses. :-) Andy ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: interfacing with Eudora
Mike You don't even really need Eudora for this. It's pretty simple to have your list of addresses in one text file, your message body in another and then a script sucks them in and fires out mails to the mail server you specify. Because a mail sending transaction is fairly linear and straightforward it is fairly wasy to use IO::Socket or one of the mail modules to send out the mail direct from the script. If you have 2000 server you can even just send them to your own SMTP service on your own machine. Andy - Original Message - From: Michael Mirman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, May 25, 2001 5:41 AM Subject: interfacing with Eudora I'm considering writing a script that would send a mail message using Eudora. Has anyone done anything like this? How easy/difficult can this be? If this turns out to be difficult, I'll start looking into possible perl mail packages. I've been using blat instead of a pure perl solution, but I have a list (alias in Eudora), and using blat becomes more and more cumbersome. -- Mike Mirman Tel: (508) 647-7555 The Mathworks, Inc. FAX: (508) 647-7013 3 Apple Hill Drive, Natick, MA 01760 mailto:[EMAIL PROTECTED] Web: http://www.mathworks.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: fork error??
Alan Probably at least a snippet of code around the fork would be good. Also Perl version/build and OS. Andy - Original Message - From: mmollenkopf [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, May 26, 2001 10:01 PM Subject: fork error?? I keep running into an error when forking... anyone ever get this error (or similar) and know why it happens? The instuction at 0x280704c7 referenced at memory 0x02775218. The memory could not be read. Attempt to free non-existent shared string during global destruction. I will post the script if it would help... it is a very, very large script though. V/R, Alan Mollenkopf CW2 Mark Alan Mollenkopf HOMEPAGE- http://www.mollensoft.com/; Signals Intelligence Analyst Technician 1st Cavalry Division Analysis and Control Element (ACE) Work - 254.287-2493 Work - DSN 737-2493 Home - 254.539-4888 Cell - 254.338.8454 work- [EMAIL PROTECTED] home- [EMAIL PROTECTED] bus- [EMAIL PROTECTED] ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: need advice
David You could certainly fork off the transfer process which reads the data. You will then need an open pipe between the parent and child so the child can pass back the number of bytes read and any other info, so that you can update the progress bar in the parent. If the user hits 'cancel' then kill the child pid from the parent - if it still exists. Something along these lines...:- pipe(READER,WRITER) or die Can't open pipe: $!\n; if (fork == 0) { # child writes to WRITER close READER; select WRITER; $| = 1; #do child stuff here - get data and send progress to WRITER close WRITER; exit 0; } # parent process closes WRITER and reads from READER close WRITER; #get data from READER and update progress bar; This type of code works fine in a finite program but if the GUI is going to stay open and another transfer may be attempted, then there are probably other file handle clean-up issues that will need addressing, but at least you should be going in the right direction. hth Andy - Original Message - From: David Johnson [EMAIL PROTECTED] To: Perl Users [EMAIL PROTECTED] Sent: Saturday, May 26, 2001 8:17 PM Subject: need advice I've developed a small, configurable file transfer program using Net::FTP. I have one problem that I'm looking for advice on how to fix. In a nutshell, this is the problem: I use Net::FTP's method retr() to get a dataconn obj so that I can count up how many bytes I've gotten. Unfortunately, I am using a while loop to read() the data from the remote box. This locks up the window (in which I am displaying progress bar, etc; I'm using Win32::GUI). Is there some way I can fork this process off, or at least unlock the window so that the user can abort the transfer? I can't think of any solutions (but this is my first time doing windows programming with perl). Thanks for your input. david johnson ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: fork error??
Alan The only thing I can see with the code straight off is that you are using ($SCAN[0] || 127.0.0.1) for the server assignment but you are not checking if $SCAN[0] is defined before assigning it to $host. Also there is no evidence here that you are closing your sockets - but that is probably elsewhere. You don't say what Perl or OS you are using, so there's a lot of guesswork. If you are running this script under IIS then you could be running out of the memory IIS is assigning to your script, which is usually quite low. If there is any problem with the script then it could be occurring intermittently if a variable has a particular value which is a problem and you are not trapping it - like $SCAN[0] being undef(ined), for instance. You may want to try running under the debugger - particularly if you have the Perl DevKit - if not download and use the trial license, and then trace the variables and program flow. You can always use the good old fashioned debugging trick of printing out your vars at certain points of the program you suspect may be trouble points - before and after calling subs is usually a favorite. If you find nothing with the variables then you may have an OS memory paging problem. hth - a bit anyway. Andy - Original Message - From: mmollenkopf [EMAIL PROTECTED] To: Andy Jennings [EMAIL PROTECTED]; Perl Win32 [EMAIL PROTECTED] Sent: Sunday, May 27, 2001 12:55 PM Subject: Re: fork error?? Andy, roger... below is the offending snippet. thanks! I get that error about 50% of the time... Its really weird. #perl program stuff here #call to sub scan_ports which i am hoping to actually scan using a new child because it locks up the program while it is running. sub scan_ports { $status-configure(-text=Started Scanning...); $pid = fork(); if ($pid == 0) { fork_proc();} } sub fork_proc { open(SCAN, ps.txt); @scan = SCAN; close(SCAN); $server = ($SCAN[0] || 127.0.0.1); $begin = ($SCAN[1] || 0); $host = $SCAN[0]; for ($port=$begin;$port=10;$port++) { open(OUTFILE1, scanoutfile.txt); $sock = IO::Socket::INET-new(PeerAddr = $server, PeerPort = $port, Proto = 'tcp'); if ($sock) { $Date = localtime(); print OUTFILE1 on $Date Host $server port $port is active\n; close OUTFILE1; } else { $Date = localtime(); print OUTFILE1 on $Date Host $server port $port is closed\n; close OUTFILE1; } } print all finsished\n; $status-configure(-text=Scanning...Complete); } #more subs and perl stuff here V/R, Alan Mollenkopf CW2 Mark Alan Mollenkopf HOMEPAGE- http://www.mollensoft.com/; Signals Intelligence Analyst Technician 1st Cavalry Division Analysis and Control Element (ACE) Work - 254.287-2493 Work - DSN 737-2493 Home - 254.539-4888 Cell - 254.338.8454 work- [EMAIL PROTECTED] home- [EMAIL PROTECTED] bus- [EMAIL PROTECTED] - Original Message - From: Andy Jennings [EMAIL PROTECTED] To: mmollenkopf [EMAIL PROTECTED]; Perl Win32 [EMAIL PROTECTED] Sent: Sunday, May 27, 2001 3:53 AM Subject: Re: fork error?? Alan Probably at least a snippet of code around the fork would be good. Also Perl version/build and OS. Andy - Original Message - From: mmollenkopf [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, May 26, 2001 10:01 PM Subject: fork error?? I keep running into an error when forking... anyone ever get this error (or similar) and know why it happens? The instuction at 0x280704c7 referenced at memory 0x02775218. The memory could not be read. Attempt to free non-existent shared string during global destruction. I will post the script if it would help... it is a very, very large script though. V/R, Alan Mollenkopf CW2 Mark Alan Mollenkopf HOMEPAGE- http://www.mollensoft.com/; Signals Intelligence Analyst Technician 1st Cavalry Division Analysis and Control Element (ACE) Work - 254.287-2493 Work - DSN 737-2493 Home - 254.539-4888 Cell - 254.338.8454 work- [EMAIL PROTECTED] home- [EMAIL PROTECTED] bus- [EMAIL PROTECTED] ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Fw: need advice
David You could certainly fork off the transfer process which reads the data. You will then need an open pipe between the parent and child so the child can pass back the number of bytes read and any other info, so that you can update the progress bar in the parent. If the user hits 'cancel' then kill the child pid from the parent - if it still exists. Something along these lines...:- pipe(READER,WRITER) or die Can't open pipe: $!\n; if (fork == 0) { # child writes to WRITER close READER; select WRITER; $| = 1; #do child stuff here - get data and send progress to WRITER close WRITER; exit 0; } # parent process closes WRITER and reads from READER close WRITER; #get data from READER and update progress bar; This type of code works fine in a finite program but if the GUI is going to stay open and another transfer may be attempted, then there are probably other file handle clean-up issues that will need addressing, but at least you should be going in the right direction. hth Andy - Original Message - From: David Johnson [EMAIL PROTECTED] To: Perl Users [EMAIL PROTECTED] Sent: Saturday, May 26, 2001 8:17 PM Subject: need advice I've developed a small, configurable file transfer program using Net::FTP. I have one problem that I'm looking for advice on how to fix. In a nutshell, this is the problem: I use Net::FTP's method retr() to get a dataconn obj so that I can count up how many bytes I've gotten. Unfortunately, I am using a while loop to read() the data from the remote box. This locks up the window (in which I am displaying progress bar, etc; I'm using Win32::GUI). Is there some way I can fork this process off, or at least unlock the window so that the user can abort the transfer? I can't think of any solutions (but this is my first time doing windows programming with perl). Thanks for your input. david johnson ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: Server Side Include Question
The only way I think you may be able to do this would be through frames and you would need some persistent variables for the Perl script - maybe a hidden text input var for where you are in the list. Andy - Original Message - From: steve silvers [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, May 14, 2001 10:02 AM Subject: Server Side Include Question Im using SSI and have a question. My home page (index.shtml) calls in two Perl scripts. One delivers a scroll box, that is populated from my database, and the other delivers hyperlinks, also populated by my database. I deliver a max of 10 hyperlinks to fit in the allowed area. I have it so when there is more than 10 hyperlinks, my script puts a next button below them. My question is, and I don't think it can be done in Perl??? When the next button is clicked I just want to deliver the next 10 hyperlinks without reloading the index.shtml page. Can this be done using SSI with Perl. If not, any suggestions. Thanks in advance. Steve. _ Get your FREE download of MSN Explorer at http://explorer.msn.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: substitution on a file
Add a check for a word boundary to the start and finish of the old word $_ =~ s/\b$oldWord\b/$newWord/g hth Andy - Original Message - From: Rex Posadas [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, May 03, 2001 11:42 AM Subject: substitution on a file Hi, I'm trying to make substitutions in a file. My substitution should only take affect on exact matches only. below is my code: Start of Code *** $oldWord = Orange; $newWord = Apple; $^I=.bk; while () { $_ =~ s/$oldWord/$newWord/g; print; } End of Code *** This code replaces any occurance of Orange so the word MyOrange will be changed to MyApple. I would like to change this so that Orange is the only one that is replaced by the string Apple. Thanks in advance. _ Get your FREE download of MSN Explorer at http://explorer.msn.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: Bizarre SvTYPE [157] error when implementing fork() or Simple::proc
Jeremy When you fork, the pid assigned to the child is a visible non-zero value in the parent but to the child it is zero. Therefore to execute code that is to be run in the child process you must check the value returned by fork() is 0. So the code you want to execute in the child process goes into a block like this:- if (fork == 0) { DO THE CHILD PROCESS STUFF } This will actually fork the program at the time it does the checking on the if statement. Given that once the file has been downloaded you probably do not want to execute other code your last line on the block will probably be 'exit;'. The parent will produce a non-zero value and so the condition will be false and the parent skips over the block of child code and goes on its merry way doing whatever else you want it to do. hth Andy - Original Message - From: "Jeremy Aiyadurai" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 19, 2001 4:04 PM Subject: "Bizarre SvTYPE [157]" error when implementing fork() or Simple::proc hi, I am trying to use forks() or some form of multiprocesss, but it seems i am hitting a wall everytime I get an error that i don't understand "Bizarre SvTYPE [157] at bftpcf.pl line 256" or "Bizarre SvTYPE [157] at simple.pm line ###". this is how i am implementing forks() sub CMD($) { chomp( $CMD = ); if ( $CMD =~ m/^dl\s.*/i ) {#if input matches "dl [thefile]" start download and display prompt again $CMD =~ /^dl\s(.*)/i; dl($1); my $pid = fork(); sub dl { my $file = $_[0]; $ftp-Get($file) || NotValidFile; } kill($pid); CMD; } basically, i want to start a dl process from an ftp site, and go back to CMD prompt and do other stuff, while the process,(download) is in progress. I really feel alone without good examples of forksYour help will be greatly appreciated. thankyou Jeremy A. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: Return codes ??
Title: PSCI_1 Paula Most likely because the command returns a two byte int and the return code is only setting the high byte bits with all the low byte bits unset. Dividing by 256 is the equivalent of 8 bitwise shifts to place all the set bits in the low byte. Andy - Original Message - From: Capacio, Paula J To: [EMAIL PROTECTED] Sent: Thursday, April 19, 2001 6:42 PM Subject: Return codes ?? I have a perl script (driver)that calls another scripttounit testthe conditional exits of that script. The driver script is executed via a command window on NT and ona basic level the driver script code is @output = `perl rctest.pl`; if ($? != 0) { print "return code: $?\n";} What happens is...a exit 50; statement results in $? = 12800. Why does this happen? A friend told me that thecheat is to divide the value by 256 andyou have the original value, and that worksbut why is this necessary? TIA Paula Capacio
Re: open file
Could you post the complete and exact error message plz together with the code 3 or 4 lines either side of the error line #. It sounds like more of a permissions prob but we need to know what you are trying to do. Andy - Original Message - From: "eo_pereira" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, April 18, 2001 1:48 AM Subject: open file Can someone send me a working cgi code using windows 2000 IIS 5.0 and the lastest activeperl that will save some type of data to a file for some reason i am having problems saving simple data to a file. I am not sure if I am not coding it right or if I have do not have IIS configured the way it should be. TIA ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: Scan help
Bill It looks ugly, I know, but it works... $myvariable =~ s/\\rmcnt\\public/rmcntpublic rmcntpublic /; Add the g option if there are multiple instances of the string to change in the variable Andy - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, April 16, 2001 3:22 PM Subject: Scan help I have a variable that contains "\rmcnt\public", I want to change it to "rmcnt\\public rmcnt\\public " Bill Bryan EDM International 915-225-2526 Voice 915-225-2600 Fax e-mail [EMAIL PROTECTED] e-mail [EMAIL PROTECTED] (home) ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Fw: Whoops! CLARIFICATION: Reading a file from point A to B
Gary To grab the lines between tags and include the tags then you can use code like the following:- open(HTM, "file_to_scan.txt"); @lines = HTM; close(HTM); $longline = join "\n", @lines; $longline =~ s/(form(.*?)\/form)//si; print $1; $result = $1; $result now contains the first match in the file or is printed to whereever you want. Repeat $longline =~ s/(form(.*?)\/form)//si; for subsequent matches in the same file as often as required - probably you would use a while loop if you are expecting multiple matches. hth Andy - Original Message - From: "Gary Nielson" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, April 16, 2001 2:28 PM Subject: Whoops! CLARIFICATION: Reading a file from point A to B I should correct my previous posting to say that I mean I need to capture all lines in-between start and end tags, not just the second line in the example below. I amended below for clarity. On Mon, 16 Apr 2001, Gary Nielson wrote: Hi, I am trying to figure out the best way to read a file from point A to point B. For example, I have a file with many specialized tags that start on one line and then the end tag is a few lines down and I want to be able to 1) recognize when the tag starts, 2) grab all the content in-between the tag. When reading a file, I understand how to grab a line of text and manipulate it, as well as grab a paragraph of text. I was reading in the Perl Cookbook about $/ and how that is used. I do not know if that's the appropriate special variable for this type of action. For example, if in the middle of an html document, I encounter the following: SNML_BYLINE CENTERBBy SOMEONE'S NAME /B/CENTERP CENTERIContributor /I/CENTERP /SNML_BYLINE How do I recognize the beginning SNML_BYLINE tag, stop at the end /SNML_BYLINE tag and grab all the lines in-between and put them in a special variable? I must keep in mind that there could be anywhere from 1 to many lines in-between the start and end tags. Any help appreciated. -- Gary Nielson [EMAIL PROTECTED] ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: Subject: Detecting multiple instances
Not sure about 'net info' but generally the 'net' group of commands deal with services, networking and users - a list of currently running services can be obtained by issuing 'net start' for instance. To get a list of running processes you can use tlist.exe which I believe is part of the NT resource kit and is certainly copiable to 2000. It's a long time since I checked, but I think it may be part of the 98 resource kit too. This will provide a list of the running processes with their PID's. Handy to go along with this is kill.exe which, er, terminates a process by ID or by name and can be wildcarded - 'kill perl.???' would kill all instances of the Perl interpreter (and hence all .pl scripts normally) currently running. You will find it very difficult on Windows (as far as I know - someone may know better :-)) to find out which scripts are running already as any .pl produces just a perl.exe in the tlist and any .plx does not appear at all as it runs under inetinfo.exe, the webserver process. I don't know how this goes in UNIX. HTH Andy - Original Message - From: "bowman" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, April 08, 2001 7:23 PM Subject: Subject: Detecting multiple instances Is there a way to detect whether a script (or exe) is running, so that one can prevent a second instance? you can get a list of the currect processes, and search through it for the process name you are interested in. On Nt/2000, I believe 'net info' will list them, or there are some freeware programs that produce the list using the psapi.dll. If wmi is installed, you can also query and get a list of processes. Another method is opening HKEY_PERFORMANCE_DATA, but this is fairly slow. These methods just return the process name, so parsing it out is fairly safe. I've written a version of the Unix ps that returns the commandline; this requires a little more care to avoid picking up 'tail -f myscript.log' or 'gvim myscript.pl' as instances. On Win95 and 98, there are a couple of API calls to interate enumerate the process list that are a little more straightforward. I don't think there is an approach, other than wmi, that will work on all platforms. However, wmi can be installed on Win95 and above, and offers a good deal of information. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: Orphan Process While Using Textpad
James I don't seem to have a problem with this on Textpad 4.3.1 32-bit version. The settings I use are:- Command: C:\Perl\bin\Perl.exe (or other location of Perl.exe) Parameters: d:\scripts\intest.pl (or location of script to run) and have the 'DOS command' box checked. HTH Andy - Original Message - From: "James E Keenan" [EMAIL PROTECTED] To: "Perl-Win32-Users" [EMAIL PROTECTED] Sent: Sunday, April 08, 2001 8:46 PM Subject: Orphan Process While Using Textpad This question is for anyone who uses Textpad as his/her text editor when writing and testing Perl. Generally speaking, I like Textpad a lot, particularly its ability to do a "Tools/Run ..." and run Perl from within the program (including the -c and -d flags). But I find it can't handle standard input from the console/keyboard. When it gets to a point where a script requires input from the keyboard, it just hangs up. And when I go to shut down, I get a message that the program "Perl" is still running, etc., and I have to do one of those "End Task" commands to shut down safely. What is Textpad doing wrong and what am I doing wrong? ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: how to represent any character (incl. \n) in regexp?
Try (.|\n) instead. Andy - Original Message - From: "Bennett Haselton" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, April 07, 2001 11:08 PM Subject: how to represent "any character" (incl. \n) in regexp? Since according to p. 25 of "Programming Perl" by Wall, "." stands for "any character except newline" and "\n" stands for "newline", and [set] matches "any character in set", I thought you could use "[.\n]" to match "any character": $string = 'abc'; if ($string =~ /([.\n])/) { print "yes: $1\n"; } else { print "no\n"; } But this prints out "no". It turns out that inside the square brackets, "." represents the period character and not "any character"; if you change string to "a.bc", the script print "yes: ." . In that case, how do you represent "any character" inside a regexp? -Bennett [EMAIL PROTECTED] http://www.peacefire.org (425) 649 9024 ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Fw: how to represent any character (incl. \n) in regexp?
- Original Message - From: "Andy Jennings" [EMAIL PROTECTED] To: "jose quesada" [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, April 07, 2001 11:43 PM Subject: Re: how to represent "any character" (incl. \n) in regexp? Jose While this will work for Bennet in this particular, very specific, case, /s also has some other side effects which if not considered can lead to problems later down the road if you get a false sense of security with it. In particular it will match groups of identical characters like 'aa' which will almost certainly be a bad thing in most other cases - for instance, where you want the regex to look for very specific chars around a newline. $*. was deprecated for a good reason and I think /s purely as a means to match newlines will become deprecated in the same way. Just my two cents worth. Andy - Original Message - From: "jose quesada" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, April 07, 2001 11:06 PM Subject: Re: how to represent "any character" (incl. \n) in regexp? Bennett Haselton wrote: Since according to p. 25 of "Programming Perl" by Wall, "." stands for "any character except newline" and "\n" stands for "newline", and [set] matches "any character in set", I thought you could use "[.\n]" to match "any character": You could use the /s modificator (in substitutions, like s/bla(.)/blo$1/s; in matching, m/bla./s ) (camel book, p. 153). Or you can use the deprecated $*. (Not recommended). TIMTOWTDI, Cheers, Jose $string = 'abc'; if ($string =~ /([.\n])/) { print "yes: $1\n"; } else { print "no\n"; } But this prints out "no". It turns out that inside the square brackets, "." represents the period character and not "any character"; if you change string to "a.bc", the script print "yes: ." . In that case, how do you represent "any character" inside a regexp? -Bennett [EMAIL PROTECTED] http://www.peacefire.org (425) 649 9024 ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users -- Jose Quesada Jimenez [EMAIL PROTECTED] Research associate http://lsa.colorado.edu/~quesadaj Institute of Cognitive Science http://geneura.ugr.es/~jose University of Colorado (Boulder) Muenzinger psychology building Phone, work:303 492 1522 office D447A Campus Box 344 home:303 545 2082 University of Colorado at Boulder Boulder, CO 80309-0344 ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users