Re: How do I do this
sub settings_smi_edit { $storeline = $q-param('id'); open(FILE, info/smileset.txt); @file = FILE; close(FILE); foreach $i (@file) { ($number, $image, $name, $text, $used) = split(/\|/, $i); if ($number eq $storeline) { @numb = ($number, $image, $name, $text, $used); } } } Ok that I been trying this for a while, can't seem to get it. Ok after I get all taht in a while loop, say I edit @numb and I want to put it back into @file by the $storeline. Get what Im saying -Find it in @file Foreach my $value(@file) { regex? if $value eq something; } -Take that line -Edit it -Put it back in @file (updated) -by i.d number What i.d number? Also how would i *delete that certain array also undefine(@array); @array = ; Etc.. Tor -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: At least a number of characters - regular expressions
Octavian Rasnita wrote at Sun, 09 Jun 2002 08:42:34 +0200: Hi all, I want to check if in a string there are more than 3 capital letters. I've tried using: if ($string=~ /[A-Z]{3,}/) { } } This match at least 3 capitals only if they are one after another. I want to check if the string contains at least 3 capitals, doesn't matter how are they positioned. David has shown you one way. David's way becomes a little bit difficult if you'd want to look for 100 or so uppercase letters. 2 Another possibility is: my @uppers = $string =~ /([A-Z])/g; if (@uppers = 3) { ... } or quite more beautiful (but is only possibible for characters:) if ($string =~ tr/A-Z// = 3) { ... } Best Wishes, Janek PS: BTW. This topic isn't really a cgi topic. It should be better posted in perl.beginners. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] RE: POD vs. # Comments (was Am I doing something wrong?)
Well, I confess that I sometimes use POD directives to write a long comment (more than about 1/2 dozen lines). My rationale is that I haven't really learned POD very well yet, and so far I haven't released any of this code publically. When I do, I intend to revisit the code and make a better distinction between what is properly POD doc'n and what is just code comments. Meantime, I do think it's a pain to write multiple paragraph comments as lines beginning with '#'. It's a little easier with a good editor that has column mode. You set it to wrap text, write the paragraph(s), then turn off wrap, column-select the beginning column of every line, type '# ', and presto, they all start with '# '. Of course if you want to change something, you have to take them all out again (column select and delete) and re-do the process, including re-wrapping the paragraphs. A multi-line comment would still be easier. (But I guess I missed the public comment period for Perl 6, didn't I? I wonder if anyone raised this suggestion?) - John --- Scot Robnett [EMAIL PROTECTED] wrote: What you are doing is not commenting; you're creating POD documentation. To comment out lines in Perl, use the # character. #!/usr/bin/perl -w print Hello, world! \n; # This is a comment where you # can write about what you're # doing in a particular block # so other programmers won't # be confused by your code. = Now it's over, I'm dead, and I haven't done anything that I want; or, I'm still alive, and there's nothing I want to do. - They Might Be Giants, http://www.tmbg.com __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: crash course recommendations
Hi , there is one I use as a resource - www.wdvl.com/Authouring/Languages Sol [EMAIL PROTECTED] 06/09/02 05:42AM Hi there, I've inherited an intranet server run interactive pages with perl-cgi scripts, one of which I need to edit in a hurry, which is a bit of a problem considering I know about zero Perl. (Luckily I know some rudimentary SQL HTML) I've been scouring the WWW for tutorials on perl-cgi tutorials without much luck (or quite possibly without much intelligence :) ) when I found this mailing list which looked friendly. Can anyone point me in the direction of a good Perl and/or perl-cgi tutorial/crash-course on the WWW whilst this poor student saves up the money to get a book or something? kind regards (from Perth Aust), sol hanna -- 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: [OT] RE: POD vs. # Comments (was Am I doing something wrong?)
On Monday, June 10, 2002, at 05:42 , John Brooking wrote: Well, I confess that I sometimes use POD directives to write a long comment (more than about 1/2 dozen lines). My rationale is that I haven't really learned POD very well yet, and so far I haven't released any of this code publically. When I do, I intend to revisit the code and make a better distinction between what is properly POD doc'n and what is just code comments. Another way that folks may wish to think about this problem: a) if you are not planning to put 'pod' into your applet then you are none the worse for wear - perse b) you may want to think in terms of learning to 'write pod' it really is a lot simpler in most respects than writing either man pages or raw html c) play with h2xs - it will give you the basic framework for both a 'perl module' as well as the preliminary POD ! One thing I would strongly advocate against - running 'code with major chunks of stuff commented out' It's fine to do that while sorting out which way to go, as strictly 'test code' when doing things like CGI development, but when you get to that 'lock the source code tree down' - check in the code you want, and DO NOT have chunkage of dead code floating around - it WILL BITE YOU - someone will zone out why this 'ugly' little '=cut' is there... and suddenly you are off in a new morass chasing code you forgot you left bloated around. Solving 'what should be in the pod' as opposed to 'in code comments' the only reasonable rule of thumb I can think of is: a) when you are grey, and it is dark, will you remember why you did this not so self obvious trick? b) templatize your 'functions' so that you just have a basic piece of commenting there anyway that you grow or shrink as needed. c) Expose to your user's what they should be forewarned about either 'as pod' that also just happens to be the 'self documenting' part you will use as well when re-writing in the dark - or have that as a part of your and additional stuff for other perlGeeks POD is reasonably flexible about how you add the appropriate sections to it. ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to write pod (was Re: [OT] RE: POD vs. # Comments (was Am I doing something wrong?))
drieux, et al -- Hey, is this the sort of thing that should be on the beginners list because it isn't CGI-specific? Do we redirect threads over to the other list as appropriate? ...and then drieux said... % % % On Monday, June 10, 2002, at 05:42 , John Brooking wrote: % % Well, I confess that I sometimes use POD directives to % write a long comment (more than about 1/2 dozen ... % ... % b) you may want to think in terms of learning to 'write pod' % it really is a lot simpler in most respects than writing % either man pages or raw html Definitely! Any [other] hints for how to learn it and what's the structure? Believe it or not, The Camel Book only mentions Pod::Text for converting pod to ascii, but I don't have any pod yet... % % c) play with h2xs - it will give you the basic framework for % both a 'perl module' as well as the preliminary POD ! OK; I'll do that, too. Wait a minnit... I don't have a C .h file, so how will this help me? % % One thing I would strongly advocate against - % % running 'code with major chunks of stuff commented out' % % It's fine to do that while sorting out which way to go, as % strictly 'test code' when doing things like CGI development, Agreed; that's how I'm keeping track of where I want to go as I'm hacking out the functionality of a script, but once all of the pieces are written the big chunk has been whittled down to nothing and the problem is solved :-) It seems to me that I could turn that into pod structure as well, which is another reason I'm keen to learn how to write the stuff. % but when you get to that 'lock the source code tree down' - % check in the code you want, and DO NOT have chunkage of dead % code floating around - it WILL BITE YOU - someone will zone *grin* It sure will. % out why this 'ugly' little '=cut' is there... and suddenly % you are off in a new morass chasing code you forgot you % left bloated around. Been there, though not yet in perl (enough other screwups, but not this one!). TIA HAND :-D -- David T-G * It's easier to fight for one's principles (play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie (work) [EMAIL PROTECTED] http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg05308/pgp0.pgp Description: PGP signature
Re: [OT] RE: POD vs. # Comments
--- drieux [EMAIL PROTECTED] wrote: ... Solving 'what should be in the pod' as opposed to 'in code comments' ... POD doc'n in CPAN modules is basically of the here's how to use this code variety, so taking that is the model, here's what I'm thinking about that distinction. If it's about how to USE the code, such as the arguments expected by a function, that's POD doc'n. If it's something about the internals that only the developer needs to know, such as more explanation of a particularly gnarly algorithm, then it needn't and probably shouldn't be POD. Don't confuse your audience with things they don't need to know. = Now it's over, I'm dead, and I haven't done anything that I want; or, I'm still alive, and there's nothing I want to do. - They Might Be Giants, http://www.tmbg.com __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
file read and then write problem
Hi all I posted this on the CGI list but no response at all. Please have a look at this problem. I am reading from an html file and writing to another. The while loop terminates before the complete file is read. The worse part is that it works for some files and doesn't for others. Moreover, it varies where it terminates in different files, while it always terminate at the same stage for the same file. For eg, reading file TMP writing to FA, FB, FC each time the program is executed FA terminates at something like input type=hidden name=LL value=.. FB terminates at IMG src=h FC terminates at input type=image src=http://www.foo.com/store/images/dpt/S The files always terminate at same stage each time but there are some others been written perfectly. Any suggestions? Thanks in advance aman
Re: [OT] RE: POD vs. # Comments
on Mon, 10 Jun 2002 17:37:46 GMT, John Brooking wrote: [...] If it's something about the internals that only the developer needs to know, such as more explanation of a particularly gnarly algorithm, then it needn't and probably shouldn't be POD. Don't confuse your audience with things they don't need to know. But then you could always use =for those_interested_in_the_nifty_algorithm Explanation of the nifty algorithm =cut # rest of code which will never show up in a pod2something translation. I tend to use this only to (temporary) comment out large chunks of code though. For 'real' comments, I always use #. -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] RE: POD vs. # Comments
Hi, all -- ...and then Felix Geerinckx said... % ... % =for those_interested_in_the_nifty_algorithm % % Explanation of the nifty algorithm % % =cut Yeah, but the point is that I still don't know what I'm doing. I've seen =head1 and =head2 and I don't know how they map to anything else... Is there a primer outlining all of the =* directives and how they go together? So far all I know is that =cut ... =cut will conveniently comment out large chunks of code. Arrgh! TIA HAND :-D -- David T-G * It's easier to fight for one's principles (play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie (work) [EMAIL PROTECTED] http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg05312/pgp0.pgp Description: PGP signature
Re: [OT] RE: POD vs. # Comments
Felix, et al -- ...and then Felix Geerinckx said... % % on Mon, 10 Jun 2002 18:56:20 GMT, David T-G wrote: % % Yeah, but the point is that I still don't know what I'm doing. ... % % perldoc perlpod Ah! I was trying perldoc pod and every permutation thereof, but never thought of perlpod. Now I can curl up with a good man page. Thanks! % % comes to mind. And you will find plenty of examples in the directories % from your '@INC'. Ah. Good to know, though I still have some of the but I don't know what this layout is doing problems that way. But once I do (cf above) then I can grok their structure. % % -- % felix Thanks! HAND :-D -- David T-G * It's easier to fight for one's principles (play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie (work) [EMAIL PROTECTED] http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg05314/pgp0.pgp Description: PGP signature
testing CGI without webserver on NT?
On Windows2000. I have an html page that calls a perl script in a form but IE does not execute the script but rather asks that it be downloaded. Perl is installed in E:\foo\Perl and not the usual C:\Perl directory. could this have something to do with it? Thanks, Al -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: testing CGI without webserver on NT?
HI -- You need to execute the perl script. Change the permissions in IIS to execute BUT make sure that you don't have write set as well;) Mike -Original Message- From: Alaric J. Hammell Sent: Mon 6/10/2002 4:09 PM To: [EMAIL PROTECTED] Cc: Subject: testing CGI without webserver on NT? On Windows2000. I have an html page that calls a perl script in a form but IE does not execute the script but rather asks that it be downloaded. Perl is installed in E:\foo\Perl and not the usual C:\Perl directory. could this have something to do with it? Thanks, Al -- 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: Using strict and a configuration file?
I had this same question answered on the perl beginners list. Object oriented programming was recommended. Someday I want to learn about that But for now what I did was give the configuration file and the scripts that use it the same package name and then I defined these variables as global Variables with the use vars. It works ok with the use strict, but it may Violate some standard perl coding practices against global variables. Maureen -Original Message- From: Octavian Rasnita [mailto:[EMAIL PROTECTED]] Sent: Friday, June 07, 2002 12:12 AM To: [EMAIL PROTECTED] Subject: Using strict and a configuration file? Hi all, Is it possible to use use strict; if I get the variables from a configuration file? I've tried: use strict; require f:/xxx/config.txt; #In the configuration file I have a line like my $test = test test test; print Content-type: text/html\n\n; print $test; This gives me an error that I should define the variable $test. I don't want to define it in the script but in the configuration file. However, if I define it in the script with my $test; the script prints an empty string and doesn't take the variable from the configuration file. Is it possible to use strict, or it is necessary to use no strict;? Another problem, maybe bigger is that even though the script is running fine, it give me errors in the log file telling me that the variable $xxx and $yyy, ... is used only once. Is there a good method to define variables for more scripts in a single configuration file? I don't want to store my email address and other settings in each script because I may change that address, and then I will need to modify a lot. Thank you. . or I have another solution for defining all the variables in a configuration file? Teddy, [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: file read and then write problem
Aman, I think that we are going to need same sample code. I can't get this to happen. Thanks Kristofer Original Message Follows From: aman cgiperl [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: file read and then write problem Date: Mon, 10 Jun 2002 13:09:54 -0500 Hi all I posted this on the CGI list but no response at all. Please have a look at this problem. I am reading from an html file and writing to another. The while loop terminates before the complete file is read. The worse part is that it works for some files and doesn't for others. Moreover, it varies where it terminates in different files, while it always terminate at the same stage for the same file. For eg, reading file TMP writing to FA, FB, FC each time the program is executed FA terminates at something like input type=hidden name=LL value=.. FB terminates at IMG src=h FC terminates at input type=image src=http://www.foo.com/store/images/dpt/S The files always terminate at same stage each time but there are some others been written perfectly. Any suggestions? Thanks in advance aman _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] RE: POD vs. # Comments
--- Felix Geerinckx [EMAIL PROTECTED] wrote: on Mon, 10 Jun 2002 17:37:46 GMT, John Brooking wrote: [...] If it's something about the internals that only the developer needs to know, such as more explanation of a particularly gnarly algorithm, then it needn't and probably shouldn't be POD. Don't confuse your audience with things they don't need to know. But then you could always use =for those_interested_in_the_nifty_algorithm Explanation of the nifty algorithm =cut # rest of code which will never show up in a pod2something translation. I tend to use this only to (temporary) comment out large chunks of code though. For 'real' comments, I always use #. -- felix Hey! The Camel book (am I right in assuming that is the Perl community's nickname for O'Reilly's Programming Perl?) says that comment, when used as a translator keyword following =for, is by convention ignored by all translators. So in my mind, =for comment would be a Safe and Acceptable way to begin a multiple line comment that you don't want your public to see. Or, if you are commenting only for yourself or other future developers, you could use something like =for developers, and write a translator that responds to that word. But maybe not, because a translator by definition translates to a particular output format, whereas this translator is named not for the output format it creates but for the POD sections it selects. So it kind of gets away from the intended purpose. Maybe the standard POD syntax ought to have an audience directive, and include a command line flag on perldoc to indicate what audiences to include. (Drat, second time today I've regretted missing the Perl 6 comment period!) - John = Now it's over, I'm dead, and I haven't done anything that I want; or, I'm still alive, and there's nothing I want to do. - They Might Be Giants, http://www.tmbg.com __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Need a way to begin learn Perl
Hi. I would like to begin learning Perl, but I don't know where I begin learning it does anybody has any sugest??? Ahmad [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need a way to begin learn Perl
On Monday, June 10, 2002, at 03:40 , Ahmad wrote: Hi. I would like to begin learning Perl, but I don't know where I begin learning it does anybody has any sugest??? Ahmad [EMAIL PROTECTED] never lead with a leading question OBLIGATORY first case learn to 'use strict' and '-w' then a) perldoc perl start at the top of the documentation internal to perl and move forward from there. b) buy the learning perl 3rd edition and the programming perl 3rd edition. do all the exercises, do not peek at the solutions until you know where to go next. c) check out http://www.wetware.com/drieux/pbl/perlTrick/drieuxTemplates/ for some silly templates to start using as the basis for doing a bit of scripting. d) read your way through all of the references in: http://www.wetware.com/drieux/pbl/perldoc/ in there you will find a reference to at least one of the online tutorials for learning perl... e) rummage around in http://www.wetware.com/drieux/pbl/ until you really know which code stinks. f) consider joining the 'beginners' list to deal specifically with just perl beginner questions ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need a way to begin learn Perl
On Monday, June 10, 2002, at 03:40 , Ahmad wrote: I would like to begin learning Perl, but I don't know where I begin learning it does anybody has any sugest??? You could take a peek at my tutorial site http://thecgibin.com. Also if you have a *nix box at home install Perl on there... if you have a Windows box then ActiveState's Perl was free last I looked and self installing. Marty -- SIMPL WebSite Creation: http://face2interface.com/Home/Demo.shtml -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need a way to begin learn Perl
On Monday, June 10, 2002, at 04:28 , Marty Landman wrote: You could take a peek at my tutorial site http://thecgibin.com. interesting place, will have to rummage around more, but on http://thecgibin.com/index/faqs.shtml?Perl's_Quote_Words_Feature you make the assertion my @peppers = (qw(green red yellow black cayenne)); is this an old perlism since I have always done that as my @peppers = qw(green red yellow black cayenne); since qw doesn't like 'scalar contexts' ... or am I missing something here??? ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
single quotes kill my scripts
I have the following code - when someone enters a whatever ' whatever into one of my forms my script dies because of the single quote. Aggg... of course the first time I come across it is when my boss is testing out the script. $sth = $dbh-do( insert into maintenance (owner, email, maintype, title, requested, engineer, ticket, impact, comm, dispo, dispodate, action, sponname, sponop, sponcp, sponp, conname, conop, concp, conp, partname, partop, partcp, par tp, manname, manop, mancp, manp, dbaname, dbaop, dbacp, dbap, engname, engop, engcp, engp, mainname, mainop, maincp, mainp, process, rollback, closeout, datetime, purpose, risk, saname, saop, sacp, sap, total, pending, counting) value s ('$owner', 'names', '$maintype', '$title', '$requested', '$engineer', '$ticket', '$impact', '$comm', '$dispo', '$d ispodate', '$action', '$sponname', '$sponop', '$sponcp', '$sponp', '$conname', '$conop', '$concp', '$conp', '$partnam e', '$partop', '$partcp', '$partp', '$manname', '$manop', '$mancp', '$manp', '$dbaname', '$dbaop', '$dbacp', '$dbap', '$engname', '$engop', '$engcp', '$engp', '$mainname', '$mainop', '$maincp', '$mainp', '$process', '$rollback', '$clo seout', '$datetime', '$purpose', '$risk', '$saname', '$saop', '$sacp', '$sap', '$total', '$pending', '$counting')); - Do You Yahoo!? Sign-up for Video Highlights of 2002 FIFA World Cup
Re: Mastering Regular Expressions?
Hi thank you. I have talked with Lenny Muellner from O'Reilly because I am blind and they offer the books for free for the blind, but even though he gave me the books I've asked for free, he told me that he has not the book Mastering Regular Expressions available. Teddy, [EMAIL PROTECTED] - Original Message - From: David T-G [EMAIL PROTECTED] To: perl beginners cgi [EMAIL PROTECTED] Cc: Octavian Rasnita [EMAIL PROTECTED] Sent: Monday, June 10, 2002 6:16 AM Subject: Re: Mastering Regular Expressions? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Uploading files timeout
Hi all, I've made a form for uploading files and I want to let the visitors to upload large files. I've heard that it can appear timeouts when uploading large files to a www server with a form. Is it true? If yes, what can I do to avoid the timeout? Thank you. Teddy, [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need a way to begin learn Perl
On Monday 10 June 2002 02:40 pm, Ahmad wrote: Hi. I would like to begin learning Perl, but I don't know where I begin learning it does anybody has any sugest??? Ahmad [EMAIL PROTECTED] Get a copy of perl nd start by reading through the pod file , plain old documentation. then start coding , the only real way to learn is to write script and then debug them , if you expect a certian behavior from your script and it does not do what you expect then re read the doc's ask questions and try again , the best way to lear it is by doing it. Greg -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]