RE: deleting files from the directory from a file list. Please Help!
On Fri, 25 Jul 2003 15:18:39 -0600, [EMAIL PROTECTED] wrote: > FYI: I have been doing perl for about two weeks, so if my answer screws you up, > don't sue me please! :D > > You would do something like this: > > foreach my $string () > { > system "cmd del *string*"; > } > > I believe that is right. But even if I am, some of these other guys will show you a > better way. > While that *might* work you should definitely avoid this approach if at all possible. There are a number of reasons to, a) avoid shelling out if possible (read: last resort), for all of the normal reasons that I suggest people not shell out, insecure, not portable, inefficient, error prone...yada, yada, yada... b) using the "*string*" approach could get ugly (read: insecure, dangerous) real quick. What happens when 'string' is empty because someone left a blank line in the file (ouch) > -Original Message- > From: perlwannabe [mailto:[EMAIL PROTECTED] > Sent: Friday, July 25, 2003 3:04 PM > To: [EMAIL PROTECTED] > Subject: deleting files from the directory from a file list. Please > Help! > > > Here is my problem. I want to delete the files contained in a directory > from a list contained in a file. Here is an example: > > The input file is a regular text file in the following format (call it > myfile.txt); > > item1 > item2 > item3 > item4 > > > What I want to do is look in a directory and delete any file in the > directory that contains any item on the list. For example, lets say the > contents of the directory looks like this: > > 07/24/2003 01:27 AM 3,812 heresanitem1 > 07/24/2003 10:42 PM 912,126 heretoitem2 > 07/14/2003 12:19 AM 234 item3ishere > 06/12/2003 10:25 PM34,049 leavemealone > 06/12/2003 10:25 PM16,683 leavemealonetoo > 07/22/2003 11:36 PM 1,825 yupitem4yup > > > I would like to read each line of the file from "myfile.txt" [getline() I > suppose] and then delete the files that have ANY MATCHING information from > the input file. So if the input file has "item1" it will delete the file > "heresanitem1" as well as "alsoitem1aswell" from the directory. So when I > run the script the sample directory above will look like this: > > 06/12/2003 10:25 PM34,049 leavemealone > 06/12/2003 10:25 PM16,683 leavemealonetoo > > > This problem has been tough for me. I have read everything I can get my > hands on concerning unlink but I cannot get this problem solved. Any help > appreciated. > > OP, I have not seen the answers given in the newsgroup but possibly a looping use of File::Find combined with an 'unlink'... What have you tried? What has failed? Do you know why? http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: deleting files from the directory from a file list. Please Help!
Perlwannabe wrote: > > Here is my problem. I want to delete the files contained in a directory > from a list contained in a file. Here is an example: > > The input file is a regular text file in the following format (call it > myfile.txt); > > item1 > item2 > item3 > item4 > > > What I want to do is look in a directory and delete any file in the > directory that contains any item on the list. For example, lets say the > contents of the directory looks like this: > > 07/24/2003 01:27 AM 3,812 heresanitem1 > 07/24/2003 10:42 PM 912,126 heretoitem2 > 07/14/2003 12:19 AM 234 item3ishere > 06/12/2003 10:25 PM34,049 leavemealone > 06/12/2003 10:25 PM16,683 leavemealonetoo > 07/22/2003 11:36 PM 1,825 yupitem4yup > > > I would like to read each line of the file from "myfile.txt" [getline() I > suppose] and then delete the files that have ANY MATCHING information from > the input file. So if the input file has "item1" it will delete the file > "heresanitem1" as well as "alsoitem1aswell" from the directory. So when I > run the script the sample directory above will look like this: > > 06/12/2003 10:25 PM34,049 leavemealone > 06/12/2003 10:25 PM16,683 leavemealonetoo > > > This problem has been tough for me. I have read everything I can get my > hands on concerning unlink but I cannot get this problem solved. Any help > appreciated. Were the answers you received in comp.lang.perl.misc no good enough? http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=mbudash-8EC90B.23563424072003%40typhoon.sonic.net&rnum=1&prev=/groups%3Fas_q%3Ditem1%2Bitem2%2Bitem3%2Bitem4%26num%3D10%26as_scoring%3Dd%26hl%3Den%26ie%3DISO-8859-1%26btnG%3DGoogle%2BSearch%26as_epq%3D%26as_oq%3D%26as_eq%3D%26as_ugroup%3Dcomp.lang.perl.misc%26as_usubject%3D%26as_uauthors%3D%26as_umsgid%3D%26lr%3D%26as_drrb%3Dq%26as_qdr%3D%26as_mind%3D12%26as_minm%3D5%26as_miny%3D1981%26as_maxd%3D25%26as_maxm%3D7%26as_maxy%3D2003%26safe%3Dimages John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: deleting files from the directory from a file list. Please Help!
FYI: I have been doing perl for about two weeks, so if my answer screws you up, don't sue me please! :D You would do something like this: foreach my $string () { system "cmd del *string*"; } I believe that is right. But even if I am, some of these other guys will show you a better way. Brian -Original Message- From: perlwannabe [mailto:[EMAIL PROTECTED] Sent: Friday, July 25, 2003 3:04 PM To: [EMAIL PROTECTED] Subject: deleting files from the directory from a file list. Please Help! Here is my problem. I want to delete the files contained in a directory from a list contained in a file. Here is an example: The input file is a regular text file in the following format (call it myfile.txt); item1 item2 item3 item4 What I want to do is look in a directory and delete any file in the directory that contains any item on the list. For example, lets say the contents of the directory looks like this: 07/24/2003 01:27 AM 3,812 heresanitem1 07/24/2003 10:42 PM 912,126 heretoitem2 07/14/2003 12:19 AM 234 item3ishere 06/12/2003 10:25 PM34,049 leavemealone 06/12/2003 10:25 PM16,683 leavemealonetoo 07/22/2003 11:36 PM 1,825 yupitem4yup I would like to read each line of the file from "myfile.txt" [getline() I suppose] and then delete the files that have ANY MATCHING information from the input file. So if the input file has "item1" it will delete the file "heresanitem1" as well as "alsoitem1aswell" from the directory. So when I run the script the sample directory above will look like this: 06/12/2003 10:25 PM34,049 leavemealone 06/12/2003 10:25 PM16,683 leavemealonetoo This problem has been tough for me. I have read everything I can get my hands on concerning unlink but I cannot get this problem solved. Any help appreciated. -- 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]
deleting files from the directory from a file list. Please Help!
Here is my problem. I want to delete the files contained in a directory from a list contained in a file. Here is an example: The input file is a regular text file in the following format (call it myfile.txt); item1 item2 item3 item4 What I want to do is look in a directory and delete any file in the directory that contains any item on the list. For example, lets say the contents of the directory looks like this: 07/24/2003 01:27 AM 3,812 heresanitem1 07/24/2003 10:42 PM 912,126 heretoitem2 07/14/2003 12:19 AM 234 item3ishere 06/12/2003 10:25 PM34,049 leavemealone 06/12/2003 10:25 PM16,683 leavemealonetoo 07/22/2003 11:36 PM 1,825 yupitem4yup I would like to read each line of the file from "myfile.txt" [getline() I suppose] and then delete the files that have ANY MATCHING information from the input file. So if the input file has "item1" it will delete the file "heresanitem1" as well as "alsoitem1aswell" from the directory. So when I run the script the sample directory above will look like this: 06/12/2003 10:25 PM34,049 leavemealone 06/12/2003 10:25 PM16,683 leavemealonetoo This problem has been tough for me. I have read everything I can get my hands on concerning unlink but I cannot get this problem solved. Any help appreciated. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: eleminating dupes in a 2-D @list
--- Sitha Nhok <[EMAIL PROTECTED]> wrote: [snip] > stored into a 2-D array. Then I want to eliminate duplicates in a > column or multiple columns. I came from a C/C++ background, so the only > method I am really familiar with is traversing thru the column comparing > one element to the next element. So, it is not very efficient. [snip] Ovid wrote: [snip] Hi Sitha, To answer this properly, we require an understanding of a couple of things. 1. How do you define "duplicates"? I assume that you mean, for a given column, duplicates are a data item that is repeated more than once. For example: 2 3 r s 8 1 a 2 d u 8 4 1 h w w u a 4 1 9 In the first, third, and sixth columns, respectively, '2', 'u', and '1' are duplicates. Or do you, perhaps, mean something else entirely? 2. What is done when the data is eliminated? Do elements get undefined or shifted, perhaps? For example, in the diagram above, replacing the duplicates with spaces gives us: 3 r s 8 a d 8 4 h w w a 4 9 Is that what you are looking for, or do things get shifted left or up, or some combination of that? Cheers, Ovid [snip] Hi Ovid: Yes, you are correct about what I meant by duplicates. However, what I was looking to do with them is slightly different from what you suggested. If there is a duplicate, I want to remove not just that column, but everything in that row. And I would like to be able to combine different columns together to match for duplicates. For example, A B C D E F G <== used for indexing 2 3 r s 8 1 a 2 d u 8 4 1 h w w u a 4 1 a Say I wanted to see if column A and B had duplicates, then I would remove the entire row. So the string that I would try to match up with is "23". None of the subsequent rows have a 2 in column A and a 3 in column B, so there were no duplicates. However, if we did column F and G, the string would be "1a", and it would find a duplicate in the last row; thus, removing the entire row. I hope that cleared up things. I am not very good when it comes to clarity, so I hope what I wrote was understandable. Thanks again. Sitha -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Telnet.pm and Unix prompt
Chris, --- "Vidal, Christopher, SOLCM" <[EMAIL PROTECTED]> wrote: > Using the Telnet.pm mod, How do I put my unix prompt into the PROMPT > scalar ? > > My unix profile prompt is : > > uid=`whoami` > system=`hostname` > PS1=$system" "$uid" "\\!:" " > > #! /opt/perl5/bin/perl > require '/tools/mns/bin/Telnet.pm'; > # > $username = "wannabperlguy" ; > $passwd = "needslotsahelp"; > $t = new Net::Telnet (Timeout => 10, > Prompt => '`hostname`" "`whoami`); > $t->open("1.2.3.4"); > $t->login($username, $passwd); > @lines = $t->cmd("/usr/bin/who"); > print @lines; I don't think you can do command substitution like this. Maybe if it was done before the compile stage (dunno). Try using a literal string. Example, I used this string to log in to 450 different servers (each had a the server name embedded in the prompt, s0001u01, s0002u01, s0003u01, etc): $t = new Net::Telnet ( Timeout=> 15, Prompt => '/\([EMAIL PROTECTED]):.*> $/' ); Note: special perl characters MUST be espcaped (as in the above). You can use '.' for single character substitution, and '*' for multiple characters (as you might expect). Note too that the trailing '$' above signifies end-of-string that telnet.pm will scan to indicate you're at a prompt (ie, my prompt might be: "([EMAIL PROTECTED]):/local/usr/apps > ". You're missing the '/' to indicate your prompt string set, and the final '$'. Concatenate the variables you want into a single variable and do something like Prompt => '/$myPrompt$/' ); HTH, JW __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Workaround for File::Find stopping on directory with space in name?
Kevin Zembower wrote: > Thanks, Rob, for your note. I tried this: > [EMAIL PROTECTED]:~/RapheTask$ perl t > /cdrom > /cdrom/JPEG Covers > /cdrom/PDF Docs > [EMAIL PROTECTED]:~/RapheTask$ cat t > use strict; > use warnings; > > use File::Find; > > find (sub{ print "$File::Find::name\n" }, '/cdrom/' ); > [EMAIL PROTECTED]:~/RapheTask$ > > I think the failure is due to the different ways spaces in file > names are treated in Windows vs. Unix. In Window's, they're > allowed, in Unix, a space is a delimiter between files in a list. > No. Unix is even more tolerantt of strange characters than Windows: the latter needs you to put the entire filename in quotes if it is to believe you. My guess is that your CD server software is playing strange games. If you try copying the entire CD contents to a local drive and then running your Perl script I am sure it will be OK. It may well be that the CD server can be configured differently to prevent your problem. You're not working over Samba are you? HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Split FileName
Pablo Fischer wrote: > > Hi! Hello, > I have a string (its an array, the array has the values that $ftp->ls("dir) > returns), so $array[1] contains this: > -rw-r--r-- 1 pablopablo 18944 Jul 16 21:14 File28903.zip > > What I would like to do is: get the date (Jul 16), the time (12:14) and the > FileName, each one if a different array, like.. Does $ftp->mdtm( $fname ) not work? > my ($date, $time, $fname) = $array[1]; > > I know that I could to it with split, I solved the problem with > > split(" ",$array[1]); > > However I would like to know if I can separeate the original string into > columns, so I could access the values like: > > $date = $col[6]+$col[7]; > $time = $col[8]; > $fname = $col[9]; my ( $date, $time, $fname ) = unpack 'x42 A6 x A5 x A*', $array[ 1 ]; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Workaround for File::Find stopping on directory with space in name?
Kevin Zembower wrote: > > I think the failure is due to the different ways spaces in file names > are treated in Windows vs. Unix. In Window's, they're allowed, in Unix, > a space is a delimiter between files in a list. AFAIK Unix file system names can contain any ASCII character EXCEPT "\0" and "/". "\0" because Unix is written in C and C "strings" use "\0" as the terminating character and "/" because that is used as the separator between file system names. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Telnet.pm and Unix prompt
Using the Telnet.pm mod, How do I put my unix prompt into the PROMPT scalar ? My unix profile prompt is : uid=`whoami` system=`hostname` PS1=$system" "$uid" "\\!:" " #! /opt/perl5/bin/perl require '/tools/mns/bin/Telnet.pm'; # $username = "wannabperlguy" ; $passwd = "needslotsahelp"; $t = new Net::Telnet (Timeout => 10, Prompt => '`hostname`" "`whoami`); $t->open("1.2.3.4"); $t->login($username, $passwd); @lines = $t->cmd("/usr/bin/who"); print @lines; Thanks a lot and Best Regards, Christopher Vidal -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Workaround for File::Find stopping on directory with space in name?
Bob, boy, is that odd. Thanks for trying it out. Now, I'm really scratching my head. -Kevin >>> Bob Showalter <[EMAIL PROTECTED]> 07/25/03 03:03PM >>> KEVIN ZEMBOWER wrote: > in name? > > > Thanks, Rob, for your note. I tried this: > [EMAIL PROTECTED]:~/RapheTask$ perl t > /cdrom > /cdrom/JPEG Covers > /cdrom/PDF Docs > [EMAIL PROTECTED]:~/RapheTask$ cat t > use strict; > use warnings; > > use File::Find; > > find (sub{ print "$File::Find::name\n" }, '/cdrom/' ); > [EMAIL PROTECTED]:~/RapheTask$ > > I think the failure is due to the different ways spaces in > file names are treated in Windows vs. Unix. In Window's, > they're allowed, in Unix, a space is a delimiter between files in a > list. Spaces in directory and file names are allowed in Unix. I created some directories with spaces in them and File::Find plowed right through them, processing their contents correctly. Something else is going on, but I'm not sure what... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Workaround for File::Find stopping on directory with space in name?
KEVIN ZEMBOWER wrote: > in name? > > > Thanks, Rob, for your note. I tried this: > [EMAIL PROTECTED]:~/RapheTask$ perl t > /cdrom > /cdrom/JPEG Covers > /cdrom/PDF Docs > [EMAIL PROTECTED]:~/RapheTask$ cat t > use strict; > use warnings; > > use File::Find; > > find (sub{ print "$File::Find::name\n" }, '/cdrom/' ); > [EMAIL PROTECTED]:~/RapheTask$ > > I think the failure is due to the different ways spaces in > file names are treated in Windows vs. Unix. In Window's, > they're allowed, in Unix, a space is a delimiter between files in a > list. Spaces in directory and file names are allowed in Unix. I created some directories with spaces in them and File::Find plowed right through them, processing their contents correctly. Something else is going on, but I'm not sure what... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Workaround for File::Find stopping on directory with space in name?
Thanks, Rob, for your note. I tried this: [EMAIL PROTECTED]:~/RapheTask$ perl t /cdrom /cdrom/JPEG Covers /cdrom/PDF Docs [EMAIL PROTECTED]:~/RapheTask$ cat t use strict; use warnings; use File::Find; find (sub{ print "$File::Find::name\n" }, '/cdrom/' ); [EMAIL PROTECTED]:~/RapheTask$ I think the failure is due to the different ways spaces in file names are treated in Windows vs. Unix. In Window's, they're allowed, in Unix, a space is a delimiter between files in a list. Thanks, again, for your suggestion. -Kevin >>> Rob Dixon <[EMAIL PROTECTED]> 07/25/03 02:44PM >>> Hi Kevin. I believe this should work find as long as the code is as you say it is. Try just: use strict; use warnings; use File::Find; find (sub{ print "$File::Find::name\n" }, '/full/path/to/cdrom' ); which works fine on my Windows XP machine, both bare and running Cygwin. HTH, Rob -- 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]
Split FileName
Hi! I have a string (its an array, the array has the values that $ftp->ls("dir) returns), so $array[1] contains this: -rw-r--r-- 1 pablopablo 18944 Jul 16 21:14 File28903.zip What I would like to do is: get the date (Jul 16), the time (12:14) and the FileName, each one if a different array, like.. my ($date, $time, $fname) = $array[1]; I know that I could to it with split, I solved the problem with split(" ",$array[1]); However I would like to know if I can separeate the original string into columns, so I could access the values like: $date = $col[6]+$col[7]; $time = $col[8]; $fname = $col[9]; Thanks! Pablo -- Pablo Fischer Sandoval ([EMAIL PROTECTED]) http://www.pablo.com.mx http://www.debianmexico.org GPG FingerTip: 3D49 4CB8 8951 F2CA 8131 AF7C D1B9 1FB9 6B11 810C Firma URL: http://www.pablo.com.mx/firmagpg.txt -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Workaround for File::Find stopping on directory with space in name?
Kevin Zembower wrote: > I'm trying to write a script to perform a number of actions on > files sent to me regularly on CD-ROMs. Unfortunately, the CD-ROM is > generated on a Windows machine, often with spaces in the directory > names: > [EMAIL PROTECTED]:~/RapheTask$ ls -lR /cdrom/ > /cdrom/: > total 4 > dr-xr-xr-x1 root root 2048 Jan 16 2003 JPEG Covers > dr-xr-xr-x1 root root 2048 Jan 16 2003 PDF Docs > > /cdrom/JPEG Covers: > total 3858 > -r-xr-xr-x1 root root 806801 Jan 16 2003 PLUGA164.jpg > -r-xr-xr-x1 root root 1475140 Jan 16 2003 PLUGA333.jpg > -r-xr-xr-x1 root root 516976 Jan 16 2003 PLUGA376.jpg > -r-xr-xr-x1 root root 1138129 Jan 16 2003 PLUGA403.jpg > > /cdrom/PDF Docs: > total 28761 > -r-xr-xr-x1 root root 1154227 Jan 16 2003 PLUGA164.pdf > -r-xr-xr-x1 root root 3369769 Jan 16 2003 PLUGA306.pdf > -r-xr-xr-x1 root root 1394922 Jan 16 2003 PLUGA333.pdf > -r-xr-xr-x1 root root 3156595 Jan 16 2003 PLUGA369.pdf > -r-xr-xr-x1 root root 3308012 Jan 16 2003 PLUGA370.pdf > -r-xr-xr-x1 root root 6116464 Jan 16 2003 PLUGA376.pdf > -r-xr-xr-x1 root root 2167484 Jan 16 2003 PLUGA394.pdf > -r-xr-xr-x1 root root 2177885 Jan 16 2003 PLUGA395.pdf > -r-xr-xr-x1 root root 2884660 Jan 16 2003 PLUGA400.pdf > -r-xr-xr-x1 root root 3121413 Jan 16 2003 PLUGA401.pdf > -r-xr-xr-x1 root root 519212 Jan 16 2003 PLUGA403.pdf > [EMAIL PROTECTED]:~/RapheTask$ > > My program is this: > [EMAIL PROTECTED]:~/RapheTask$ cat processAVimages.pl > #! /usr/bin/perl -w > > use strict; > use File::Find; > > sub process_file { >print "$File::Find::name\n"; >#Other operations will go here > } > > find(\&process_file, '/cdrom/'); > > [EMAIL PROTECTED]:~/RapheTask$ > > The program seems to stall when it hits the directories with spaces > in filenames, and doesn't find the files in them: > [EMAIL PROTECTED]:~/RapheTask$ ./processAVimages.pl > /cdrom > /cdrom/JPEG Covers > /cdrom/PDF Docs > [EMAIL PROTECTED]:~/RapheTask$ > > When I run it on a directory without spaces in any of the > subdirectory names, it seems to work fine. > > What are some suggestions for working around this behavior? I just > need to process the files; the directory structure will be thrown > away. I'd like to be able to deal with what ever directory > structure is included on the CD, and not just hard-code in specific > directory names used. > > Thanks for your thoughts and suggestions. Hi Kevin. I believe this should work find as long as the code is as you say it is. Try just: use strict; use warnings; use File::Find; find (sub{ print "$File::Find::name\n" }, '/full/path/to/cdrom' ); which works fine on my Windows XP machine, both bare and running Cygwin. HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: eleminating dupes in a 2-D @list
--- Sitha Nhok <[EMAIL PROTECTED]> wrote: [snip] > stored into a 2-D array. Then I want to eliminate duplicates in a > column or multiple columns. I came from a C/C++ background, so the only > method I am really familiar with is traversing thru the column comparing > one element to the next element. So, it is not very efficient. [snip] Hi Sitha, To answer this properly, we require an understanding of a couple of things. 1. How do you define "duplicates"? I assume that you mean, for a given column, duplicates are a data item that is repeated more than once. For example: 2 3 r s 8 1 a 2 d u 8 4 1 h w w u a 4 1 9 In the first, third, and sixth columns, respectively, '2', 'u', and '1' are duplicates. Or do you, perhaps, mean something else entirely? 2. What is done when the data is eliminated? Do elements get undefined or shifted, perhaps? For example, in the diagram above, replacing the duplicates with spaces gives us: 3 r s 8 a d 8 4 h w w a 4 9 Is that what you are looking for, or do things get shifted left or up, or some combination of that? Cheers, Ovid = Hire me! http://users.easystreet.com/ovid/personal/resume.html Silence is Evilhttp://users.easystreet.com/ovid/philosophy/indexdecency.htm Ovid http://www.perlmonks.org/index.pl?node_id=17000 Web Programming with Perl http://users.easystreet.com/ovid/cgi_course/ __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
eleminating dupes in a 2-D @list
Hello: If I have a text file that was in the following form: Header1 Header2 Header3 etc Info1Info2Info3 etc Info1b Info2b Info3b etc Each element is delimited by a tab. Lets say that the information is stored into a 2-D array. Then I want to eliminate duplicates in a column or multiple columns. I came from a C/C++ background, so the only method I am really familiar with is traversing thru the column comparing one element to the next element. So, it is not very efficient. I was wondering if perl has a way of doing it a lot faster. Any help would be appreciated. Sitha -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to check if the job is failure or successful in sub1 befo re calling sub2
Usually you do this by returning a 0 if the sub fails or any other value if it is successful. Simple Example: if(lookforfolder()){ print "It's there!\n"; }else{ print "Folder not found\n"; } sub lookforfolder{ if(-d "/home/me"){ return 1; }else{ return 0; } -Original Message- From: loan tran [mailto:[EMAIL PROTECTED] Sent: Friday, July 25, 2003 8:09 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: How to check if the job is failure or successful in sub1 before calling sub2 Hello all, Can somebody throw some light on this. 1. How to capture errors from the output running a perl script. 2. How to check if the job is failure or successful in sub1 before calling sub2. Thanks __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- 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]
Workaround for File::Find stopping on directory with space in name?
I'm trying to write a script to perform a number of actions on files sent to me regularly on CD-ROMs. Unfortunately, the CD-ROM is generated on a Windows machine, often with spaces in the directory names: [EMAIL PROTECTED]:~/RapheTask$ ls -lR /cdrom/ /cdrom/: total 4 dr-xr-xr-x1 root root 2048 Jan 16 2003 JPEG Covers dr-xr-xr-x1 root root 2048 Jan 16 2003 PDF Docs /cdrom/JPEG Covers: total 3858 -r-xr-xr-x1 root root 806801 Jan 16 2003 PLUGA164.jpg -r-xr-xr-x1 root root 1475140 Jan 16 2003 PLUGA333.jpg -r-xr-xr-x1 root root 516976 Jan 16 2003 PLUGA376.jpg -r-xr-xr-x1 root root 1138129 Jan 16 2003 PLUGA403.jpg /cdrom/PDF Docs: total 28761 -r-xr-xr-x1 root root 1154227 Jan 16 2003 PLUGA164.pdf -r-xr-xr-x1 root root 3369769 Jan 16 2003 PLUGA306.pdf -r-xr-xr-x1 root root 1394922 Jan 16 2003 PLUGA333.pdf -r-xr-xr-x1 root root 3156595 Jan 16 2003 PLUGA369.pdf -r-xr-xr-x1 root root 3308012 Jan 16 2003 PLUGA370.pdf -r-xr-xr-x1 root root 6116464 Jan 16 2003 PLUGA376.pdf -r-xr-xr-x1 root root 2167484 Jan 16 2003 PLUGA394.pdf -r-xr-xr-x1 root root 2177885 Jan 16 2003 PLUGA395.pdf -r-xr-xr-x1 root root 2884660 Jan 16 2003 PLUGA400.pdf -r-xr-xr-x1 root root 3121413 Jan 16 2003 PLUGA401.pdf -r-xr-xr-x1 root root 519212 Jan 16 2003 PLUGA403.pdf [EMAIL PROTECTED]:~/RapheTask$ My program is this: [EMAIL PROTECTED]:~/RapheTask$ cat processAVimages.pl #! /usr/bin/perl -w use strict; use File::Find; sub process_file { print "$File::Find::name\n"; #Other operations will go here } find(\&process_file, '/cdrom/'); [EMAIL PROTECTED]:~/RapheTask$ The program seems to stall when it hits the directories with spaces in filenames, and doesn't find the files in them: [EMAIL PROTECTED]:~/RapheTask$ ./processAVimages.pl /cdrom /cdrom/JPEG Covers /cdrom/PDF Docs [EMAIL PROTECTED]:~/RapheTask$ When I run it on a directory without spaces in any of the subdirectory names, it seems to work fine. What are some suggestions for working around this behavior? I just need to process the files; the directory structure will be thrown away. I'd like to be able to deal with what ever directory structure is included on the CD, and not just hard-code in specific directory names used. Thanks for your thoughts and suggestions. -Kevin Zembower - E. Kevin Zembower Unix Administrator Johns Hopkins University/Center for Communications Programs 111 Market Place, Suite 310 Baltimore, MD 21202 410-659-6139 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to check if the job is failure or successful in sub1 before calling sub2
Hello all, Can somebody throw some light on this. 1. How to capture errors from the output running a perl script. 2. How to check if the job is failure or successful in sub1 before calling sub2. Thanks __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IDE for Perl Development
XEmacs http://www.xemacs.org SciTE http://www.scintilla.org/SciTE.html ViM http://vim.sf.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: search and match
Nyimi Jose wrote: > I think he is missing quotes while assigning. > $a = abc\/edf\/a #is wrong ! > > José. > But even without warnings enabled so he should get a division by zero error! I'm sure we'll find out... :) Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: apache/cgi/script/beguinner
> #! /usr/bin/perl > You should only have one shebang line, the on with the right path. > #!/usr/local/bin/perl > # hello.pl - My first CGI program > > print "Content-Type: text/html\n\n"; > # Note there is a newline between > # this header and Data > > # Simple HTML code follows > > print " \n"; > print "Hello, world!"; > print "\n"; > print "\n"; > print "Hello, world!\n"; > print " \n"; > > I have put this file at /html and /cgi-bin as a pl file as > well as a cgi file... no way.. netscape displays the text > content of the file, but does not execute the script. so it > is just printing the whole textual content of the file... > I have chmod 755 the file.. so... what do I have to change > and where... please.. if I place the script > at /cgi-bin then it gives me an error msgs forbiden so? Is the webserver user allowed to execute it (SETUID, nobody, or ???)? Is apache configured to know how to execute it? HTH DMuey -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: encrypt
> . also a just starting with perl > > $wip = "\e[2J"; > print "$wip"; > > This will clear the screen but I have been trying to find out > why it doesnt place the cursor at 0,0 > > > I was considering > > $wip = `qx(clear)`; instead but this doesnt work either. > You either need `clear` or qx(clear) since qx() is the same as ``. Just FYI DMuey -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Thumb-nailing Pic's
Maybe I'm missing something here but, It can be done just using HTML, say... $h= 250; $w= 250; print "\n"; Or maybe you're talking about something more complex and at this time in the morning I can't figure out what is it... ;-) -rm- - Original Message - From: "Support" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, July 24, 2003 11:50 PM Subject: Thumb-nailing Pic's > Hi All > I'm using perl to write a html page on the fly which includes photos of > different sizes. Does anyone know of a bit of code that I can add to my > script that ensures the resulting page shows the pictures on the page all > the same size regardless of the original picture size. > Cheer > Colin > > -- - > www.rentmyplace.co.nz > The ultimate in that holiday spot away from the maddening crowd > Join as a member today its FREE > List your holiday accommodation for FREE > -- -- > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.502 / Virus Database: 300 - Release Date: 18/07/2003 > > > -- > 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: apache/cgi/script/beguinner
On Fri, 25 Jul 2003 17:59:56 +1000, [EMAIL PROTECTED] (Unknown Sender) wrote: >I am trying to run a perl cgi script for the first time... under linux >redhat8. my apache works fine. localhost gives me the test page. I have >this script (very usual) > >#! /usr/bin/perl > >#!/usr/local/bin/perl ># hello.pl - My first CGI program > >print "Content-Type: text/html\n\n"; ># Note there is a newline between ># this header and Data > ># Simple HTML code follows > >print " \n"; >print "Hello, world!"; >print "\n"; >print "\n"; >print "Hello, world!\n"; >print " \n"; > Well the first line is wrong. #! /usr/bin/perl has a space after the ! , and also may not be where your perl is located. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: REGEX PROBLEM (fwd)
--- Begin Message --- Hi A way to solve your problem is to use the FILE module and take the filename out using basename. I think BaseName.pm can be downloaded form CPAN. Please try the following: use File::Basename; @filenames = qw (/tmp/test/.test.txt /tmp/test/hallo.txt /tmp/test/xyz/abc.txt /var/log/ksy/123.log); foreach $files (@filenames) { if ((basename $files) !~ /^\./) { print (basename $files); } } Thankyou VENU -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, July 25, 2003 2:39 PM To: [EMAIL PROTECTED] Subject: REGEX PROBLEM hi, i have the follwing strings: /tmp/test/.test.txt /tmp/test/hallo.txt /tmp/test/xyz/abc.txt /var/log/ksy/123.log now i need a regex that matches all lines but the one that contains a filename starting with a point. like ".test.txt". how can i do that? this is what i have: '\.(?!tgz)[^.]*$' this matches everything, but tgz at the end of a line, so '(?!\.)[^.]*$' should do the job, but it doesnt:( THANK YOU:) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- End Message --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: search and match
I think he is missing quotes while assigning. $a = abc\/edf\/a #is wrong ! José. -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Friday, July 25, 2003 1:52 PM To: [EMAIL PROTECTED] Subject: Re: search and match > > "Boon Chong Ang" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > ismsg03.altera.priv.altera.com... > Hi, > Just say i have a variable being assigned as follow, > > $a = abc/edf/a > > i want it to search from another file for the file that contains > exactly the same words, what i do is to modify the variable a become > $a = abc\/edf\/a and then print if /$a/; but it failed > even if i tried print if "/$a/"; it also failed. Can anyone point out > my mistake or show me the correct way to do this? > > I'm not sure what your problem is here. Even without the escape characters this works fine. Can you tell us more of what you're doing, and why you think it doesn't work? Rob use strict; use warnings; my $a = 'abc/edf/a'; while () { print if /$a/; } __DATA__ abc/edf/a acb/ecf/a ffabc/edf/a dsa/bc/edf/a abc/edf/agg OUTPUT abc/edf/a ffabc/edf/a abc/edf/agg -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] DISCLAIMER "This e-mail and any attachment thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by other persons than the designated recipient(s) is prohibited. If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer". Thank you for your cooperation. For further information about Proximus mobile phone services please see our website at http://www.proximus.be or refer to any Proximus agent. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: search and match
> > "Boon Chong Ang" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > ismsg03.altera.priv.altera.com... > Hi, > Just say i have a variable being assigned as follow, > > $a = abc/edf/a > > i want it to search from another file for the file that contains > exactly the same words, what i do is to modify the variable a become > $a = abc\/edf\/a and then > print if /$a/; but it failed > even if i tried print if "/$a/"; it also failed. Can anyone point out > my mistake or show me the correct way to do this? > > I'm not sure what your problem is here. Even without the escape characters this works fine. Can you tell us more of what you're doing, and why you think it doesn't work? Rob use strict; use warnings; my $a = 'abc/edf/a'; while () { print if /$a/; } __DATA__ abc/edf/a acb/ecf/a ffabc/edf/a dsa/bc/edf/a abc/edf/agg OUTPUT abc/edf/a ffabc/edf/a abc/edf/agg -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: REGEX PROBLEM
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > hi, i have the follwing strings: > > > /tmp/test/.test.txt > /tmp/test/hallo.txt > /tmp/test/xyz/abc.txt > /var/log/ksy/123.log > > > now i need a regex that matches all lines but the one that contains a > filename starting with a point. like ".test.txt". how can i do that? > > this is what i have: > > '\.(?!tgz)[^.]*$' this matches everything, but tgz at the end of a > line, so > > '(?!\.)[^.]*$' should do the job, but it doesnt:( The following will help. It first generatest the file's basename in $1 by capturing the string of all trailing characters which aren't '/', and then checks to ensure that that basename doesn't start with a dot.. HTH, Rob while () { chomp; if ( m<([^/]*)$> and $1 =~ /^[^.]/ ) { print $_, "\n"; } } __DATA__ /tmp/test/.test.txt /tmp/test/hallo.txt /tmp/test/xyz/abc.txt /var/log/ksy/123.log OUTPUT /tmp/test/hallo.txt /tmp/test/xyz/abc.txt /var/log/ksy/123.log -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: REGEX PROBLEM
On Friday, Jul 25, 2003, at 18:09 Asia/Tokyo, [EMAIL PROTECTED] wrote: /tmp/test/.test.txt /tmp/test/hallo.txt /tmp/test/xyz/abc.txt /var/log/ksy/123.log now i need a regex that matches all lines but the one that contains a filename starting with a point. like ".test.txt". how can i do that? this is what i have: '\.(?!tgz)[^.]*$' this matches everything, but tgz at the end of a line, so '(?!\.)[^.]*$' should do the job, but it doesnt:( because your expression matches, for example, just 'txt' too. Try /\/[^.\/][^\/]+$/g; or /^.+\/[^.\/][^\/]+$/g; Kino -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
search and match
Hi, Just say i have a variable being assigned as follow, $a = abc/edf/a i want it to search from another file for the file that contains exactly the same words, what i do is to modify the variable a become $a = abc\/edf\/a and then print if /$a/; but it failed even if i tried print if "/$a/"; it also failed. Can anyone point out my mistake or show me the correct way to do this? Thank you & best regards, ABC
RE: encrypt
. also a just starting with perl $wip = "\e[2J"; print "$wip"; This will clear the screen but I have been trying to find out why it doesnt place the cursor at 0,0 I was considering $wip = `qx(clear)`; instead but this doesnt work either. -Original Message- From: Boon Chong Ang [mailto:[EMAIL PROTECTED] Sent: Friday, July 25, 2003 5:32 AM To: [EMAIL PROTECTED] Subject: encrypt Hi, Just say i have a perl script file as a.pl. The usage is like a.pl a abc ab where a, abc and ab is the control parameters. Is there anyway i can encrypt the file and clear the screen display so that it only display such as progressing. when i run the perl script. I mean it become something like a.unix a abc ab where a.unix is an encrypted file and a, abc and ab is the parameters Thank you & best regards, ABC -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: telnet problems
Type y :-) No, i don't know how to do that ... -Original Message- From: Miguel Angel Morales [mailto:[EMAIL PROTECTED] Sent: Friday, July 25, 2003 12:56 PM To: [EMAIL PROTECTED] Subject: telnet problems Hi all! I open a telnet session to a router for creating IPv6 tunnels. The creating process is ok but, when I try to remove a created tunnel I write: $t->cmd('delete -r tunnel tb-008'); and then the router ask me: 'Are you sure? (y/n):' and I am not able to response this question. I try $t->print('y'); but it doesn't work. The input_log method returns: login: brokertunel Password: All Rights Reserved,Copyright(C)1999,2002,Hitachi,Ltd. *** Welcome to the Router *** CONSULINTEL/command: admin Password: CONSULINTEL/admin: config CONSULINTEL/config: delete -r tunnel tb-008 Are you sure? (y/n): How could I confirm the removing process? Thanks in advance, Miguel Ángel * Madrid 2003 Global IPv6 Summit Presentations and videos on-line at: http://www.ipv6-es.com DISCLAIMER "This e-mail and any attachment thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by other persons than the designated recipient(s) is prohibited. If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer". Thank you for your cooperation. For further information about Proximus mobile phone services please see our website at http://www.proximus.be or refer to any Proximus agent. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
telnet problems
Hi all! I open a telnet session to a router for creating IPv6 tunnels. The creating process is ok but, when I try to remove a created tunnel I write: $t->cmd('delete -r tunnel tb-008'); and then the router ask me: 'Are you sure? (y/n):' and I am not able to response this question. I try $t->print('y'); but it doesn't work. The input_log method returns: login: brokertunel Password: All Rights Reserved,Copyright(C)1999,2002,Hitachi,Ltd. *** Welcome to the Router *** CONSULINTEL/command: admin Password: CONSULINTEL/admin: config CONSULINTEL/config: delete -r tunnel tb-008 Are you sure? (y/n): How could I confirm the removing process? Thanks in advance, Miguel Ángel * Madrid 2003 Global IPv6 Summit Presentations and videos on-line at: http://www.ipv6-es.com
Re: apache...
On Fri, 25 Jul 2003, awongxi wrote: > why is it that when I put something under /cgi-bin and try to acces it > localhost/cgi-bin then it allways tells me that > > The requested URL /cgi-bin/w2h/w2h.start was not found on this server. > > but the file IS there.. is it because it is looking for under html so > the path it is trying to locate is /html/cgi-bin? how can I fix this!!! > where in the apace conf file? > > > > Change the path as ../cgi-bin/w2h/w2h.start.Even if it wont work for you look at the confi. file at /etc/httpd/conf. Check at the Document root. thanks, visu -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: performance tuning in perl
Phil Schaechter wrote at Thu, 24 Jul 2003 15:32:49 -0700: > Does anyone know of any performance tuning tools for perl? I'd like to > analyze my programs to see where it is spending the most time. > > If anyone has any suggesstions, I'd appreciate it. Well, the simplest tool is definitly the Benchmark module. Greetings, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
encrypt
Hi, Just say i have a perl script file as a.pl. The usage is like a.pl a abc ab where a, abc and ab is the control parameters. Is there anyway i can encrypt the file and clear the screen display so that it only display such as progressing. when i run the perl script. I mean it become something like a.unix a abc ab where a.unix is an encrypted file and a, abc and ab is the parameters Thank you & best regards, ABC
Re: matching file names starting with a dot (was: REGEX PROBLEM)
magelor wrote at Fri, 25 Jul 2003 11:09:03 +0200: > /tmp/test/.test.txt > /tmp/test/hallo.txt > /tmp/test/xyz/abc.txt > /var/log/ksy/123.log > > > now i need a regex that matches all lines but the one that contains a > filename starting with a point. like ".test.txt". how can i do that? > > this is what i have: > > '\.(?!tgz)[^.]*$' this matches everything, but tgz at the end of a > line, so > > '(?!\.)[^.]*$' should do the job, but it doesnt:( If you only want to guarantuee that the base filename doesn't start with a dot, you might try something like m!/(?!\.)\w+\.\w+$! # or m!/[^.]+\.\w+$! # or m!/[^/.]+$! The first both checks wether there is a *.* file (with no leading \.) after the last slash. The second checks whether the string ends on a sequence of no slashes and no dots what also does what you might want. However, in general I would propose to use a module to gain an easy understandable and robust solution: use File::Basename; # available in CPAN sub is_file_starting_with_dot { return basename($_[0]) =~ /^\./; } foreach ("/tmp/test/.test.txt", "/tmp/test/hallo.txt", "/tmp/test/xyz/abc.txt", "/var/log/ksy/123.log", ) { print $_, is_file_starting_with_dot($_) ? " starts with dot" : " :-) "; print "\n"; } Best Wishes, Janek PS: It's better not to shout to the reader with an uppercase subject that isn't very detailed. I would have ignored you if it wouldn't be friday :-) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
REGEX PROBLEM
hi, i have the follwing strings: /tmp/test/.test.txt /tmp/test/hallo.txt /tmp/test/xyz/abc.txt /var/log/ksy/123.log now i need a regex that matches all lines but the one that contains a filename starting with a point. like ".test.txt". how can i do that? this is what i have: '\.(?!tgz)[^.]*$' this matches everything, but tgz at the end of a line, so '(?!\.)[^.]*$' should do the job, but it doesnt:( THANK YOU:) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Kinda Perl
On Friday 25 Jul 2003 3:26 am, Wiggins d'Anconia wrote: > [EMAIL PROTECTED] wrote: > > I have been writing perl along with some other languages, and I have been > > thinking about setting up a server (so that I can play with different > > server OS's and settings without messing anything up on our home > > network). My parents think that it will cost to much in power. I was just > > wondering if anyone knows about how much it is per day to run a computer > > without a monitor. > [SNIP] > Good luck, you have stumbled on to probably the best way to learn about > computers, aka breaking them (at least the OS) > > http://danconia.org > > 1995 numbers: > http://it.erau.edu/NewsnLinks/energy_efficiency/energy_efficiency.html One thing to remember is the power management settings. Using things like (I think) hdparm, you can set time-outs for the hard drives which will probably save quite a bit. With good power management settings your server could end up using less power than your mobile phone charger (okay, stretching the point a bit there) -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
apache...
why is it that when I put something under /cgi-bin and try to acces it localhost/cgi-bin then it allways tells me that The requested URL /cgi-bin/w2h/w2h.start was not found on this server. but the file IS there.. is it because it is looking for under html so the path it is trying to locate is /html/cgi-bin? how can I fix this!!! where in the apace conf file? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
apache/cgi/script/beguinner
I am trying to run a perl cgi script for the first time... under linux redhat8. my apache works fine. localhost gives me the test page. I have this script (very usual) #! /usr/bin/perl #!/usr/local/bin/perl # hello.pl - My first CGI program print "Content-Type: text/html\n\n"; # Note there is a newline between # this header and Data # Simple HTML code follows print " \n"; print "Hello, world!"; print "\n"; print "\n"; print "Hello, world!\n"; print " \n"; I have put this file at /html and /cgi-bin as a pl file as well as a cgi file... no way.. netscape displays the text content of the file, but does not execute the script. so it is just printing the whole textual content of the file... I have chmod 755 the file.. so... what do I have to change and where... please.. if I place the script at /cgi-bin then it gives me an error msgs forbiden so? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: perl program
On Thu, 24 Jul 2003, david wrote: > Reggie Kogulan wrote: > > > Aaron, > > What I am looking is to distribute the executable only. Not the code. like > > a compiled C program will generates a.out or jar file in java. Thats all I > > am looking for. > > > > Someone earlier said to use perlcc. Which I did now. I do not see an > > executable file. > > > > example: $perlcc -o testfile test.pl > > > > Did not produce testfile at all. > > Is there something else I need to do? > > > > perlcc is experimental so don't be suprise if it doesn't work. you can > generate the c file and compile it yourself (asking for perlcc to generate > the c code might be easier then asking it to generate the binary for you). > following these steps (assuming your perl script is named script.pl): > > [panda]$ perlcc -S script.pl > [panda]$ perl -MConfig -e 'print $Config{cc}\n"' > [panda]$ perl -MExtUtils::Embed -e ccopts -e ldopts > [panda]$ gcc -o script.out script.c > [panda]$ file script.out > [panda]$ script.out > > steps: > > 1. ask perlcc to generate a script.c file from script.pl > 2. ask Config to show us what compiler is Perl itself compiled into. You > will need to use the same complier! in my box, it's a gcc > 3. Ask ExtUtil to show us what options Perl itself is compiled into. this > will print long option line so you will probably want to '> options.txt' > 4. use gcc to compile script.c into a binary script.out. ' above>' means whatever you store into options.txt in step 3. without the > options, gcc probably won't compile correctly. > 5. simply shows you that you really end up with a binary for your os > 6. runs it. > > if you are having problem compiling the c source, it's probably due to > missing headers, use the following to find out where those headers such as > EXTERN.h and perl.h are really locaed: > > [panda]$ perl -MConfig -e 'print "$Config{archlib}\n"' > > i have been using this method to generate some simply perl binaries for fun. > if that doesn't work for you, forget you ever heard perlcc. :-) > > david Thanks for the excellent guidelines.Using the above steps i can able to generate an exe file for a simple script.But at the same time i applied the above steps to a complex script fo which i got the following error message. ## /usr/bin/perlcc: multipleanalyseV5.0.pl did not compile, which can't happen: Starting compile Walking tree Prescan Saving methods ## Any directions.. Thanks, visu -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: IDE for Perl Development
I do some question but just for windows. -Original Message- From: Trevor Morrison [mailto:[EMAIL PROTECTED] Sent: Friday, July 25, 2003 4:54 AM To: [EMAIL PROTECTED] Subject: IDE for Perl Development HI, Is there any type of IDE that I can use for Perl programming (free of course) that will run both on Windows 2000 and Linux? TIA Trevor -- 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: IDE for Perl Development
That depends on what you mean by IDE. If you just want your basic syntax highlighting, etc, then vim is a pretty good one, and I know it's available on Linux and Win32. -Original Message- From: Trevor Morrison [mailto:[EMAIL PROTECTED] Sent: Thursday, July 24, 2003 7:54 PM To: [EMAIL PROTECTED] Subject: IDE for Perl Development HI, Is there any type of IDE that I can use for Perl programming (free of course) that will run both on Windows 2000 and Linux? TIA Trevor -- 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]