Weekly list FAQ posting
NAME beginners-faq - FAQ for the beginners-cgi mailing list 1 - Administriva 1.1 - I'm not subscribed - how do I subscribe? Send mail to [EMAIL PROTECTED] You can also specify your subscription email address by sending email to (assuming [EMAIL PROTECTED] is your email address): [EMAIL PROTECTED]. 1.2 - How do I unsubscribe? Now, why would you want to do that? Send mail to [EMAIL PROTECTED], and wait for a response. Once you reply to the response, you'll be unsubscribed. If that doesn't work, find the email address which you are subscribed from and send an email like the following (let's assume your email is [EMAIL PROTECTED]): [EMAIL PROTECTED] 1.3 - There is too much traffic on this list. Is there a digest? Yes. To subscribe to the digest version of this list send an email to: [EMAIL PROTECTED] To unsubscribe from the digest, send an email to: [EMAIL PROTECTED] 1.4 - Is there an archive on the web? Yes, there is. It is located at: http://archive.develooper.com/beginners-cgi%40perl.org/ 1.5 - How can I get this FAQ? This document will be emailed to the list once a month, and will be available online in the archives, and at http://beginners.perl.org/ 1.6 - I don't see something in the FAQ, how can I make a suggestion? Send an email to [EMAIL PROTECTED] with your suggestion. 1.7 - Is there a supporting website for this list? Yes, there is. It is located at: http://beginners.perl.org/ 1.8 - Who owns this list? Who do I complain to? Casey West owns the beginners-cgi list. You can contact him at [EMAIL PROTECTED] 1.9 - Who currently maintains the FAQ? Kevin Meltzer, who can be reached at the email address (for FAQ suggestions only) in question 1.6 1.10 - Who will maintain peace and flow on the list? Casey West, Kevin Meltzer and Ask Bjoern Hansen currently carry large, yet padded, clue-sticks to maintain peace and order on the list. If you are privately emailed by one of these folks for flaming, being off-topic, etc... please listen to what they say. If you see a message sent to the list by one of these people saying that a thread is closed, do not continue to post to the list on that thread! If you do, you will not only meet face to face with a XQJ-37 nuclear powered pansexual roto-plooker, but you may also be taken off of the list. These people simply want to make sure the list stays topical, and above-all, useful to Perl/CGI beginners. 1.11 - When was this FAQ last updated? Sept 07, 2001 2 - Questions about the 'beginners-cgi' list. 2.1 - What is the list for? A list for beginning Perl programmers to ask questions in a friendly atmosphere. The topic of the list is, of course, CGI with Perl. 2.2 - What is this list _not_ for? * SPAM * Homework * Solicitation * Things that aren't Perl related * Non Perl/CGI questions or issues * Lemurs 2.3 - Are there any rules? Yes. As with most communities, there are rules. Not many, and ones that shouldn't need to be mentioned, but they are. * Be nice * No flaming * Have fun 2.4 - What topics are allowed on this list? Basically, if it has to do with Perl/CGI , then it is allowed. If your question has nothing at all to do with Perl/CGI, it will likely be ignored. 2.5 - I want to help, what should I do? Subscribe to the list! If you see a question which you can give an idiomatic and Good answer to, answer away! If you do not know the answer, wait for someone to answer, and learn a little. 2.6 - Is there anything I should keep in mind while answering? We don't want to see 'RTFM'. That isn't very helpful. Instead, guide the beginner to the place in the FM they should R :) 2.7 - I don't want to post a question if it is in an FAQ. Where should I look first? Look in the FAQ! Get acquainted with the 'perldoc' utility, and use it. It can save everyone time if you look in the Perl FAQs first, instead of having a list of people refer you to the Perl FAQs :) You can learn about 'perldoc' by typing: perldoc perldoc At your command prompt. You can also view documentation online at: http://www.perldoc.com and http://www.perl.com 3 - Other Resources 3.1 - What other websites may be useful to a beginner ? * Perl Home Page - http://www.perl.com * PerlMonks - http://www.perlmonks.org * Perldoc - http://www.perldoc.com * Perl Archives - http://www.perlarchives.com 3.2 - What resources may be harmful to a beginner? Beware of Perl4-like code-- You might find some script archives and unauthorized mirrors with old Perl4 versions of Selena Sol and Matt Wright scripts. Don't use those scripts. They are outdated and may even in some cases contain bugs or security problems since many may not have been updated in years. Instead,
Re: Win32::SerialPort to log file
drieux wrote: On Dec 12, 2003, at 7:06 PM, [EMAIL PROTECTED] wrote: I'm trying to get a script to save a barcode scanner's output to a log file. [..] do you mean that you are using http://search.cpan.org/~bbirth/Win32-SerialPort-0.19/lib/Win32/ SerialPort.pm use Win32::SerialPort; # use strict; use warnings; [..] you might want to uncomment the use strict. $LOGDIR= 'c:\perl\scripts'; # path to data file $LOGFILE = router.log;# file name to output to $PORT = COM2; # port to watch [ cutting out a prior effort to new the widget ] # # open the logfile, and Port # open(LOG,${LOGDIR}/${LOGFILE}) ||die can't open smdr file $LOGDIR/$LOGFILE for append:\n; then deal with the problem here: $ob = tie (*BIFF, 'Win32::SerialPort') || die Can't tie: $^E\n; $PortObj = tie (*FH, 'Win32::SerialPort', $Configuration_File_Name) || die Can't tie: $^E\n;## TIEHANDLE ## from the pod would seem to suggest that you would want to have a configuration file??? select(LOG), $| = 1; # set nonbufferd mode # # Loop forver, logging data to the log file # while($_ = BIFF){# print input device to file print LOG $_; } [..] you could do this logging part as print LOG $_ while(BIFF); which will just woof what ever you got from the bar_code Reader. HTH... ciao drieux Thanks! Yes, that's the module I'm using. I don't know why I was thinking I didn't need the config file I if I set the port settings in the script. After saving a config file I was able to get the script to run without errors (with strict uncommented). It runs quickly and finishes w/o saving anything in the log file but I think that's because at the moment it runs, there isn't anything coming in COM2. I didn't get a chance to play with it too much though. Thanks again, Ron -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Split question
R. Joseph Newton wrote: Joel Newkirk wrote: Well, actually they don't, since the 'bare' # will be interpreted as starting a comment, while the one in quotes won't... ;^) The op's assignment was assigning 'split(/' to @temp... Did you test. Did YOU test? The only problem I see with John's code is that it addumes that the print statement will print a newline, There is no such assumption, I explicitly told perl to print a newline. which it doesn't [at least on my installation of V5.8]. On the main point, he is right. Greetings! E:\d_drive\perlStuff\giffyperl -w How is this supposed to run on the command line without -e ? @temp = split(/#/, abc#def#ghi#jkl); print $_\n for @temp; ^Z abc def ghi jkl Here is a little quiz for you beginners out there. split() treats its first argument as a regular expression. There are TWO exceptions where the first argument does not behave the same as a normal regular expression. What are they? John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Getting the most recent file
That -M is a perl file test operator, it will take the string after it as name of a file automatically. Tor. Paul Harwood wrote: One question I have: With this statement: @files = sort { -M $a = -M $b } @files; How does Perl understand that these are files and not just text entries? Did using the readdir beforehand make this possible? -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Posted At: Saturday, December 13, 2003 6:27 AM Posted To: Perl Conversation: Getting the most recent file Subject: Re: Getting the most recent file [EMAIL PROTECTED] wrote: I am trying to write some code to read the most recent log file in a directory. I wrote some code below. This works but I was wondering if there was a more efficient method to do this. Ideally I would like to include hours, minutes and seconds but that's not necessary at this point. foreach $iislog (@files) { ($WRITETIME) = (stat($iislogs\\$iislog))[9]; print scalar localtime ($WRITETIME); ($seconds, $minutes, $hours, $day, $month, $year, $wday, $yday, $isdst) = localtime(); ($seconds2, $minutes2, $hours2, $day2, $month2, $year2, $wday2, $yday2, $isdst2) = localtime($WRITETIME); if ($day == $day2 $month == $month2) { print \n\n; print The file was last modified on: ; print scalar localtime ($WRITETIME); print \n\n; } } Hi Paul. First of all, use strict; # And declare all of your variables use warnings; # And indent your code! Then I'm not sure what you need. You say you want to read the most recent log file, but your code just prints out a list of modification times. Do you need this as well,or do you just want to find the latest file? (stat $file)[9] gives you the modification date, while -M $file gives you the age of the file. So you could just write @files = sort { -M $a = -M $b } @files; print $files[-1], \n; Or do you need anything more? HTH, Rob -- !- Victor Development Engineer Outblaze Ltd -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: list problem
On December 14, 2003 03:09 pm, John W. Krahn wrote: Fred Nastos wrote: On December 14, 2003 01:21 pm, km wrote: How about the old-fashioned way? for ($i=1; $i=10) { print $i, \n; $i = $i + 3; } That produces a syntax error, it won't run. Really!? Opps. Yes, I made a typo. I forgot a semi-colon (next time I will cut-and-paste!). The following should work: #!/usr/bin/perl -w for ($i=1; $i=10;) { print $i, \n; $i = $i + 3; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Split question
On Sun, 2003-12-14 at 18:11, Joel Newkirk wrote: The first argument to split is converted to a regular expression and the '#' character is not special in a regular expression so split/#/ and split'\#' do exactly the same thing. Well, actually they don't, since the 'bare' # will be interpreted as starting a comment, while the one in quotes won't... ;^) The op's assignment was assigning 'split(/' to @temp... Doh, please disregard - just seconds after pressing Send I realized my mistake... j --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
advanced diff in Perl
Hello, is there any library/utility which can help me to compare 2 different config files (eg. Apache, PHP)? I'd like to see _only_ parameters which are missing either in config_file1 or config_file2 and those parameters which are different. Standard diff can not make this. (comments,white chars...) Enhanced diff: 1.replace comments (awk/sed) 2.sort lines 3.diff -b is better but still not sufficient because some parameters are multi-lined: myparam = This is my \ long setting and some of them are within specific context: mydir1 mysetting = 1 /mydir1 mydir2 mysetting = 2 /mydir2 -- Best regards, Dusan Juhas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
pass vars to sub via TK/Button
Greetings, I'd like to know how to pass variables fetched by TK/entry to a subroutine by using a Button. The Button/-command line in the following script is obviously wrong, but should suffice to illustrate what I want it to do. I'd be happy if someone could tell me how to do this properly. --- #! /usr/bin/perl -w use strict; use Tk; my $main = MainWindow-new; my $var1 = $main - Entry( -width = 30 ); $var1 - pack; my $var2 = $main - Entry( -width = 30 ); $var2 - pack; $main - Button ( -text = 'Add', -command = \add_item($var1, $var2) # ^^ ) - pack; MainLoop; sub add_item { print Added @_\n; } --- Best regards, oliver. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: pass vars to sub via TK/Button
Here is how I do it $mw-Button (-text=run, -command= sub {test($rb_val,$bonobo,$oracleid)})-place(-x=320, -y=250 ,-width=75); Laurent coudeur Oliver Schaedlich [EMAIL PROTECTED] 15/12/2003 11:27 Please respond to Oliver Schaedlich To: [EMAIL PROTECTED] cc: Subject:pass vars to sub via TK/Button Greetings, I'd like to know how to pass variables fetched by TK/entry to a subroutine by using a Button. The Button/-command line in the following script is obviously wrong, but should suffice to illustrate what I want it to do. I'd be happy if someone could tell me how to do this properly. --- #! /usr/bin/perl -w use strict; use Tk; my $main = MainWindow-new; my $var1 = $main - Entry( -width = 30 ); $var1 - pack; my $var2 = $main - Entry( -width = 30 ); $var2 - pack; $main - Button ( -text = 'Add', -command = \add_item($var1, $var2) # ^^ ) - pack; MainLoop; sub add_item { print Added @_\n; } --- Best regards, oliver. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: pass vars to sub via TK/Button
Greetings, 15.12.2003, [EMAIL PROTECTED] wrote: $mw-Button (-text=run, -command= sub {test($rb_val,$bonobo,$oracleid)}) -place(-x=320,-y=250 ,-width=75); thanks for your reply. I tried to adapt to your example: $main-Button ( -text = 'Add', -command = sub { add_item($var1, $var2) } ) - pack; but the output add_item delivers looks more like hash references than the content of aforementioned variables: Added Tk::Entry=HASH(0x1c1956c) Tk::Entry=HASH(0x1c1e3a8) Is it possible to pass simple variables via Entry/Button in the first place, and if, how? Best regards, oliver. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: pass vars to sub via TK/Button
not to sure what your problem is so Here is How I get the variables back sub test{ my $type=$_[0]; #$rb_val my $number=$_[2]; #$bonobo my $path1=$_[1];#$oracleid (these are string but I use the same process) Laurent coudeur Oliver Schaedlich [EMAIL PROTECTED] 15/12/2003 12:41 Please respond to Oliver Schaedlich To: [EMAIL PROTECTED] cc: Subject:Re: pass vars to sub via TK/Button Greetings, 15.12.2003, [EMAIL PROTECTED] wrote: $mw-Button (-text=run, -command= sub {test($rb_val,$bonobo,$oracleid)}) -place(-x=320,-y=250 ,-width=75); thanks for your reply. I tried to adapt to your example: $main-Button ( -text = 'Add', -command = sub { add_item($var1, $var2) } ) - pack; but the output add_item delivers looks more like hash references than the content of aforementioned variables: Added Tk::Entry=HASH(0x1c1956c) Tk::Entry=HASH(0x1c1e3a8) Is it possible to pass simple variables via Entry/Button in the first place, and if, how? Best regards, oliver. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Split question
John W. Krahn wrote: R. Joseph Newton wrote: Joel Newkirk wrote: Well, actually they don't, since the 'bare' # will be interpreted as starting a comment, while the one in quotes won't... ;^) The op's assignment was assigning 'split(/' to @temp... Did you test. Did YOU test? The code as it is? Nope. Knew the likely result: Greetings! E:\d_drive\perlStuff\JPEGperl -le' Can't find string terminator ' anywhere before EOF at -e line 1. The only problem I see with John's code is that it addumes that the print statement will print a newline, There is no such assumption, I explicitly told perl to print a newline. I see: [portable--semi, anyway, takes ^D to finish in 'nix] Greetings! E:\d_drive\perlStuff\JPEGperl -l @temp = split(/#/, abc#def#ghi#jkl); print for @temp; ^Z abc def ghi jkl which it doesn't [at least on my installation of V5.8]. On the main point, he is right. Greetings! E:\d_drive\perlStuff\giffyperl -w How is this supposed to run on the command line without -e ? Wasn't. Runs in the Perl interpreter. That way, I'm not struggling to cram disparate concepts into one line. Greetings! E:\d_drive\perlStuff\giffyperl -w @temp = split(/#/, abc#def#ghi#jkl); print $_\n for @temp; ^Z #^D for 'nix abc def ghi jkl Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Split question
On Monday, December 15, 2003 03:05, John W. Krahn wrote: Here is a little quiz for you beginners out there. split() treats its first argument as a regular expression. There are TWO exceptions where the first argument does not behave the same as a normal regular expression. What are they? The first one that comes to mind is using // for your search. Rather than repeating the last search, it searches for the null string to split on. The second one is if you include parentheses in your regex. If you put parentheses around your regex, then split will create entries for each of the matched terms in addition to the just the splitted items. So, do I win a prize or something? :) Alan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Split question
On Monday, December 15, 2003 03:05, John W. Krahn wrote: Here is a little quiz for you beginners out there. split() treats its first argument as a regular expression. There are TWO exceptions where the first argument does not behave the same as a normal regular expression. What are they? The first one that comes to mind is using // for your search. Rather than repeating the last search, it searches for the null string to split on. The second one is if you include parentheses in your regex. If you put parentheses around your regex, then split will create entries for each of the matched terms in addition to the just the splitted items. So, do I win a prize or something? :) But parentheses are normal in a regex, though granted the return is odd. I would guess as the second the special case where ' ' is passed and the string is split on whitespace which is not interesting, but where leading space is skipped? http://danconia.org -- Boycott the Sugar Bowl! You couldn't pay me to watch that game. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
How do you build your HTML?
Hello everyone, I've been hand coding HTML for some time now, but recently a lazy streak has run through me and I'd like to find a way to autogenerate creation of a lot of my HTML. Thing is, I'd also like it to be HTML 4.01 compliant. I'd rather not go the CGI.pm route as I am generating static pieces of HTML for use in HTML::Mason pages. A table here, a link there, and so forth, in the end it seems that I can never catch all the errors for HTML 4.01 compliance. I've tried all the linux HTML editors and none of them come close to what I need. Bluefish for instance even generates some HTML that Mozilla won't even interpret. Thoughts, suggestions? Thanks, Kevin -- Kevin Old [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Parentheses
On Dec 14, 2003, at 9:20 AM, Rob Dixon wrote: Steve Grazzini wrote: Actually, $_ isn't localized by 'while()': % echo test | perl -le 'for (const) { print while }' Modification of a read-only value attempted at -e line 1. Which occasionally jumps up and bites people. Thanks for that Steve. I guess if you think about it then, since it's equivalent to the awful while (defined($_ = )) { : } it's actually not a loop control variable at all, but an explicit assignment to $_. That's right. On the other hand, since the implicit assignment only happens when readline() is the condition of a while() loop or statement modifier, I'm not sure why it couldn't be equivalent to: while (defined(local $_ = )) { ... } Or, following the example of foreach(): { local $_; # sort of while (defined($_ = ) { ... } } And for the trivia buffs: another interesting thing about the special package variables (it's the globs/symbols that are actually special, see below) is that they're always in package main. % perl -le '{ package X; $inc++ } print [$inc]' [] % perl -le '{ package X; $INC++ } print [$INC]' 1 Yes, but what I find most surprising is that $INC is $main::INC even though @INC and %INC are special variables but $INC isn't :) Yeah -- the forcing-into-main:: applies to the whole glob (the symbol table entry) and not just the system variable itself. The same odd thing applies to $STDIN, %ARGV, etc. *INC is especially noteworthy, though, because in order to push @INC, $object; $object needs to have an INC() method, and the symbol-table lookup in a subroutine definition *also* forces *INC into package main::. package Foo; sub INC { # this is main::INC ! } Which has probably irritated somebody somewhere. -- Steve (*raising his own hand*) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Server Errors
I've got the below script saved on my server - but every time I use it I get an Internel Server Error! I've set the permission to 755 but still no luck. Any ideas folks? www.klconsulting.co.uk/cgi-bin/cssc.pl #!/usr/bin/perl use Net::Ping; @host_array = (192.153.1.10,192.153.0.18,212.241.168.197,212.241.168.138,212. 241.167.11,194.153.21.68,194.153.20.100,194.153.20.51,194.153.20 .52,194.153.20.53,515.35.226.5,212.241.160.12,194.153.1.19,194 .153.1.18,212.35.224.125,212.35.224.126); $p = Net::Ping-new(icmp); $p-bind($my_addr); foreach $host (@host_array) { print $host is ; print NOT unless $p-ping($host, 2); print reachable.\n; sleep(1); } $p-close(); W. A. Khushil Dep Technical Support Agent PIPEX Communications Plc Phone : 0845 077 83 24 Fax: 08702 434440 WWW: www.pipex.net/support The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. Although PIPEX Internet Limited operates anti-virus programs, it does not accept responsibility for any damage whatsoever that is caused by viruses being passed. If you suspect that the message may have been intercepted or amended, please call the sender. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of zentara Sent: 15 December 2003 15:16 To: [EMAIL PROTECTED] Subject: Re: pass vars to sub via TK/Button On Mon, 15 Dec 2003 12:27:34 +0100, [EMAIL PROTECTED] (Oliver Schaedlich) wrote: Greetings, I'd like to know how to pass variables fetched by TK/entry to a subroutine by using a Button. The Button/-command line in the following script is obviously wrong, but should suffice to illustrate what I want it to do. I'd be happy if someone could tell me how to do this properly. #!/usr/bin/perl use strict; use Tk; my $main = MainWindow-new; my $var1 = $main - Entry( -width = 30 ); $var1 - pack; my $var2 = $main - Entry( -width = 30 ); $var2 - pack; $main - Button ( -text = 'Add', -command = sub{\add_item($var1,$var2)} ) - pack; MainLoop; sub add_item { my (@widgets) = @_; print @widgets\n; my $entry1 = $_[0]-get(); my $entry2 = $_[1]-get(); print Added-$entry1 + $entry2 = ,$entry1+$entry2,\n; return; } __END__ -- When life conspires against you, and no longer floats your boat, Don't waste your time with crying, just get on your back and float. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: advanced diff in Perl
The Config::General module can read Apache-style config files. You should then be able to compare the contents of the files by comparing the hash tables returned by Config::General. Luke -Original Message- From: Dusan Juhas [mailto:[EMAIL PROTECTED] Sent: Mon 12/15/2003 2:09 AM To: [EMAIL PROTECTED] Cc: Subject: advanced diff in Perl Hello, is there any library/utility which can help me to compare 2 different config files (eg. Apache, PHP)? I'd like to see _only_ parameters which are missing either in config_file1 or config_file2 and those parameters which are different. Standard diff can not make this. (comments,white chars...) Enhanced diff: 1.replace comments (awk/sed) 2.sort lines 3.diff -b is better but still not sufficient because some parameters are multi-lined: myparam = This is my \ long setting and some of them are within specific context: mydir1 mysetting = 1 /mydir1 mydir2 mysetting = 2 /mydir2 -- Best regards, Dusan Juhas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Server Errors
Your script is erroring out for some reason, and it might be because you never defined $my_addr. $p-bind($my_addr) Sets the source address from which pings will be sent. This must be the address of one of the interfaces on the local host. $my_addr may be specified as a hostname or as a text IP address such as 192.168.1.1. Try the above, and if that doesn't work, run the script from the command line and copy and paste the error message you get. Also, you may want to add this line somewhere near the top of your script since you are running it as a CGI: Print Content-type: text/plain\n\n; Steven Kreuzer Linux Systems Administrator Etagon, Inc W: 646.728.0656 F: 646.728.0607 E: [EMAIL PROTECTED] -Original Message- From: Mr. W. A. Khushil Dep [mailto:[EMAIL PROTECTED] Sent: Monday, December 15, 2003 10:35 AM To: [EMAIL PROTECTED] Subject: Server Errors I've got the below script saved on my server - but every time I use it I get an Internel Server Error! I've set the permission to 755 but still no luck. Any ideas folks? www.klconsulting.co.uk/cgi-bin/cssc.pl #!/usr/bin/perl use Net::Ping; @host_array = (192.153.1.10,192.153.0.18,212.241.168.197,212.241.168.138,212. 241.167.11,194.153.21.68,194.153.20.100,194.153.20.51,194.153.20 .52,194.153.20.53,515.35.226.5,212.241.160.12,194.153.1.19,194 .153.1.18,212.35.224.125,212.35.224.126); $p = Net::Ping-new(icmp); $p-bind($my_addr); foreach $host (@host_array) { print $host is ; print NOT unless $p-ping($host, 2); print reachable.\n; sleep(1); } $p-close(); W. A. Khushil Dep Technical Support Agent PIPEX Communications Plc Phone : 0845 077 83 24 Fax: 08702 434440 WWW: www.pipex.net/support The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. Although PIPEX Internet Limited operates anti-virus programs, it does not accept responsibility for any damage whatsoever that is caused by viruses being passed. If you suspect that the message may have been intercepted or amended, please call the sender. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of zentara Sent: 15 December 2003 15:16 To: [EMAIL PROTECTED] Subject: Re: pass vars to sub via TK/Button On Mon, 15 Dec 2003 12:27:34 +0100, [EMAIL PROTECTED] (Oliver Schaedlich) wrote: Greetings, I'd like to know how to pass variables fetched by TK/entry to a subroutine by using a Button. The Button/-command line in the following script is obviously wrong, but should suffice to illustrate what I want it to do. I'd be happy if someone could tell me how to do this properly. #!/usr/bin/perl use strict; use Tk; my $main = MainWindow-new; my $var1 = $main - Entry( -width = 30 ); $var1 - pack; my $var2 = $main - Entry( -width = 30 ); $var2 - pack; $main - Button ( -text = 'Add', -command = sub{\add_item($var1,$var2)} ) - pack; MainLoop; sub add_item { my (@widgets) = @_; print @widgets\n; my $entry1 = $_[0]-get(); my $entry2 = $_[1]-get(); print Added-$entry1 + $entry2 = ,$entry1+$entry2,\n; return; } __END__ -- When life conspires against you, and no longer floats your boat, Don't waste your time with crying, just get on your back and float. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Get Terminal Width and Height, Pure Perl
Okay, I have a terminal program I need to get the width and height for. I have a very good reason needing to do it with a base 5.8 Perl install, if at all possible. Unfortunately, that rules out the super easy Term::ReadKey CPAN module. (Side note: I do have Term::ReadKey installed and am very aware of how wonderful it is. In fact, why isn't this a standard module??? I just can't count on it being on the box this program will be run on. I'll fight that fight if I have to, but first I thought I would check for another option.) So my question is, is there a Pure Perl way to fetch the terminal columns and rows? Thanks. James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Weekly list FAQ posting
NAME beginners-faq - FAQ for the beginners mailing list 1 - Administriva 1.1 - I'm not subscribed - how do I subscribe? Send mail to [EMAIL PROTECTED] You can also specify your subscription email address by sending email to (assuming [EMAIL PROTECTED] is your email address): [EMAIL PROTECTED]. 1.2 - How do I unsubscribe? Now, why would you want to do that? Send mail to [EMAIL PROTECTED], and wait for a response. Once you reply to the response, you'll be unsubscribed. If that doesn't work, find the email address which you are subscribed from and send an email like the following (let's assume your email is [EMAIL PROTECTED]): [EMAIL PROTECTED] 1.3 - There is too much traffic on this list. Is there a digest? Yes. To subscribe to the digest version of this list send an email to: [EMAIL PROTECTED] To unsubscribe from the digest, send an email to: [EMAIL PROTECTED] This is a high traffic list (100+ messages per day), so please subscribe in the way which is best for you. 1.4 - Is there an archive on the web? Yes, there is. It is located at: http://archive.develooper.com/beginners%40perl.org/ 1.5 - How can I get this FAQ? This document will be emailed to the list once a week, and will be available online in the archives, and at http://learn.perl.org/ 1.6 - I don't see something in the FAQ, how can I make a suggestion? Send an email to [EMAIL PROTECTED] with your suggestion. 1.7 - Is there a supporting website for this list? Yes, there is. It is located at: http://beginners.perl.org/ 1.8 - Who owns this list? Who do I complain to? Casey West owns the beginners list. You can contact him at [EMAIL PROTECTED] 1.9 - Who currently maintains the FAQ? Kevin Meltzer, who can be reached at the email address (for FAQ suggestions only) in question 1.6 1.10 - Who will maintain peace and flow on the list? Casey West, Kevin Meltzer and Ask Bjoern Hansen currently carry large, yet padded, clue-sticks to maintain peace and order on the list. If you are privately emailed by one of these folks for flaming, being off-topic, etc... please listen to what they say. If you see a message sent to the list by one of these people saying that a thread is closed, do not continue to post to the list on that thread! If you do, you will not only meet face to face with a XQJ-37 nuclear powered pansexual roto-plooker, but you may also be taken off of the list. These people simply want to make sure the list stays topical, and above-all, useful to Perl beginners. 1.11 - When was this FAQ last updated? Sept 07, 2001 2 - Questions about the 'beginners' list. 2.1 - What is the list for? A list for beginning Perl programmers to ask questions in a friendly atmosphere. 2.2 - What is this list _not_ for? * SPAM * Homework * Solicitation * Things that aren't Perl related * Monkeys * Monkeys solicitating homework on non-Perl related SPAM. 2.3 - Are there any rules? Yes. As with most communities, there are rules. Not many, and ones that shouldn't need to be mentioned, but they are. * Be nice * No flaming * Have fun 2.4 - What topics are allowed on this list? Basically, if it has to do with Perl, then it is allowed. You can ask CGI, networking, syntax, style, etc... types of questions. If your question has nothing at all to do with Perl, it will likely be ignored. If it has anything to do with Perl, it will likely be answered. 2.5 - I want to help, what should I do? Subscribe to the list! If you see a question which you can give an idiomatic and Good answer to, answer away! If you do not know the answer, wait for someone to answer, and learn a little. 2.6 - Is there anything I should keep in mind while answering? We don't want to see 'RTFM'. That isn't very helpful. Instead, guide the beginner to the place in the FM they should R :) Please do not quote the documentation unless you have something to add to it. It is better to direct someone to the documentation so they hopefully will read documentation above and beyond that which answers their question. It also helps teach them how to use the documentation. 2.7 - I don't want to post a question if it is in an FAQ. Where should I look first? Look in the FAQ! Get acquainted with the 'perldoc' utility, and use it. It can save everyone time if you look in the Perl FAQs first, instead of having a list of people refer you to the Perl FAQs :) You can learn about 'perldoc' by typing: perldoc perldoc At your command prompt. You can also view documentation online at: http://www.perldoc.com and http://www.perl.com 2.8 Is this a high traffic list? YES! You have been warned! If you don't want to get ~100 emails per day from this list, consider subscribing to
RE: Get Terminal Width and Height, Pure Perl
James Edward Gray II [EMAIL PROTECTED] wrote: : : So my question is, is there a Pure Perl way to fetch : the terminal columns and rows? I took a look at the source of Term::ReadKey and it seemed to be pure perl. Are you sure it's not? If it is, you could use it as a guide to write your own sub. Or, if you're allowed to install multiple files, you could include this module in your package. HTH, Charles K. Clarkson -- Head Bottle Washer, Clarkson Energy Homes, Inc. Mobile Home Specialists 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Win32::SerialPort to log file
On Dec 15, 2003, at 12:23 AM, Ron Willmert wrote: drieux wrote: [..] do you mean that you are using http://search.cpan.org/~bbirth/Win32-SerialPort-0.19/lib/Win32/ SerialPort.pm [..] Thanks! you are more than welcome. You will of course forgive the brief 'evil Homer Simpson moment' Yes, that's the module I'm using. I don't know why I was thinking I didn't need the config file I if I set the port settings in the script. evilHomerSimpsonMoment As I explained to one of my young coders who wanted to learn java, if she does not code in java, you do not need to talk to her... Ultimately we would lose him to her, since she had other skills than java This could be a vector of mentalMomenting... Always Remember which head you are thinking with, especially when coding /evilHomerSimpsonMoment 8-) After saving a config file I was able to get the script to run without errors (with strict uncommented). It runs quickly and finishes w/o saving anything in the log file but I think that's because at the moment it runs, there isn't anything coming in COM2. I didn't get a chance to play with it too much though. p0: what I know about the Win32::SerialPort stuff I learned from reading the POD, not from actually coding it. Hence I could look at your code and ask questions based upon merely the comparison with what it said, and what you were doing. A part of why we push 'the POD', as well 'use strict' and 'use warnings' as a core part of the issue. p1: Given the level of complexity of what the Module can do, you really might want to work out IF your original plan wasn't the better solution. Since it would allow you to have better control over that 'configuration file' inside your perl code - but WOULD require that you get away from the simpler tie() approach and with it the simplistic print LOG $_ while(BIFF); since you will ultimately need a real 'polling loop' that will check to see if the Port is Ready, and that one has read as much stuff as it is willing to give you. ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Split question
Wiggins d Anconia [EMAIL PROTECTED] wrote: : : On Monday, December 15, 2003 03:05, John W. Krahn wrote: : : Here is a little quiz for you *BEGINNERS* out there. [emphasis added] : : But parentheses are normal in a regex, though granted the : return is odd. I would guess as the second the special case : where ' ' is passed and the string is split on whitespace : which is not interesting, but where leading space is : skipped? Wait a minute. You're a beginner?!? :) Charles K. Clarkson -- Head Bottle Washer, Clarkson Energy Homes, Inc. Mobile Home Specialists 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Get Terminal Width and Height, Pure Perl
On Dec 15, 2003, at 10:51 AM, Charles K. Clarkson wrote: James Edward Gray II [EMAIL PROTECTED] wrote: : : So my question is, is there a Pure Perl way to fetch : the terminal columns and rows? I took a look at the source of Term::ReadKey and it seemed to be pure perl. Are you sure it's not? Haven't got a clue, to tell the truth! laughs I assumed it was not, for two reasons. One, the POD says, Term::ReadKey is a compiled perl module... and that ugly compiled word in there scared me. And two, I can't see where the function calls at the beginning of GetTerminalSize() are coming from (termsizeoptions(), GetTermSizeVIO(), GetTermSizeGWINSZ(), GetTermSizeGSIZE(), GetTermSizeWin32()). I also just had the thought to go check the CPAN's listing. It said 'Rdcf?' under the DSLIP column. I'm pretty sure that middle 'c' in there means it's written in C and Perl. I know how dangerous assumptions are though, especially mine, and I won't be surprised if I'm wrong. If it is, you could use it as a guide to write your own sub. Or, if you're allowed to install multiple files, you could include this module in your package. I did try to look at the module, but as you can see, I can't tell what it's doing. Finally, I can only use the include it trick if it is indeed pure Perl, right? Thanks for all the good ideas. I did try them. James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Get Terminal Width and Height, Pure Perl
James Edward Gray II wrote: On Dec 15, 2003, at 10:51 AM, Charles K. Clarkson wrote: James Edward Gray II [EMAIL PROTECTED] wrote: So my question is, is there a Pure Perl way to fetch the terminal columns and rows? I took a look at the source of Term::ReadKey and it seemed to be pure perl. Are you sure it's not? Haven't got a clue, to tell the truth! laughs I assumed it was not, for two reasons. One, the POD says, Term::ReadKey is a compiled perl module... and that ugly compiled word in there scared me. And two, I can't see where the function calls at the beginning of GetTerminalSize() are coming from (termsizeoptions(), GetTermSizeVIO(), GetTermSizeGWINSZ(), GetTermSizeGSIZE(), GetTermSizeWin32()). I also just had the thought to go check the CPAN's listing. It said 'Rdcf?' under the DSLIP column. I'm pretty sure that middle 'c' in there means it's written in C and Perl. I know how dangerous assumptions are though, especially mine, and I won't be surprised if I'm wrong. You're right, it's not a pure perl module. The bootstrap statement around line 240 gives it away as well. If it is, you could use it as a guide to write your own sub. Or, if you're allowed to install multiple files, you could include this module in your package. I did try to look at the module, but as you can see, I can't tell what it's doing. It's trying to make the process platform-independent, which is rather tricky. You might be able to get away with something as simple as querying the LINES and COLUMNS environment variables. Or use the output from 'tput lines' and 'tput columns'. It all depends on your platform... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: How do you build your HTML?
On Dec 15, 2003, at 7:57 AM, Kevin Old wrote: [..] I've been hand coding HTML for some time now, but recently a lazy streak has run through me and I'd like to find a way to autogenerate creation of a lot of my HTML. Thing is, I'd also like it to be HTML 4.01 compliant. I'd rather not go the CGI.pm route as I am generating static pieces of HTML for use in HTML::Mason pages. A table here, a link there, and so forth, in the end it seems that I can never catch all the errors for HTML 4.01 compliance. [..] Kevin, it shoulds like you have mutually conflicting goals here. On the one hand you want to 'automate' a process of creating 'static pages' - hence there are three basic steps: select a template of a basic html page edit the template as a new page post the new page on the web site Now bear with me, this is gonna sound a bit dopey, but it is based upon what I have done, prior to turning over most of this to bbedit. make a directory with the basic pages each is named by what it templates blog.tmpl table.tmpl have your application either take a 'template' name cf Getopts::Long or walk the dirBlock of the template directory with opendir() and readdir() present the list to the user, get the choice back copy the template to say /tmp invoke $EDITOR on it with system() then have it ftp it up to the web-site Or do you want it to also validate that you have not injected brainSillies into the html as well? ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Get Terminal Width and Height, Pure Perl
You might be able to get away with something as simple as querying the LINES and COLUMNS environment variables. Or use the output from 'tput lines' and 'tput columns'. It all depends on your platform... Actually, its tput cols Steven Kreuzer Linux Systems Administrator Etagon, Inc W: 646.728.0656 F: 646.728.0607 E: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
a doubt
Hi, How can i catch the difference in 2 files on a perl stmt? I want to do somethign like, if (there is some diff in 2 files) do something1 else do something2 Both files are simple text files TIA -Ajey -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Server Errors
Mr. W. A. Khushil Dep wrote: I've got the below script saved on my server - but every time I use it I get an Internel Server Error! I've set the permission to 755 but still no luck. Any ideas folks? www.klconsulting.co.uk/cgi-bin/cssc.pl #!/usr/bin/perl use Net::Ping; @host_array = (192.153.1.10,192.153.0.18,212.241.168.197,212.241.168.138,212. 241.167.11,194.153.21.68,194.153.20.100,194.153.20.51,194.153.20 .52,194.153.20.53,515.35.226.5,212.241.160.12,194.153.1.19,194 .153.1.18,212.35.224.125,212.35.224.126); $p = Net::Ping-new(icmp); You can't use ICMP unless you are running as root. Use UDP or TCP instead. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: a doubt
Ajey wrote: Hi, Hello, How can i catch the difference in 2 files on a perl stmt? I want to do somethign like, if (there is some diff in 2 files) do something1 else do something2 Both files are simple text files use File::Compare; if ( compare( 'file1', 'file2' ) == 0 ) { print They are the same\n; } else { # do something else } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Recommended simple Perl IDE/Editors ?
Hi all: Just wondering what IDE/editor folks use for their Perl work ? I'm looking for something for a W2K system that is easy to use (without customization) and that has the basics (syntax highlighting, visual debugging, something that shows variable values, the values in whitespace, etc) without a lot of bell whistles. I plan to look at: ActiveState Komodo 2.5 PerlEdit OpenPerl IDE Any recommendation, or feedback on the above IDE's would be appreciated. Thanks.
Re: a doubt
Too good. thanks John. On Mon, 15 Dec 2003, John W. Krahn wrote: Ajey wrote: Hi, Hello, How can i catch the difference in 2 files on a perl stmt? I want to do somethign like, if (there is some diff in 2 files) do something1 else do something2 Both files are simple text files use File::Compare; if ( compare( 'file1', 'file2' ) == 0 ) { print They are the same\n; } else { # do something else } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: How do you build your HTML?
Hi Kevin and everyone, I recommend http://www.template-toolkit.org/. Just print out the documentation so it's on hand and your guarenteed on you way to creating some cool ass stuff. Basically it's embedded perl inside HTMLbut you if you reverse it and call it from within a perl cgi module with apache-mod_perl and you can pre-fetch all the html and necessary data (generated images...etc) requested and cache it all or send it to the browser on the fly...etc. Check out www.einsteinspub.com for my only web-project.it's taken about 4 months of hard work to get it this far..but it's awsome IMHO! 100% (well you know what i mean) made by me. Coded in Perl and i use strict; use warnings; use Template; use CGI; use GD; use Image::GD::Thumbnail; as dependencies only other than the mysql backend. All the navigation menus are automatically generated on the fly and cached. Just FYI; hope it's what you were looking for. Otherwisewhat are you looking for exactly? A WYSIWYG or What you see is what you get editor? -Chris On Monday 15 December 2003 10:57, Kevin Old wrote: Hello everyone, I've been hand coding HTML for some time now, but recently a lazy streak has run through me and I'd like to find a way to autogenerate creation of a lot of my HTML. Thing is, I'd also like it to be HTML 4.01 compliant. I'd rather not go the CGI.pm route as I am generating static pieces of HTML for use in HTML::Mason pages. A table here, a link there, and so forth, in the end it seems that I can never catch all the errors for HTML 4.01 compliance. I've tried all the linux HTML editors and none of them come close to what I need. Bluefish for instance even generates some HTML that Mozilla won't even interpret. Thoughts, suggestions? Thanks, Kevin -- Kevin Old [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Recommended simple Perl IDE/Editors ?
Just wondering what IDE/editor folks use for their Perl work ? I am on OS X but I use a Java-based editor called jedit, which is available on W32 as well, I guess. http://www.jedit.org/ It supports syntax highlightning, plus it's Freeware and there are lots of nice add-ons! Stephan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Recommended simple Perl IDE/Editors ?
[EMAIL PROTECTED] wrote: Just wondering what IDE/editor folks use for their Perl work ? I am on OS X but I use a Java-based editor called jedit, which is available on W32 as well, I guess. http://www.jedit.org/ It supports syntax highlightning, plus it's Freeware and there are lots of nice add-ons! Stephan FWIW, I am a big fan of emacs and vim, both do syntax highlighting. Emacs is a little more arcane, but if you are comfortable with vi, then vim makes a good choice. www.vim.org, its a winner for a simple editor that doesn't get in your way and is available on windows, mac, and *nix. HTH, Chuck -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: How do you build your HTML?
Hi Chris, Well, I already use HTML::Mason as a templating engine and everything is fine. What I need is a way to generate HTML 4.01 compliant HTML. Basically taking the concept of CGI.pm, but keeping the resulting HTML up to date with the HTML specifications. For example, if you use CGI.pm or write a table by hand without the width parameter of the table the HTML validator at w3.org will not validate your HTML. For now, I just run my pages through HTML Tidy (tidy.sf.net) and fix it by hand, but I'd like to take a more proactive approach and fix as many as I can in my initial coding. Oh well, thanks anyway. Kevin On Mon, 2003-12-15 at 13:30, Chris Ward wrote: Hi Kevin and everyone, I recommend http://www.template-toolkit.org/. Just print out the documentation so it's on hand and your guarenteed on you way to creating some cool ass stuff. Basically it's embedded perl inside HTMLbut you if you reverse it and call it from within a perl cgi module with apache-mod_perl and you can pre-fetch all the html and necessary data (generated images...etc) requested and cache it all or send it to the browser on the fly...etc. Check out www.einsteinspub.com for my only web-project.it's taken about 4 months of hard work to get it this far..but it's awsome IMHO! 100% (well you know what i mean) made by me. Coded in Perl and i use strict; use warnings; use Template; use CGI; use GD; use Image::GD::Thumbnail; as dependencies only other than the mysql backend. All the navigation menus are automatically generated on the fly and cached. Just FYI; hope it's what you were looking for. Otherwisewhat are you looking for exactly? A WYSIWYG or What you see is what you get editor? -Chris On Monday 15 December 2003 10:57, Kevin Old wrote: Hello everyone, I've been hand coding HTML for some time now, but recently a lazy streak has run through me and I'd like to find a way to autogenerate creation of a lot of my HTML. Thing is, I'd also like it to be HTML 4.01 compliant. I'd rather not go the CGI.pm route as I am generating static pieces of HTML for use in HTML::Mason pages. A table here, a link there, and so forth, in the end it seems that I can never catch all the errors for HTML 4.01 compliance. I've tried all the linux HTML editors and none of them come close to what I need. Bluefish for instance even generates some HTML that Mozilla won't even interpret. Thoughts, suggestions? Thanks, Kevin -- Kevin Old [EMAIL PROTECTED] -- Kevin Old [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Recommended simple Perl IDE/Editors ?
[EMAIL PROTECTED] wrote: Just wondering what IDE/editor folks use for their Perl work ? I am on OS X but I use a Java-based editor called jedit, which is available on W32 as well, I guess. http://www.jedit.org/ It supports syntax highlightning, plus it's Freeware and there are lots of nice add-ons! Stephan FWIW, I am a big fan of emacs and vim, both do syntax highlighting. Emacs is a little more arcane, but if you are comfortable with vi, then vim makes a good choice. www.vim.org, its a winner for a simple editor that doesn't get in your way and is available on windows, mac, and *nix. HTH, Chuck I thought it was illegal to be a fan of both Vim and emacs? Personally I am a Vim user though have known a couple of nice emacs users, though they looked kinda funny ;-)... Since I generally work at a shell prompt (rather than with say gvim) I just use the shell's built in 'suspend' (background) and 'resume' (foreground) capabilities when I want to run the code. http://danconia.org -- Boycott the Sugar Bowl! You couldn't pay me to watch that game. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: CSV file - Leading Zeros
At 02:03 PM 12/12/2003, Tim Johnson wrote: I think this is more an Excel question than a Perl question. Excel will detect that it is a number and show you the equivalent formatted as a number. I think you can highlight the row and do a Format-Cells and pick Text as the type. Otherwise if the first character is a single quote then excel will treat the cell as text. This doesn't work for me, the single quote is picked up in the conversion process. I don't think it is possible. -Mark -Original Message- From: Paul Kraus [mailto:[EMAIL PROTECTED] Sent: Friday, December 12, 2003 12:49 PM To: [EMAIL PROTECTED] Subject: CSV file - Leading Zeros Is there a way to write a CSV file so that excel wont drop the leading zero's from fields? I could use spreadsheet::writeexcel or OLE but that's like using a sledgehammer for something that needs to be hand tightened. Thanks. Paul -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Recommended simple Perl IDE/Editors ?
On 12/15/2003 3:29 PM, Wiggins d Anconia wrote: [EMAIL PROTECTED] wrote: Just wondering what IDE/editor folks use for their Perl work ? I am on OS X but I use a Java-based editor called jedit, which is available on W32 as well, I guess. http://www.jedit.org/ It supports syntax highlightning, plus it's Freeware and there are lots of nice add-ons! Stephan FWIW, I am a big fan of emacs and vim, both do syntax highlighting. Emacs is a little more arcane, but if you are comfortable with vi, then vim makes a good choice. www.vim.org, its a winner for a simple editor that doesn't get in your way and is available on windows, mac, and *nix. HTH, Chuck I thought it was illegal to be a fan of both Vim and emacs? Personally I am a Vim user though have known a couple of nice emacs users, though they looked kinda funny ;-)... Hey, I resemble that remark. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: CSV file - Leading Zeros
At 09:45 PM 12/12/2003, R. Joseph Newton wrote: Paul Kraus wrote: Is there a way to write a CSV file so that excel wont drop the leading zero's from fields? I could use spreadsheet::writeexcel or OLE but that's like using a sledgehammer for something that needs to be hand tightened. Thanks. Paul Leading zeroes are meaningful only in strings. If you want leading zeroes in your data, signify that the value is a string by quoting it. It will totally make a hash of any numerical functions on the field, but if leading zeroes are that important... This doesn't work, Excel still strips the delimiters and displays the number as numeric You could also think about the proper place to concern yourself with data, and where to concern yourself with it's representation. A database table, such as a CSV file, has one set of needs. A report has a comletely different set. Don't wate energy trying to line things up verticall in stored data. Just translate to your desired presentation format on extraction. So why do you need leading zeroes? My case is patient medical record numbers, which are always 9 digits and may have a leading zero. I have had this problem a long time, I just format the cells after the conversion process. -Mark -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Recommended simple Perl IDE/Editors ?
OptiPerl rocks. http://www.xarka.com/optiperl/index.html -Tom Kinzer -Original Message- From: Randy W. Sims [mailto:[EMAIL PROTECTED] Sent: Monday, December 15, 2003 2:22 PM To: Wiggins d Anconia Cc: Chuck Fox; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: Recommended simple Perl IDE/Editors ? On 12/15/2003 3:29 PM, Wiggins d Anconia wrote: [EMAIL PROTECTED] wrote: Just wondering what IDE/editor folks use for their Perl work ? I am on OS X but I use a Java-based editor called jedit, which is available on W32 as well, I guess. http://www.jedit.org/ It supports syntax highlightning, plus it's Freeware and there are lots of nice add-ons! Stephan FWIW, I am a big fan of emacs and vim, both do syntax highlighting. Emacs is a little more arcane, but if you are comfortable with vi, then vim makes a good choice. www.vim.org, its a winner for a simple editor that doesn't get in your way and is available on windows, mac, and *nix. HTH, Chuck I thought it was illegal to be a fan of both Vim and emacs? Personally I am a Vim user though have known a couple of nice emacs users, though they looked kinda funny ;-)... Hey, I resemble that remark. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Recommended simple Perl IDE/Editors ?
I use the IDE OptiPerl and like it quite a bit. Vim is the best editor, IMHO. The Optiperl boys have added Vim OLE support to their list of enhancements. http://www.xarka.com/optiperl/index.html -Tom Kinzer -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, December 15, 2003 10:24 AM To: [EMAIL PROTECTED] Subject: Recommended simple Perl IDE/Editors ? Hi all: Just wondering what IDE/editor folks use for their Perl work ? I'm looking for something for a W2K system that is easy to use (without customization) and that has the basics (syntax highlighting, visual debugging, something that shows variable values, the values in whitespace, etc) without a lot of bell whistles. I plan to look at: ActiveState Komodo 2.5 PerlEdit OpenPerl IDE Any recommendation, or feedback on the above IDE's would be appreciated. Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: pass vars to sub via TK/Button
Oliver Schaedlich wrote: Greetings, 15.12.2003, [EMAIL PROTECTED] wrote: $mw-Button (-text=run, -command= sub {test($rb_val,$bonobo,$oracleid)}) -place(-x=320,-y=250 ,-width=75); thanks for your reply. I tried to adapt to your example: $main-Button ( -text = 'Add', -command = sub { add_item($var1, $var2) } ) - pack; but the output add_item delivers looks more like hash references than the content of aforementioned variables: Added Tk::Entry=HASH(0x1c1956c) Tk::Entry=HASH(0x1c1e3a8) Is it possible to pass simple variables via Entry/Button in the first place, and if, how? Best regards, oliver. What does perldoc Tk::Entry tell you? Try something like this: Greetings! E:\d_drive\perlStuff\JPEGperl -w use strict; use warnings; use Tk; use Tk::Entry; my $win = MainWindow-new(height = 150, -width = 250); my $entry = $win-Entry(-width = 25)-pack; my $button = $win-Button(-text = 'Click it, baby, click it!!!', command = [\read_entry_and_print, $entry])-pack; MainLoop; sub read_entry_and_print { my $entry = shift; my $response = $entry-get(); print $response\n; } ^Z Okay, this is the string Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Server Errors
Mr. W. A. Khushil Dep wrote: I've got the below script saved on my server - but every time I use it I get an Internel Server Error! I've set the permission to 755 but still no luck. Any ideas folks? www.klconsulting.co.uk/cgi-bin/cssc.pl #!/usr/bin/perl use Net::Ping; @host_array = (192.153.1.10,192.153.0.18,212.241.168.197,212.241.168.138,212. 241.167.11,194.153.21.68,194.153.20.100,194.153.20.51,194.153.20 .52,194.153.20.53,515.35.226.5,212.241.160.12,194.153.1.19,194 .153.1.18,212.35.224.125,212.35.224.126); $p = Net::Ping-new(icmp); $p-bind($my_addr); foreach $host (@host_array) { print $host is ; print NOT unless $p-ping($host, 2); print reachable.\n; sleep(1); } $p-close(); This looks like a script that might run by telnet [highly unlikely, since the crowding of already dense strings and lack of formatting is likely to cause logic or other human errors, but at least it might]. It sounds, though, like you are trying to do this from CGI. Unfortunately, you have nothing in the script to support CGI communication. Nor does your script output html. If you: use CGI; you will have tools available to do both very simply. perldoc CGI Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: pass vars to sub via TK/Button
Greetings, 15.12.2003, zentara wrote: $main - Button ( -text = 'Add', -command = sub{\add_item($var1,$var2)} ) - pack; [...] sub add_item { [...] my $entry1 = $_[0]-get(); my $entry2 = $_[1]-get(); [...] } thanks for your reply. I tried this out and it works, though I have no idea what it actually does and why I have to alter/decode/whatever the fetched data in the first place. I guess I have to read into get() a bit. Thanks a bunch, same goes to Laurent. Best regards, oliver. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Please help me! Thanks.
for (my $value = -1; $value = 1; $value += 0.1) { print $value\n; } The result is as following: -1 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 -1.38777878078145e-16 0.0999 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 But what I wanted is: -1 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Help! please! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Please help me! Thanks.
now, a stupid solution is: for (my $value = -1000; $value = 1000; $value += 100) { print $value/1000, \n; } hehe, - Original Message - From: pagoda [EMAIL PROTECTED] To: begin begin [EMAIL PROTECTED] Sent: Tuesday, December 16, 2003 1:54 PM Subject: Please help me! Thanks. for (my $value = -1; $value = 1; $value += 0.1) { print $value\n; } The result is as following: -1 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 -1.38777878078145e-16 0.0999 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 But what I wanted is: -1 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Help! please! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: pass vars to sub via TK/Button
Greetings, thanks for your reply. 16.12.2003, R. Joseph Newton wrote: What does perldoc Tk::Entry tell you? a) that there is a doc for Entry in the first place - I didn't know that, only read the main TK documentation. ^^; b) Now that I read it, hmm, not much I'm afraid. Either I missed the part where it states how the data is encoded or I don't know enough about Perl (true, of course) to have it trigger something in my brain. Try something like this: [...] command = [\read_entry_and_print, $entry])-pack; [...] my $entry = shift; my $response = $entry-get(); [...] It works, thanks. As mentioned in the other mail (which should have been out to the list by yesterday already) I'll read into get as soon as possible. my $win = MainWindow-new(height = 150, -width = 250); Hmm, are you sure this works? The window my script creates shrinks to width and height of the widgets (ActivePerl 5.8 on WinXP if that matters). Ok, and now breakfast. :) Joseph Best regards, oliver. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Please help me! Thanks.
now, a stupid solution is: for (my $value = -1000; $value = 1000; $value += 100) { print $value/1000, \n; } hehe, Sadly, it's not as stupid as you think. Unless I misunderstand things, what you are seeing here is a problem called IEEE 754 floating point. I'm sure there is some explanation that someone could offer as to why it's the best thing, but IEEE754 doesn't represent simple decimals very well. It converts them into binary using an odd method allowing it to represent the number in one chunk, avoiding the mantissa and exponent form. However, this encoding can't represent any decimal not ending in 5 finitely, much the same way it's not possible to represent 1/3 in decimal finitely. The upshot of this is that unless you *really* need floating point math, and are willing to do what is necessary to compensate for the error that will creep in, you should stay away from it. Smart folks will often represent monetary values in hundreths or thousanths of cents, just to avoid floating point math. -- May we have the clarity to see our work, the courage to embrace it, and the capacity to discharge it. http://www.hacksaw.org -- http://www.privatecircus.com -- KB1FVD -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Please help me! Thanks.
On Tue, Dec 16, 2003 at 02:25:42PM +0800, pagoda wrote: now, a stupid solution is: for (my $value = -1000; $value = 1000; $value += 100) { print $value/1000, \n; } hehe, Not so stupid, really. If you can keep most of your maths confined to integers you will have fewer floating point problems. There's no need to increment in steps of 100 though. $ perl -le 'print $_ / 10 for -10 .. 10' -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Please help me! Thanks.
pagoda [EMAIL PROTECTED] wrote: : Take a look at the first question in perlfaq4: Why am I getting long decimals (eg, 19.94999) instead of the numbers I should be getting (eg, 19.95)? HTH, Charles K. Clarkson -- Head Bottle Washer, Clarkson Energy Homes, Inc. Mobile Home Specialists 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response