Re: CGI grep
Larry Linskey wrote: Hi, I have been only working with perl for a few weeks now. I am wondering if anyone has a cgi script that I could post on a website that would allow users to grep files for a string. I am constantly parsing smtp logs for users that did not receive an email . I would love to offer such a tool to our support desk. That's pretty simple stuff really. On UNIX, it would be simpler to run a grep on the files externally and return the results. On Doze, you could do the same using findstr (if you have it on your flavor of Doze) or use File::Find and slurp and grep the files one at a time in your script. -- ,-/- __ _ _ $Bill LuebkertMailto:[EMAIL PROTECTED] (_/ / )// // DBE CollectiblesMailto:[EMAIL PROTECTED] / ) /-- o // // Castle of Medieval Myth Magic http://www.todbe.com/ -/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff) ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: CGI grep
The short answer is, yes, perl is great for this kind of tast. Now, specifically, you want to have the user input a string and then match for it in the files in the mailq? Or, perhaps the string is their email address? However you want to address it, the logic will be pretty much the same: ### untested and without the cgi stuff opendir(DIR,$dir) || die "can't open $dir for reading : $!\n"; my @files = readdir(DIR); close(DIR); my $string = "whatever you want to match here"; # get this from the CGI? foreach my $file(@files) { open(FILE,$file) ||{warn "Can't open $file for reading : $!\n"; next;} foreach my $line(FILE) { if ($line =~ /$string/i) { print "$file MATCHES!!!\n"; # or whatever you wish to do with this } } close(FILE); } ### end Try it out and ask the group if you need help. -Original Message-From: Larry Linskey [mailto:[EMAIL PROTECTED]Sent: Thursday, September 09, 2004 10:09 AMTo: [EMAIL PROTECTED]Subject: CGI grep Hi, I have been only working with perl for a few weeks now. I am wondering if anyone has a cgi script that I could post on a website that would allow users to grep files for a string. I am constantly parsing smtp logs for users that did not receive an email . I would love to offer such a tool to our support desk. Thanks in advance, Larry Linskey This message was scanned by GatewayDefender10:13:10 AM ET - 9/9/2004 ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: CGI grep
oh yeah, one thing I should've added to boost speed. If you found a match no need to keep looking, thus add the last statement if ($line =~ /$string/i) { print "$file MATCHES!!!\n"; # or whatever you wish to do with this last; } ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Array question.
Title: Array question. Hello guys , I am struggling to understand a small problem that I have with arrays. Here is a snipset of my code. = 1. my @UIDLArray = $mailAcc-Uidl(); my $UIDLArrayIndex = 0; foreach my $UIDLIdx ( @UIDLArray ) { $UIDLArrayIndex = $UIDLArrayIndex + 1; # check if this UIDL is in the already_read.txt file print DEBUG -- before FinfUIDL\n; my $found = FindUIDL($UIDLIdx); .. 2. my @UIDL = $mailAcc-Uidl($msgNr); foreach my $test ( @UIDL ) { my ($resource) = $test; last; } my ($test) = @UIDL; The only difference between this two pieces of code is that in one case I call Uidl without parameters and in the other case with a mail message number. In the first case in the for each I get only the UIDL ( some strange unique number ) and in the second case I get also a number in front of that UIDL . If we suppose that UIDL is abcd then in the first case I get abcd and in the second case I get 1 abcd. Do any of you has any ideea how can I get rid of the 1 and space from the second case ( even better if someone can tell me what is in fact the difference ). Best regards, Nicu ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Request: howto install GD.pm using ppm on 5.8?
-- hi , step 1 is ppm step 2 is install GD step 3 is ??? regards, michael thompson i have slipped the surly bonds of earth, and danced the skies on laughter-silvered wings; --john gillespie magee jr. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Windows Process Info
Is there a way to get information on a Windows process other than using Win32::Process::Info? Currently, there is a memory leak when using the Info module (see perl bug #33499). While the bug will be fixed in the next version of ActivePerl I am not sure that upgrading to a new version will be possible on the servers we are running. Specifically, the two pieces of information needed are the parent process of a process and the creation time of a process. Any solution short of an external subroutine or a process external to Perl would be appreciated.___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Linger time of socket in Win32::Internet ?
Hello all, its possible to set the linger time (in SO_LINGER) of a socket if I have the objects from Win32::Internet ? use Win32::Internet; $INET=new Win32::Internet(); $res=$INET-FTP($FTP,);# Wat is in $res ? $FTP-QueryOption('67'); # Error 12018 The supplied handle is the wrong type for the requested operation # '67' is for INTERNET_DIAGNOSTIC_SOCKET_INFO and give a structure with Socket descriptor inside (I hope) $INET-QueryOption('67'); # Error 12018 The supplied handle is the wrong type for the requested operation # '67' is for INTERNET_DIAGNOSTIC_SOCKET_INFO and give a structure with Socket descriptor inside (I hope) $FTP-Close(); # the socket must also close after the linger time - If I kill the script --- all opened sockets must close -- I hope this is possible over DataReciveTimeout, DataSendTimeout, ControlReceiveTimeout, ControlSendTimeout and Linger time Best regards/Mit freundlichen Grüssen Joachim Görner Informationsverarbeitung Systemtechnik Basisdienste (ISB) ADAC e.V., Am Westpark 8, 81373 München Tel.: (089) 76 76 27 83 Fax: (089) 76 76 28 82 mailto:[EMAIL PROTECTED] www.adac.de ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: File::Find
Hi, Thanks it works perfectly. I understand my error now. Using the $File::Find::name for verifying if the folder exist was wrong since find is changing directory. Thanks a lot -Original Message- From: $Bill Luebkert [mailto:[EMAIL PROTECTED] Sent: Thursday, September 09, 2004 11:17 AM To: Francis Paulin Cc: [EMAIL PROTECTED] Subject: Re: File::Find Francis Paulin wrote: Hi, This the code snippet that can reproduce the problem # Code BEGIN use strict; use File::Find; sub IsDirectory() { my $tmpFileName = $File::Find::name; if (-d $tmpFileName) { print($tmpFileName . \n); } } find(\IsDirectory,..); # Code END When calling the find function, if the script is in D:\test\scripts, it will stop the recursive search at a depth of two. So D:\test\hello will be found, D:\test\hello\world will be found too, but D:\test\hello\world\again\ will not be found because the find function seems to stop the search. Having such kind of directory structure will provide the output needed. I'm running with Windows XP Pro on Activestate Perl 5.8.4. I also try using ../ or ..\ as the directory argument of find. The same result occures Try this one: use strict; use File::Find; sub IsDirectory { print $File::Find::name . \n if -d $_; } find (\IsDirectory, ..); __END__ From: $Bill Luebkert [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 7:08 PM To: Francis Paulin Cc: [EMAIL PROTECTED] Subject: Re: File::Find Francis Paulin wrote: Hi, I've got problem when using the find function from the File::Find module. When I try to use the find function with relative path using .. as the path argument of find, it does not recurse completely into the tree directory. Behalf of that, if I use the physical path of .., it will work and will recurse the directory completely find(\IsUCClassesDirectory,..); # will not recurse the directory tree completely (the script is launched from d:\test\scripts\) find(\IsUCClassesDirectory,D:\\test\\directory_tree_here); will recurse the directory tree completely. Curiously, using find with the relative path will only search directories in a maximum depth of two. If this is normal, a bug or do I am doing something wrong? Probably. Post a small complete test snippet that fails for you with a bit of the output showing the problem. -- ,-/- __ _ _ $Bill LuebkertMailto:[EMAIL PROTECTED] (_/ / )// // DBE CollectiblesMailto:[EMAIL PROTECTED] / ) /-- o // // Castle of Medieval Myth Magic http://www.todbe.com/ -/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff) ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Array question.
[EMAIL PROTECTED] wrote: Hello guys , I am struggling to understand a small problem that I have with arrays. [snip] The only difference between this two pieces of code is that in one case I call Uidl without parameters and in the other case with a mail message number. In the first case in the for each I get only the UIDL ( some strange unique number ) and in the second case I get also a number in front of that UIDL . This is only a guess (educated), based on my assumption that your $mailAcc is a POP3Client object. The UIDL() method returns - without params, and array of UIDL's for all available messages - with a param, just the server response, which is in the format message_number uidl I find that's a silly thing to do, and it conflicts with the documented behaviour, so you may want to take that up with the Mail::POP3Client developer. If we suppose that UIDL is abcd then in the first case I get abcd and in the second case I get 1 abcd. Do any of you has any ideea how can I get rid of the 1 and space from the second case ( even better if someone can tell me what is in fact the difference ). In the mean time, you could do $uidl =~ s/^\d+\s+//; This will strip the leading number, but would leave regular uidls intact. Rhesa ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Perl CD Bookshelf - Ver 3 (not latest)
Does anyone have a copy of this CD that they would like to sell (no, not a copy you made, the real thing)? I would really like to get Perl and LWP on CD (I have the dead-tree version), the new CD Bookshelf does not have it, and there appears to be no other way to get it. Safari doesn't do it for me, since I am not always connected to the Net. Thanks, Cameron -- Cameron Dorey Assoc. Editor, Analytical Sciences Digital Library http://www.asdlib.org Assoc. Professor of Chemistry, University of Central Arkansas Phone: 501-450-5938 Email: [EMAIL PROTECTED] ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Using html SCRIPT tag with PERL
Hello everyone, Question,...Using the following HTML example file... HTML HEAD /HEAD BODY SCRIPT LANGUAGE=perl ###Perl code ### /SCRIPT /BODY /HTML What else do I need to do for this to work? Is there additional configuration needed for apache? Right now any PERL code does not get executed. Thanks, Bryan ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Using html SCRIPT tag with PERL
If you installed your copy of Activeperl in the default directory on your C drive, check out this FAQ. file:///C:/Perl/html/faq/Windows/ActivePerl-Winfaq7.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ncaa-hoops Sent: Thursday, September 09, 2004 2:06 PM To: [EMAIL PROTECTED] Subject: Using html SCRIPT tag with PERL Hello everyone, Question,...Using the following HTML example file... HTML HEAD /HEAD BODY SCRIPT LANGUAGE=perl ###Perl code ### /SCRIPT /BODY /HTML What else do I need to do for this to work? Is there additional configuration needed for apache? Right now any PERL code does not get executed. Thanks, Bryan ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Using html SCRIPT tag with PERL
Sorry for the double response, I copied the wrong link. file:///C:/Perl/html/Windows/ActiveServerPages.html If you installed your copy of Activeperl in the default directory on your C drive, check out this FAQ. file:///C:/Perl/html/faq/Windows/ActivePerl-Winfaq7.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Using html SCRIPT tag with PERL
That information pertains only to IIS, whereas the OP said he's running apache. As long as I'm responding, I'll hop up on my soapbox a little bit. Feel free to ignore everything after this sentence. Mixing code and HTML is a bad idea, in general. It's bad when you put HTML in code (a la CGI.pm) and it's bad when you put code in HTML (a la embperl). One cannot be maintained without touching the other. It's fine if it's a small project and you are (and will always be) the only one maintaining it. Otherwise, I recommend separating the code and the presentation using a templating system like HTML::Template or Template-Toolkit (www.template-toolkit.org). I really like the Template Toolkit and use it all the time, even on smallish projects. It is really easy to use, and often turns out to be simpler than any alternative. For example, with all the plugins available for TT, occasionally you don't need _any_ code, just the templates (triggered by the 'tpage' or 'ttree' command). In any case, it's worth looking into for any medium-to-large scale effort. - Mark. -- Mark Thomas[EMAIL PROTECTED] Internet Systems Architect DigitalNet, Inc. $_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Adam R. Frielink Sent: Thursday, September 09, 2004 3:27 PM To: ncaa-hoops; [EMAIL PROTECTED] Subject: RE: Using html SCRIPT tag with PERL Sorry for the double response, I copied the wrong link. file:///C:/Perl/html/Windows/ActiveServerPages.html If you installed your copy of Activeperl in the default directory on your C drive, check out this FAQ. file:///C:/Perl/html/faq/Windows/ActivePerl-Winfaq7.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
question about Bills site
Hi Bill I just checked out you site and wonder what the cmd.exe is used for ? Lori ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Help with date and time format
I need to get a date and time format into 3 different variables: Date format: 2004-09-09 # $date Time format: 9:00 or 15:00, etc # $time_now and the time 1 hour ago. So it it's 4 in the afternoon. I need. Time 2 format: 15:00 # $time_hour_ago Any help greatly appreciated. Allan ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Windows Process Info
Win32::PerfLib, maybe? I know you can get the PID and the start time of a process. No listing in perfmon for parent process, but 'creating process id' is listed. Maybe that gives you what you need. I think the author has some examples at http://www.bybyte.de/jmk hope that helps Chris Patrick B Cromer [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent by: cc: [EMAIL PROTECTED] Subject: Windows Process Info eState.com 09/09/2004 01:41 PM Is there a way to get information on a Windows process other than using Win32::Process::Info? Currently, there is a memory leak when using the Info module (see perl bug #33499). While the bug will be fixed in the next version of ActivePerl I am not sure that upgrading to a new version will be possible on the servers we are running. Specifically, the two pieces of information needed are the parent process of a process and the creation time of a process. Any solution short of an external subroutine or a process external to Perl would be appreciated. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Request: howto install GD.pm using ppm on 5.8?
step 3 profit :-) -- Mike Arms -Original Message- From: Michael 'topdog' Thompson [mailto:[EMAIL PROTECTED] Sent: Thursday, September 09, 2004 11:40 AM To: [EMAIL PROTECTED] Subject: Request: howto install GD.pm using ppm on 5.8? hi , step 1 is ppm step 2 is install GD step 3 is ??? regards, michael thompson ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Help with date and time format
Take a look at Date::Pcalc - should do everything you need. HTH Dave Kazatsky Senior Middleware Administrator W. (908) 575-6947 C. (973) 865-8106 |-+- | | [EMAIL PROTECTED]| | | Sent by: | | | [EMAIL PROTECTED]| | | veState.com | | | | | | | | | 09/09/2004 04:16 PM | | | | |-+- --| | | | To: [EMAIL PROTECTED] | | cc: | | Subject: Help with date and time format | --| I need to get a date and time format into 3 different variables: Date format: 2004-09-09 # $date Time format: 9:00 or 15:00, etc # $time_now and the time 1 hour ago. So it it's 4 in the afternoon. I need. Time 2 format: 15:00 # $time_hour_ago Any help greatly appreciated. Allan ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs The information contained in this message may be CONFIDENTIAL and is for the intended addressee only. Any unauthorized use, dissemination of the information, or copying of this message is prohibited. If you are not the intended addressee, please notify the sender immediately and delete this message. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Request: howto install GD.pm using ppm on 5.8?
Wait, this isn't Slashdot :) It appears ActiveState's PPM repository does not carry GD for ActivePerl 5.8. You can grab the module from Randy Kobes' site like so: ppm repository add uw http://theory.uwinnipeg.ca/ppms/ install GD Thanks as usual Randy. -Original Message- From: Arms, Mike [mailto:[EMAIL PROTECTED] Sent: Thursday, September 09, 2004 1:26 PM To: 'Michael 'topdog' Thompson'; [EMAIL PROTECTED] Subject: RE: Request: howto install GD.pm using ppm on 5.8? step 3 profit :-) -- Mike Arms -Original Message- From: Michael 'topdog' Thompson [mailto:[EMAIL PROTECTED] Sent: Thursday, September 09, 2004 11:40 AM To: [EMAIL PROTECTED] Subject: Request: howto install GD.pm using ppm on 5.8? hi , step 1 is ppm step 2 is install GD step 3 is ??? regards, michael thompson ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Windows Process Info
Patrick B Cromer wrote: Is there a way to get information on a Windows process other than using Win32::Process::Info? Currently, there is a memory leak when using the Info module (see perl bug #33499). While the bug will be fixed in the next version of ActivePerl I am not sure that upgrading to a new version will be possible on the servers we are running. If it's simply a matter of installing the latest version of the module, then you can grab it from CPAN and install it. The module requires no compilation, so you could install it with 'perl makefile.pl', 'nmake test' and 'nmake install' - or by simply copying the '.pm' files to the appropriate location (not recommended). Cheers, Rob ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: question about Bills site
lorid wrote: Hi Bill I just checked out you site and wonder what the cmd.exe is used for ? It's for 95/98 where you have no cmd.exe (just command.com). cmd.exe is a better shell. -- ,-/- __ _ _ $Bill LuebkertMailto:[EMAIL PROTECTED] (_/ / )// // DBE CollectiblesMailto:[EMAIL PROTECTED] / ) /-- o // // Castle of Medieval Myth Magic http://www.todbe.com/ -/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff) ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Help with date and time format
[EMAIL PROTECTED] wrote: I need to get a date and time format into 3 different variables: Date format: 2004-09-09 # $date Time format: 9:00 or 15:00, etc # $time_now and the time 1 hour ago. So it it's 4 in the afternoon. I need. Time 2 format: 15:00 # $time_hour_ago use POSIX; my $time = time; my @d = localtime $time; my $date = strftime %Y-%m-%d, @d; my $time_now = strftime %H:%M:%S, @d; @d = localtime $time - 3600; my $time_hour_ago = strftime %H:%M:%S, @d; print date=$date, now=$time_now, hour ago = $time_hour_ago\n; __END__ -- ,-/- __ _ _ $Bill LuebkertMailto:[EMAIL PROTECTED] (_/ / )// // DBE CollectiblesMailto:[EMAIL PROTECTED] / ) /-- o // // Castle of Medieval Myth Magic http://www.todbe.com/ -/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff) ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
CGI.pm: Button element ???
How can CGI.pm do this: http://www.w3.org/TR/REC-html40/interact/forms.html#edef-BUTTON Yes, I know that I can manually enter the [X]HTML; but, I wonder how to do this with only CGI.pm. What do you think? -- Best Regards, mds mds resource 877.596.8237 - Dare to fix things before they break . . . - Our capacity for understanding is inversely proportional to how much we think we know. The more I know, the more I know I don't know . . . -- signature.asc Description: Digital signature ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs