Re: Determine total days of month
On Tue, 4 Apr 2006, Mike Blezien wrote: I am trying to come up with a function, or formula calculation, to determine the total days of a given month, IE: April which has 30 days, Feb has 28 days, March has 31 days... etc Is there way to do this with Perl Don't calculate it. Just use a lookup table in a hash. Trivially, and not 100% accurate but maybe good enough: my %months = ( jan = 31, feb = 28, mar = 31, apr = 30, jun = 30, jul = 31, aug = 31, sep = 30, oct = 31, nov = 30, dec = 31 ); Depending on what you're doing, you may have to handle leap years. If you do, you can do something like this instead: if (leap_year($year)) { my %months = ( jan = 31, feb = 29, ... ); } else { my %months = ( jan = 31, feb = 28, ... ); } (In this example, leap_year($year) is left as an exercise. :-) For a lot of problems like this, where you know that there's a one-to-one mapping between things -- as, in this case, months and day counts -- the easiest way is just a hash-based lookup table. You can often solve these things with some kind of elaborate calculations -- say, to compute the day that a lunar-calendar based holiday (Easter, Hanukkah, Ramadan, Chinese New Year, etc) -- but a lot of the time it ends up being easier to just figure out the mappings in advance and hard-code that either in your script or in a resource data file that your script loads at run time. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: New to Perl....
On Tue, 28 Mar 2006, Omabele Onome wrote: However, my boss just asked me for a flowchart / perl script to monitor the following:- -webserver, -Db server, -chat. Where do I start from... I have just 2 hrs to come up with the miracle solution This list isn't your best hope then. We're here to critique code, not teach people how to do their jobs. Your best bet may be one of the system monitoring setups that sits on top of SNMP -- MRTG is one, but there are others as well. These don't tend to do quite what you're asking for -- I haven't seen one that did flow charts, though a lot of them have plugins for different types of reports that may include such diagrams -- but at least it does the bulk of the setup work for you. Good luck. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: need help
On Tue, 21 Mar 2006, julian thomas p wrote: iam bioinformatician i have written a perl script for gene identification. the script works in my local server(apache)in my home . but when i tried to run inweb server(biosolutions.siteburg.com) iam getting a blank page rather than results. permission level for script is 711 and for cgi folder 700. i had checked the log files. error file is blank access file consist following data ### 61.17.177.147 09/Mar/2006:20:41:38 CST GET http://biosolutions.siteburg.com/form.html HTTP/1.1 200 1086 - Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322) 61.17.177.147 09/Mar/2006:20:42:01 CST POST http://biosolutions.siteburg.com/cgi-bin/mt/ex3.pl HTTP/1.1 200 329 ### can u please help me Nope. Can [you] please post some code? Can you write a minimal script -- even just #!perl print Content-type: text/plain\n\nTesting 1 2 3\n; that does work on the server? If so, that helps narrow down whether it's a server config issue, a script issue, or what have you. But so far there isn't enough information to provide more feedback. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Padded 3 digit numeric series
On Sat, 11 Mar 2006, Harry Putnam wrote: Its just the numeric part I need a jump start on. Have you looked at sprintf yet? `perldoc -f sprintf` That's probably the easiest way. Alternatively, you could do some kind of silly subroutine that padded two zeroes if $n 10, one zero if $n 100, etc. It wouldn't be that hard to do, but I think sprintf will be much easier. -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Perl/CGI detecting status of radio button
On Fri, 10 Mar 2006, Nan Jiang wrote: I would like to ask if some of you know how to use perl to detect the status (checked or unchecked) of a radio button from a HTML form? Yes. Some of us do know how to do this. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Does this script have the efficiency problems?
On Thu, 9 Mar 2006, Practical Perl wrote: Here is my script: #!/usr/bin/perl use strict; use warnings; my $date=`date +%y%m%d`; chomp $date; ^^^ Not that this is your problem, but why on earth are you shelling out for the date? Perl can do this just fine, you know, and you don't even have to chomp() the result :-) Why this happen and how to resolve it? Any suggestion is welcome.Thanks. What happened when you benchmarked your script? Where did you determine that it is spending the most time? Figure that out and then you'll know where to focus your attention. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Forcing order
On Thu, 9 Mar 2006, Ron Smith wrote: How can I assure printing the correct order? You can't guarantee the order of keys in a hash per se. For efficiency and optimization, hashes are stored in a random order, unlike arrays, which do have a straightforward order. The trick then is to sort the hash keys. Instead of this: foreach ( keys( %values ) ) { Try this, or a variant on this: foreach ( sort keys( %values ) ) { You can get more sophisticated than this, but doing at least this much sorting on the keys should start producing consistent results. -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: regexpressions help
On Tue, 14 Feb 2006, Tom Phoenix wrote: On 2/14/06, Gerald Wheeler [EMAIL PROTECTED] wrote: I am trying to allow input of a person's first and last name in one form field, nothing more, nothing less Robert de Niro? Mary Kay Place? Arthur Conan Doyle? Harry S Truman? Kim Jong-il? brian d foy? Sting? John Paul II? George W. Bush? Prince Charles? Or, my favorite, Jennifer 8 Lee: http://en.wikipedia.org/wiki/Jennifer_8._Lee So, as others have asked, is it really pragmatic to come up with a regex that will properly recognize any of these eccentric-but-real surnames, while rejecting non-surnames like, say... Time And Place Bee Sting Rose Bush ...which presumably are not names. Put another way, if someone says their name is 8, what business does your software have in trying to convince them otherwise? You have a slim chance of catching a typo -- though if you think about it most people that can type at all well have probably long-since committed their own name to finger memory, so typoes are unlikely -- but most likely you're just going to get someone frustrated with you. -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: text files to xml database
On Sat, 11 Feb 2006, I BioKid wrote: I need technical advice from all perlbuddies, I have 2 text files and I want to convert it to XML and then to a database. I need a proper technical descritption to do it using PERL. I need details like which db should i use also. Good luck with that! Let us know if you turn up any good leads. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: vlookup by perl instead of excel
On Thu, 2 Feb 2006, Sanjay Chandriani wrote: I am a perl newbie, so pardon my question if it is super easy. I used to routinely use Microsoft excel to do my vlookup's on a PC. Recently, I got a new Apple computer and the vlookup function on Mac's excel is unbearably slow. I often do vlookup's for a column of identifiers that is 40K long. This can take 30 minutes!! I figured there has to be a perl script out there that will do this for me, but I haven't been able to find one by google-ing. I wish i could write it myself, but I am only on the 3rd chapter of the llama book! :) Any help would be greatly appreciated. Part of the trick in asking good questions is to explain any jargon. What's a vlookup ? The Excel help file says, in part: VLOOKUP Searches for a value in the leftmost column of a table, and then returns a value in the same row from a column you specify in the table. Use VLOOKUP instead of HLOOKUP when your comparison values are located in a column to the left of the data you want to find. By contrast... HLOOKUP Searches for a value in the top row of a table or an array of values, and then returns a value in the same column from a row you specify in the table or array. Use HLOOKUP when your comparison values are located in a row across the top of a table of data, and you want to look down a specified number of rows. Use VLOOKUP when your comparison values are located in a column to the left of the data you want to find. The H in HLOOKUP stands for Horizontal. Ok, so... your data is in Excel, and you're working on a Mac, and you want to do this vlookup operation or an equivalent using Perl? Yes? I suspect it will be easier to help you if you give us a clear idea of what your data is, how it's being stored (Excel, or other), what you need to accomplish with your data, and -- most important -- what you have tried so far. -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: file test
On Mon, 23 Jan 2006, hien wrote: i am trying to check if there are any files named file* (e.g. file_001.txt file1.doc) in my directory. perldoc -f glob -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Help Needed
On Wed, 18 Jan 2006, Rakesh Mishra wrote: Hello folks I am thinking to built port scanner in perl. for port scanning I am using SYN packet. Can any body suggest some online document or mannuals for this. Can someone? Probably. Did you try searching? Where? What did you find? Did you find Lincoln Stein's _Network Programming with Perl_ yet? There's lots of good material out there, if only you try to find it. -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: dprofpp
On Fri, 13 Jan 2006, Gerard Robin wrote: And, what are exactly Elapsed Time and User+System Time ? If i run time ./dprof1.pl the outputs are: real0m0.033s user0m0.011s sys 0m0.002s If i run time ./dprof3.pl the outputs are: real0m0.059s user0m0.018s sys 0m0.004s What relation exists between the times of time an te times of dprofpp ? The `times` manpage may help, as might `getrusage`: http://www.hmug.org/man/3/times.php http://www.hmug.org/man/2/getrusage.php http://publib16.boulder.ibm.com/pseries/en_US/libs/basetrf1/getrusage_64.htm The way that IBM version of the manpage is more oriented towards C programmers using the call, but the basic idea still gets through: This information is read from the calling process as well as from each completed child process for which the calling process executed a wait subroutine. tms_utime The CPU time used for executing instructions in the user space of the calling process tms_stime The CPU time used by the system on behalf of the calling process. tms_cutime The sum of the tms_utime and the tms_cutime values for all the child processes. tms_cstime The sum of the tms_stime and the tms_cstime values for all the child processes. Note: The system measures time by counting clock interrupts. The precision of the values reported by the times subroutine depends on the rate at which the clock interrupts occur. Helpful? -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: contest software
On Sun, 15 Jan 2006, Mike Blezien wrote: Brief description: something similar used on http://www.worth1000.com, designers will submit an entry to a project, with his/her entry being completely invisible to everyone but the website staff and the Client (Project Holder). The project holder must then select a winning design. After a winning design is chosen, all entries into the project will be displayed to the public. Would you like a pony with that too? How about a puppy? Nice puppy! If you want something specific and you're not willing to write it yourself (or do a Sourceforge/Google search by yourself), then you had better be prepared to pay someone to do the work for you. As ever, this list isn't a script writing service, and it certainly isn't a free service for converting vaguely thought through project ideas into workable code. What you're asking for sounds like it can be broken down into a series of simple components, only one of which has to involve Perl (or any other programming language): * make a web site explaining the contest (HTML) * have a web page for uploading entries (HTML) * have a script to accept entries (Perl) * have another web site with the results (HTML) So the only thing you really need here, Perl-wise, is a script that accepts CGI file upload (.zip files I guess, but whatever), stores them for the judges to look at later, and returns a web page acknowledging the successful contest entry. This is a wheel that has been invented many many times and if you can't find code to do this for you (hint: try the NMS script project), then a resourceful beginner with access to the documentation for the language or a good O'Reilly book should be able to whip up a solution in no more than an hour or two. Have at it and let us know if you have any questions once you've started writing your version of that script. -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: The @ symbol
On Fri, 13 Jan 2006, Gerald Wheeler wrote: trying to include the following code with the abc.pl script... the snippet works in an html/css environment print EOF; style type=text/css media=all @import url(theta.css); @media print { body {background: white; color: black; font: 12pt Times, serif;} #noprnt {display: none !important;} } /style EOF The @ symbols are misread and thus this cause errors... escaping the @ symbols doesn't work anyone with a solution?? This is part of why I hate heredocs. Just use a regular single- or double- quoted print statement with a custom quote delimiter: print q[ style type=text/css media=all @import url(theta.css); @media print { body {background: white; color: black; font: 12pt Times, serif;} #noprnt {display: none !important;} } /style ]; Less fiddly, easier to read, works as well or better. Heredocs are for grizzled old shell-scripters that refuse to let go of their scars :-) -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- 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 distributions - What are people using?
On Fri, 13 Jan 2006, Dan Huston wrote: I noticed on CPAN that there are several Perl ports for Win32. Of course I am aware of ActiveState, but have others had success with any of the others? The main issue I keep running into is installing modules from CPAN using the CPAN module and so I am looking for a better alternative. How about the one provided with Cygwin? That seems to be the best way to go if you want a reasonably sane Unix environment -- including a usable Perl -- running within Windows. I haven't really used the Cygwin version of Perl for interacting with Windows itself, but I imagine it should work fine. -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: perl Input from GUI - form
On Wed, 11 Jan 2006, manoj thakur wrote: My question is what is the best way to have the input to my perl script through a GUi like a form or a window. I know may be CGI any input to point me in the right direction is highly appreciated. Read the documentation for CGI.pm, then write a program using it. Have you tried either of these yet? If you've read the documentation, cite it and explain to us how it didn't make sense to you. If you've written a program, show it to us and explain how it isn't doing what you want it to do. -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- 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 to add Text::CVS Module
On Mon, 9 Jan 2006, Gerald Wheeler wrote: I do not have access to a C compiler, etc.. I am running perl 5.6.1 on Solaris (Unix) How can I import Text::CVS into my existing perl 5.6.1 installation.. A step by step example would be great... probably to much to ask for.. I assume you tried the README for instructions ? http://search.cpan.org/src/ALANCITT/Text-CSV-0.01/README It depends on `make`, but doesn't compile anything. (Text::CSV_XS is a variant module that does have a component in C that has to be compiled, but the one you're looking at is pure Perl.) -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: script to count message sizes on an imap server
On Sun, 8 Jan 2006, Martin J Hooper wrote: Does anyone know of a script I can download which will connect to my IMAP server and transverse all folders counting up the size of each message in the folder and then spitting it out..? I'm sure I'm not the only one to want to do this... ;) Well, you're not the only one that wants other people to do your work for you... :-) The thing with having a very specific idea of what you want to do is that it makes it increasingly unlikely that there will be a canned solution for it that you can download. On the other hand, it also means that you have a clear idea of what you need, so a CPAN search will often turn up tools that can make your task much easier. So. There are several IMAP related libraries on CPAN. Did you search for them? Did you try any? Have you written any code? This list is for helping people improve their code writing skills, not doing the writing for you. If you want it written for you, I'm sure someone could be talked into helping you out for a reasonable fee :-) -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: testing perl
On Mon, 9 Jan 2006, Saurabh_Agarwal wrote: How can we test our Perl script? We can test our Perl script carefully. -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: testing perl
On Mon, 9 Jan 2006, Saurabh_Agarwal wrote: I want to know how to use perl -d perldoc perldebug -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Want to develop a windows based application
On Mon, 9 Jan 2006, Anish Kumar K. wrote: I want to develop a windows based application with PERL. Can anyone tell me which is best way to go.. Make it web-based and then access it from IE or Firefox on Windows or any other platform. That's often the easiest way to do it. If you want a graphical Windows desktop program, your best bet is probably using one of the cross-platform graphical toolkits like Tk or WxWindows. Tk is older and as such better known; WxWindows is newer and seems to do a better job of actually looking like a proper Windows (or X11, or Mac, etc) application. But to get this to work, I think you'll need to bundle both Perl and the graphical libraries along with your script, as neither of these is typically available on Windows. I'm sure that there's a way to do it -- and reading up on the documentation for Perl/Tk or Perl/WxWindows will probably lead to useful sugggestions -- but then this is the point where, as I noted above, I personally usually find it easier to just cheat and develop a web application instead. -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: why a.pl is faster than b.pl
On Thu, 29 Dec 2005, Bob Showalter wrote: Jeff Pang wrote: Hi,bob, You said: 3. It will probably be faster to use a single regex of the format: /pata|patb|patc|patd/ In fact maybe you are wrong on this. Darn. First time this year :-) Based on my test case,the RE written as below: /pata/ || /patb/ || /patc/ || /patd/ is much faster than yours. OK. Perhaps its due to backtracking. Go with what works! Several Perl books, including _Mastering Regular Expressions_ and, if I remember correctly, _Learning Perl_, use variants of this example. In essence, yes, if you want to match one of several constant strings like this, the match will happen faster with a series of static regexes than it would wwith one compound regex with alternation. -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Each char / letter -- array from string value
On Wed, 28 Dec 2005, Umesh T G wrote: I want an alternative solution, if any. Here's one: $ perl -le '$i = abcd; @j = split //, $i; print join \n, @j;' a b c d $ -- Chris Devers 0ª¸IQ'éL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: why a.pl is faster than b.pl
On Wed, 28 Dec 2005, Jeff Pang wrote: Why the a.pl is faster than b.pl? I think ever the resulte should be opposite.Thanks. The easiest way to answer such questions is to benchmark and profile where the time in each script is being spent. These two scripts are so different in composition that it isn't immediately obvious to me how they're similar or dis-similar. You have two approaches you can try for answering such questions: * have two nearly identical scripts, and measure how the small different part impacts performance. * break each script into components and measure how long each component takes to complete its task. These approaches can be intermixed as needed, but it's up to you to do the fundamental measuring of your code for yourself. Distill the question down to something clearer -- why is statement (or subroutine) A faster than statement B while having the same result -- and you may find more concrete advice from the list members. -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: GD::Help !
On Sun, 25 Dec 2005, S Khadar wrote: I am using GD::Graph for developing an online graph - What I need is a (GD::Graphpoints) - Graph - I have already done this and works fine, Now I want to draw a line (best fit straight line / trends line (linear) ) through maximum number of points in this graph and I want to circle them also . So just tell me, is there any way to draw best fit straight line through the maximum number of points on a GD::Graph image. Best fit line is mainly a statistical concept, and CPAN has multiple modules for dealing with statistics. A search on http://search.cpan.org for best fit turns up multiple hits, with the first one being the documentation for Statistics::LineFit: http://search.cpan.org/~randerson/Statistics-LineFit/lib/Statistics/LineFit.pm Using that module or one like it might be able to give you the coordinates you need to add to your GD::Graph graph, but sorting out how to do this will depend on how your overall code has been written. -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- 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 a number out of a string....
On Wed, 28 Dec 2005, David Gilden wrote: How does one just get the number part out of a string? The script below just prints 1. Right. All it's doing is reporting a successful, true, match. You need to fix where the parentheses are being used: foreach $str (@str) { $num = ($str =~ /\d+/); print $str : $num\n; } foreach (@str) { ( $num = $_ ) =~ /\d+/; print $_ : $num\n; } That should work better, and also avoids the confusing and unnecessary $str temporary scalar that looks too much like the $str[] array. Also, it's usefully indented, because Readability Matters. -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Autosizing Cells
On Sat, 24 Dec 2005, Brian Bernard wrote: Is there any way to auto-size cells when you are generating a CSV file using Perl (without using any additional modules)? Do you understand what CSV is? It's just a plain text representation of tabular data, with rows separated by newlines and columns separated by commas. For example: Album,Artist,Year Abbey Road,The Beatles,1969 Elephant,The White Stripes,2003 That's it. Save those three lines as, say, albums.csv, and it would be a perfectly good CSV file exactly as is. CSV is the quintessential quick dirty file format. It has no concept of formatting the data in any way -- field size, colors, fonts, etc -- because it's just plain ASCII text with some arbitrary characters thrown in as impromptu field delimiters. It's not even very good at this, because if the text you want to store happens to have that delimiter character, then the columns in that row go out of whack. Album,Artist,Year The Dropper,Medeski, Martin, Wood,1996 Oops. Too many columns. Now you have to start making decisions. You have two or three choices: come up with some kind of escape character so that the delimiter only counts when it hasn't been escaped -- Album,Artist,Year The Dropper,Medeski\,\ Martin\,\ \\ Wood,1996 -- or use a different character to separate fields in the text -- Album|Artist|Year The Dropper|Medeski, Martin, Wood|1996 -- or perhaps wrap columns in additional quotation characters -- Album,Artist,Year The Dropper,Medeski, Martin, Wood,1996 -- but either way, you just sacrificed a lot of the simplicity of CSV, because now anyone trying to parse the data has to figure out which of these arbitrary adaptations to the format you had to make in order to keep the columns clean in the data. SO. Let's back up a little. You keep asking these questions about how to work with CSV, but you're clearly trying to use it in ways that it just isn't good at. If you want the things you're asking for -- formatted cells, custom column widths, predictable field boundaries, etc -- then maybe CSV isn't a suitable task for what you need. As was suggested the last time this came up, an Excel spreadsheet file is a popular and robust way to do the things you're asking for, but the minor tradeoff is that, unless you want to directly work on the Excel binary format by hand -- hint, you do not want to do this -- then you have to use a CPAN module like Spreadsheet::WriteExcel. This really isn't very hard to do, and would make your task much easier. Alternatively, you may wish to format your data as XML, which would be good for representing the data, but less so for representing the format unless you take the additional step of adding XSL or whatever to describe how to display the XML data. albumAbbey Road/albumartistThe Beatles/artistyear1969/year albumElephant/albumartistThe White Stripes/artistyear2003/year albumThe Dropper/albumartistMedeski, Martin, Wood/artistyear1996/year Or to take most of the format issue out of the equation altogether, you could just use an HTML table: the data wouldn't be as well represented as it would with XML, but then that's also a problem with CSV, so you're no worse off, but now you can use HTML formatting or CSS to decorate the data in just about any way you would care to try. table trtdAlbum/tdtdArtist/tdtdYear/td/tr trtdAbbey Road/tdtdThe Beatles/tdtd1969/td/tr trtdElephant/tdtdThe White Stripes/tdtd2003/td/tr trtdThe Dropper/tdtdMedeski, Martin, Wood/tdtd1996/td/tr /table The nice thing about XML or HTML here is that, while the formats are complex enough to support a rich library of CPAN modules for generating them -- and you're strongly recommended to look at some of these -- the formats are still simple enough that you can realistically produce the data with straight core Perl and no external CPAN dependencies. So if that's really a stumbling block for you, this is a way around it. In any event, it seems like you need to reassess what you're trying to do here. The questions you're asking don't make sense at all for working with pure CSV data, which implies that you're either trying to do more than is feasible with data files you're getting from somewhere else, or you're trying to provide data to somewhere else in a format that can't do all the things you need it to do. Either way, considering a different way to represent your data would probably make your task much simpler. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Distribution of words length
On Fri, 23 Dec 2005, Andrej Kastrin wrote: Hi, I'm totally confuse, while I haven't any idea how to solve my problem. I have n lines text with one word in each line and I have to make a frequency distribution of words length. If I have text: hfdjhgsj #length=8 abcabc #length=6 adr #length=3 bhvfgt #length=6 vvv #lengt=3 So, the output of my parser shold be something like: 8 1 # while there is 1 word 8 characters long 6 2 # 2 words with 6 characters 3 2 # ... I know that I should use hashes, but I have no idea where to start. Thanks in advance for any pointers Here's one way to do it, or the skeleton of a way. You'll have to flesh out the details for yourself: my $file = whatever; my @list = get_words_from( $file ); my %word_length; foreach my $word ( @list ) { $word_length{ length $word }++; } foreach my $count ( sort keys %word_length ) { print Length: $count \t Words: $word_length{$count}\n; } That or something like it should do what you're asking for. -- Chris Devers ¦Ñÿ²,s´î -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: for send an email
On Sat, 24 Dec 2005, Rafael Morales wrote: I need to send an email to some clients, so I need to know if their mail client can accept html format or just text format. How can know that ???, I think that there is, some cpan module to do that however I haven't found it. The mail sender has no way of knowing what client the recipient will be using, or what capabilities it will have. The polite thing is to only send plain text email ever, but we lost that fight years ago. The next most polite thing is to figure out how to send a multipart message with both HTML and plain-text components, so that the mail client can decide for itself, at the recipient's preference, whether to display the plain or formatted version of the message. Figuring out how to do this is left as an exercise for the reader. Could you help me please with this homwork ??? thank you very very much. Regards. Ah, you've found the wrong list. You're looking for [EMAIL PROTECTED] Note that it may not exist yet. Setting it up is left as an exercise for the reader. :-) -- Chris Devers -- 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 to model discounts in commerce app?
On Thu, 22 Dec 2005 [EMAIL PROTECTED] wrote: This is not strictly a Perl or Beginner question, but since I am implementing this is Perl I thought I'd run it by the list Any suggestions on how to flexibly model coupons/discounts in an SQL backed commerce app? (bundle discounts, shipping modifiers, %off item/type, etc.) Approaches to this would depend deeply on how the rest of the system is implemented, including both your code logic and data model, as well as how your organization wanted to handle things like coupons. For example, should coupons have a limited run, with constraints on how many can be in circulation? Should they be tied to specific user accounts? Should there be blanket VIP or employee discounts, and if so, should there be any restrictions on what customers can have them and what processes or staff on your side can honor them? That in particular is really a business decision more than a technical one, and figuring out how you want to address that decision should answer a lot of the details about how you'll end up implementing it. -- Chris Devers FORg ÉQ- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Logic and Rules
On Thu, 22 Dec 2005, The Ghost wrote: I know this isn't a beginners question, but I didn't see any other mailing lists for it. I have about 40 flow charts I need to make into code. From a certain point of view, isn't *every* computer program, in *any* language, nothing more than the coded implementation of a flow chart ? Hint: yes, they are. if ( condition ) { do_something_with( @args ) } elsif ( condition ) { do_something_else_with( @args ) } else { die Can't do anything with @args; } That's standard software logic, and it's also the kind of thing that a typical simple flow chart would do. So. Is there something unusually exotic or complex about these flow charts? Why can't you just implement the 40 scripts that would be required to have these charts usable as software? I don't see what's so complicated here. Are you overthinking this, or am I underthinking it? -- Chris Devers 2V½°ªO5Ñýå -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Regex assistance
On Sat, 17 Dec 2005, M. Lewis wrote: Charles K. Clarkson wrote: M. Lewis mailto:[EMAIL PROTECTED] wrote: : But I don't think the following regex is really doing that: : : /micr[qw]o[-]ca[a]p[k][s]/i : : Suggestions, corrections welcome. /Microcap|Micro-cap|MicroCaap|Micrqocap|MicrwoCap|MicroCapks/ One advantage of this regex is that new obfuscations can be added very easily. HTH, Charles K. Clarkson Thanks Charles. I see your point. Initially I had that for up to maybe 3 or 4 variations. Then I thought I was improving it via the regex. Your method is certainly clear without even thinking about it a whole lot. ... of course, the more robust solution is to just install SpamAssassin. If you run SA with the Bayesian filtering -- the default now, I think -- it should automatically learn to pick up on junk like this over time. Plus, it uses a few hundred other metrics for determining if a message is spam, including querying whether messages, URLs in messages, and mail servers messages flow through are on blacklists. Your time and your life is too valuable to spend it thinking this much about spam. Take your life back. Just use SpamAssassin and get on with more interesting things :-) -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: sub args as pointers or values?
On Fri, 16 Dec 2005, Bryan R Harris wrote: I remember from my C++ class that when you pass arguments to subroutines you can pass them either as a pointer to the real variable (so you modify the original if you change it), or as a copy (which you can change all you want and not affect the original). The terminology I was taught for this was pass by reference to denote sending around pointers to the same physical memory location, and pass by value to denote sending around abstract logical pieces of information that are typically copies of the original variable. Like most languages, Perl has ways to do both of these. Normal argument passing in Perl is basically like pass by value or pass by copy. You don't generally have to do anything extra to get this behavior. To pass a reference to a variable to a subroutine, prefix the variable name with a backslash: \%myhash, [EMAIL PROTECTED], etc. You can capture this reference into a scalar -- $hashref = \%myhash -- and then access the contents of the reference by dereferencing: $$hashref{KEY} = VALUE; This is explained in detail in perldoc's perlref and perlobj pages: http://perldoc.perl.org/perlref.html http://perldoc.perl.org/perlobj.html It's also in books like _Learning Perl Objects, References Modules_ and _Object Oriented Perl_: http://www.oreilly.com/catalog/lrnperlorm/ http://www.amazon.com/exec/obidos/tg/detail/-/0596004788?v=glance http://books.perl.org/book/200 http://www.manning.com/Conway/ http://www.amazon.com/exec/obidos/tg/detail/-/188491?v=glance http://books.perl.org/book/171 -- Chris Devers Ù³ÄCIü[Ð-Q -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: press key to external program
On Fri, 16 Dec 2005, Ing. Branislav Gerzo wrote: I unpack some files in my script with external unpacker (unrar, unzip, unarj, unace...). But some files are passworded, to continue in script I have to press some key. It is some easy way how to do this ? If you have to interact with a text-mode program, curses may help you. http://www.perl.com/doc/FAQs/FAQ/oldfaq-html/Q3.8.html ( ^ possibly outdated advice ) http://search.cpan.org/dist/Curses/ http://search.cpan.org/dist/Curses/gen/make.Curses.pm -- Chris Devers ÑGÍô -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Migration of Perl from older version - need help
On Thu, 15 Dec 2005, Venkat Kumar wrote: I am new to Perl. Can some one please help me by giving some tips that I need to look into during migration of an older version of Perl script (CGI). What is the stable version of Perl at this moment? 5.8.mumble. I think 5.8.6, last I checked. In general, when upgrading the system copy of Perl, you usually don't have to make any changes to your scripts. It isn't a bad idea to bring them up to date with modern programming constructs, but if the older stuff isn't broken, you don't have to change things. -- Chris Devers ôJz×Âvr£¿E -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Migration of Perl from older version - need help
On Fri, 16 Dec 2005, Jeff Pang wrote: We have lots of linux OS which version is RedHad 9,kernel 2.4.x.There are many perl scripts and programs running on them.If I update the kernel from 2.4.x to 2.6.x,would it affect the current perl programs?Thanks. It shouldn't be a problem. Unless you have Perl scripts that directly poke at the Linux kernel, I'd expect nearly all scripts (Perl and otherwise) to be mostly immune to changes in the kernel. This is roughly equivalent to the way that you almost never have to reinstall all your software every time you run Windows Update on your PC or Software Update on your Mac or up2date or whatever on Red Hat Linux. Modern systems have long been designed in layers so that internal changes to one layer (e.g. kernel updates) shouldn't matter to software at other layers (e.g. Perl or Perl scripts) that depend on services from those underlying layers. (This is also like how OSI and TCP/IP work -- changes at one layer such as the transport [think kernel] aren't visible and don't matter to services at a higher layer such as the application [think Perl].) So, in general, don't worry about it too much. Test to be sure, but you are very likely to find that things just continue to work. -- Chris Devers pÝU·¡qÃRá² -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Backing Up Files to a Remote Server
On Wed, 14 Dec 2005, Adedayo Adeyeye wrote: Please can someone please help me with a script that can basically do two things: 1.check that a file was created today 2.backup that file to a remote server This is to be done on a windows platform. I'll schedule this script to run at the end of everyday. Sounds like an interesting project. How much have you budgeted to pay someone to do this for you? If you want something for free, you're going to have show us the code you have already tried. I didn't notice any in your email. Maybe I wasn't looking hard enough. Demonstrate that you're trying to solve this yourself, and we will be happy answering any questions that come up as you're learning. Starting points: http://learn.perl.org/, O'Reilly books, Google.com. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: [SPAM DETECT] New lines are not removed using HTML::Strip::Whitespace module
On Tue, 13 Dec 2005, Durai raj wrote: Thanks for the reply. Is there any other perl modules or tools available to remove the white space in HTML and JavaScript pages? Hang on -- why do you want to remove white space? To make serving content faster consume less bandwidth? If so, you might want to consider a different approach: use mod_gzip with Apache to dynamically compress your outgoing HTTP content. http://sourceforge.net/projects/mod-gzip/ http://www.schroepl.net/projekte/mod_gzip/ Most client browsers, including IE, support gzip compression: http://www.schroepl.net/projekte/mod_gzip/browser.htm Under Apache2, mod_deflate seems to be similar: http://httpd.apache.org/docs/2.0/mod/mod_deflate.html -- Chris Devers ªíÄMh6ߨ)# -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: convert string from lowercase to uppercase
On Mon, 12 Dec 2005, Jenny Chen wrote: Does anyone know how to convert a string in lower case to upper case in Perl? Thanks. Undoubtedly. How did you try to do it ? Did you try the s/// substitution feature ? perldoc -f s Did you try the tr/// transliteration operator ? perldoc -f tr Did you try the uc() uppercase command ? perldoc -f uc uc() is probably the one you want, but the others offer more flexibility and can be preferable in certain contexts. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: $i++
On Sun, 11 Dec 2005, Octavian Rasnita wrote: Can anyone explain why: $i++; is faster Not that I know for sure, but I'd imagine the explanation is that, deep in the bowels of Perl, the ++ operator is optimized in a way that a more generic operator like += or = can't be. But I could be wrong. How much faster is it? -- Chris Devers ~Ò#Gn¹$¬äð -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: $i++
On Sun, 11 Dec 2005, Octavian Rasnita wrote: Here is the test script: for(1 .. 5000) { $i += 1; #$i = 1; #$i++; } print times(); For $i += 1: 11.9210.03100 For $i = 1: 11.6250.01500 For $i++: 9.2960.03100 So, $i=1 takes 25.05% more time to run than $i++ and $i+=1 takes 28.24% more time than $i++. I have made the test for more times, and the results were almost the same. Sorry, I'm confused. These appear to do three different things. With $i += 1 the $i variable is declared once, then assigned 1 more 50_000_000 times. With $i = 1 the $i variable is assigned 1, 50_000_000 times. With $i++ the $i variable is incremented 50_000_000 times. It looks like the assignment is the bottleneck. After that, it looks like += is slightly slower because it has to look up and assign the value each time, while the other version is assigning a constant and so has been optimized at compile time. But that's mainly a guess... -- Chris Devers tìçÎÆgº -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: z
On Sat, 10 Dec 2005, Beau E. Cox wrote: Hi beginners - Aloha = Beau; [EMAIL PROTECTED] 2005-12-10 You don't say! :-) -- Chris Devers ·¾fm)cÓTO¥Ü -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Perl IDE with web ?
On Fri, 9 Dec 2005, Michael Gale wrote: I am looking for a Perl IDE with possible html component, currently I have been using either vi or Scite. Both work well except I need to increase my productivity a little, so hopefully a decent IDE will help. Vim. http://vim.sf.net/ All your Vi finger memory will transfer over to it at once, but it's a far more modern and flexible take on the program. If you want to set it up to work on HTML or other languages, it can do that. If you want things like syntax highlighting auto-indentation, it can do that. Plus, it has a nice GUI mode (Gvim) that will run on any of the main operating systems -- Linux, Windows, etc. Any major functionality you want that Vim doesn't seem to cover? I don't usually (err, ever) use the big commercial IDEs (VisualStudio, Code Warrior, etc), so I'm not sure what functionality they have that people want and can't get out of something simpler like Vim or Emacs... -- Chris Devers HåJSOtØu¨9 -- 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 to promote the efficiency
On Fri, 9 Dec 2005, Jennifer Garner wrote: I think you have understanded wrongly with my meaning. The result of $low{ $1 }++ is no use for me.I just want the frequency of IP exists. For example, if there are some IPs exists in '22.33.44.0' : 22.33.44.11 22.33.44.22 22.33.44.22 22.33.44.33 22.33.44.33 22.33.44.44 22.33.44.55 Now I only want the uniq times of all IP appeared,this is 5. So, some kind of structure like foreach @ip { $seen_ip{ $_ }++; } And then work on the keys in the %seen_ip hash. -- Chris Devers ÒñÙ§ÛkN» -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Filering a file
On Mon, 5 Dec 2005, Sean Davis wrote: See here: http://mumble.mumble.ua Please do not link to this site. These are pirated copies of the books in question, hosted on a Ukranian web server without the authorization of the publishers or authors of the books in question. There are legit ways to get access to these books, including O'Reilly's Safari book subscription service, your favorite local or online bookstores, and good old public libraries. I'd have expected someone with a .gov address to be more cognizant of such flagrant circumvention of copyright law... :-) -- Chris Devers ÉAmkÐÞáØq -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Why not to use env (was Re: Perl executable pathname needs to be hardwired?)
On Sat, 3 Dec 2005, Randal L. Schwartz wrote: Chris == Chris Devers [EMAIL PROTECTED] writes: Chris My understanding is that the Python idiom is to avoid putting the full Chris path, in favor of something like Chris #!/usr/bin/env python This won't work if env is not in /usr/bin (like say, /bin/env). Right. My assumption is that the Python idiom must have arisen from a time when the language was new enough that you couldn't depend on it being somewhere like /usr/bin, but (apparently) /usr/bin/env was more likely to exist and to do the right thing. I guess. Chris #!env python This won't work if env is not in your current directory! (odds on that, 0% unless you're cd'ed to /usr/bin or /bin, see above.) Right again. I didn't mean to pass this off as here's what you should do, so much as here's what I'm cargo-culting from what I've seen in Python examples. :-) -- Chris Devers ¼5£øÜÞÄ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Perl executable pathname needs to be hardwired?
On Fri, 2 Dec 2005, Adriano Ferreira wrote: What's the rationale for hardwiring the Perl executable pathname into the Perl interpreter? It is some oddity to guarantee Perl can find its library via a relative path? Is it a safety thing? Yeah, basically. Historically, Unix users could depend on a copy of Perl in /usr/bin from their vendor, and maybe a custom-installed one somewhere like /opt/bin or /usr/local/bin. With that in mind, using one of those paths usually would do something useful. My understanding is that the Python idiom is to avoid putting the full path, in favor of something like #!/usr/bin/env python #!env python on grounds that Python may not be quite as common, but you could depend on the `env` command being available, so as long as `python` was in the $PATH somewhere, invoking it this way should work. That makes sense, but now that I think about it I'm not clear why they don't just use #!python which seems like it should amount to the same thing. Anyway, there isn't anything stopping you from doing the same sort of thing with your Perl scripts, but, out of habit as much as anything else, this isn't how most Perl hackers write their code. I don't see much harm in it though, and I could picture it making some scripts more portable if they're going to be running on systems where you can't depend on a copy of the Perl binary being in one of the usual places. -- Chris Devers zOm -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Perl executable pathname needs to be hardwired?
On Fri, 2 Dec 2005, Adriano Ferreira wrote: I see your point, Chris. What I was thinking about was the trouble to realocate the interpreter if you have a perl binary instead of compiling it from the source. If you use a perl compiled to be in /usr/local/bin in a different path like '/home/me/bin', it works sometimes and other times it will fail because of path assumptions, which I don't know exactly what they are. This mostly happens with Perl modules dependent on shared libraries. ...of course, the lesson there is don't move the perl binary :-) If for some reason you need a copy in /home/me/bin instead of or in addition to the one in /usr/bin or /usr/local/bin, then build your own copy from source with PREFIX defined as /home/me. Look over the notes in the README as well as the Makefile.PL arguments available in the copy of the Perl source you download for more specific instructions. But anyway, yeah. In general, you can't depend on things working consistently if you just start randomly moving around compiled programs and libraries. Sometimes it won't matter, but other times, the results just won't be predictable. -- Chris Devers T/wò-ñgm§V -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Archive
On Fri, 2 Dec 2005, Brent Clark wrote: Anyone know if theres an archive link for this mailing list. Presumably :-) Tried Google? http://www.google.com/search?q=perl+beginners+mailing+list+archive That refers, among other things, to the following FAQ entry: 1.4 - Is there an archive on the web? Yes, there is. It is located at: http://archive.develooper.com/beginners%40perl.org/ http://learn.perl.org/beginners-faq#1.4%20%20is%20there%20an%20archive%20on%20the%20web The develooper.com URL now redirects to nntp.perl.org: http://www.nntp.perl.org/group/perl.beginners/ Which has the archive you're looking for. Ain't Google a marvelous thing? :-) -- Chris Devers 2þç/VQÈÑýBU~ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: recursive search
On Fri, 2 Dec 2005, The Ghost wrote: I want to know how many new line chars there are in all files in a directory (and it's subdirectories). What's the best way? I'm sure this isn't how you want to do it, but this might work: $ cat `find . -type f` | wc -l It'll choke if you have too many files in the directory in question, as there are limits to how long the argument list can be in the shell, but provided that you don't exceed that limit, this will get you a quick and dirty answer to your question. Otherwise, you'll need to build up a list with File::Find or similar module, then work through the list looking for newline chatacters for each file in that list. It should get the same result as above, but will take more hand-coding to get to the final result, and it shouldn't hit the limitation of too many files that the shell approach will have. -- Chris Devers * -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Reading xls file
On Thu, 1 Dec 2005, Rob Coops wrote: Then again Chris here is asking for a way to read XLS files not a way to write them... Doh! Of course, I meant Spreadsheet::ParseExcel :-) -- Chris Devers xô©l71Æþ; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Reading xls file
On Wed, 30 Nov 2005, Pant, Hridyesh wrote: I want to store column data of xls file in array. E.g. $array[0]=1st column of xls sheet. $array[1]=2st column of xls sheet. $array[2]=3st column of xls sheet. ... etc Can anybody help me... Probably, I'm sure someone could. What did your search for Excel-related modules on CPAN turn up? When you found Spreadsheet::WriteExcel, as I have no doubt that you did, did you read the documentation for it, and the sample code provided? When you tried using the module, what happened? Where is your code? This STILL isn't the please do my homework for me list :-) -- Chris Devers eD¯!î×/.Z$ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: From column to row?
On Mon, 28 Nov 2005, Andrej Kastrin wrote: Hi, I am totally NOOB in Perl and here is my first problem, which I couldn't solve... I have column data in file xy.txt, which looks like: A B C ABCDD .. . Now I have to transform this to row data file in the following way: A,B,C,ABCDD Is that possible? Yes, it's possible. However, your description of the result you want doesn't seem to match with the subject line you used -- I was expecting that you want output like ABCA, ABCB.., ABCD., ABCD, ABCD. Which is it? Regardless, either way is possible. What have you tried so far? Anything? We can only help critique code you've attempted yourself. This is not a free script writing service. -- Chris Devers ÑnÜéXrÓ~k» -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: want to install
On Mon, 28 Nov 2005, Andreas Schroeder wrote: Hello? Does someone know, why I can't install the Glib-module on my perl? Nope! -- Chris Devers ²S%OÊ¢*îÖ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Captcha Images
On Sat, 26 Nov 2005, Mike Blezien wrote: we are currently implementing the Authen/Captcha validation scheme into a registration form. been searching Google to locate alternative images that can be used inplace of the default images used by the module, but without much luck locating them. Does any one know where these type of images maybe found, or if someone on the list my have create their own and my wish to share them :) Aren't they being generated dynamically, taking random test and applying distortion to the rendered bitmap of that text ? If you just had a library of, say, a dozen or even a few dozen of these images, it wouldn't be that hard to automate logging in through the canned captcha images, once it's known that there is a small pool of images to identify. To be effective, I'd imagine they have to be made dynamically. There should be multiple modules to help do this sort of thing. Have you taken a look for 'captcha' on CPAN? -- Chris Devers ~ENÓâ±þÜj²K -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: 15 Million RAW
On Fri, 25 Nov 2005, Gary Stainburn wrote: Here's my 2peneth. Avoid regex. While it's powerfull, it's also expensive. Short but sweet And useful! Because we know that regular expressions are the problem here, right? Err, wait, we haven't seen any code, or any benchmarks, so we don't. Efficient regexes run efficiently. Inefficient regexes run inefficiently. Measuring can help identify potential problems. But in this case, we don't even know if that's where the problem lies. -- Chris Devers è*B)¢O¯ùPÈ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: HTTP Posting in Perl
On Fri, 25 Nov 2005, Mazhar wrote: I have a requirement where in i have to post a message to a Mail Server with all the subject, To address everything. But the message sent should be posted on port 80. Please suggest me something so that i can work it out Okay. http://search.cpan.org/ -- Chris Devers -- 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 recognize strange subject in a mail ?
On Fri, 25 Nov 2005, Gerard Robin wrote: I knew the package debian spamassassin but the description of the package is no clear about a few points. Fortunately, they have a web site with copious documentation :-) 1. if the spams are deleted on the server or on my hard disk. I have a slow connection (not the ADSL ;-)) That's up to you. The typical configuration has SpamAssassin running on the server, invoked by a tool such as procmail or another MTA. SpamAssassin itself doesn't delete anything, it just provides estimations of how likely a message is to be spam or not-spam; it's up to your MTA (procmail, etc) or mail client (mutt, Thunderbird, etc) to decide how to act on the message headers that SpamAssassin adds. Typically, for a score of 5.0 or higher, one might move the message to a spamtrap folder which can be periodically looked over to make sure that no legit mail is getting mis-flagged. If the score is, say, 10 or 15 or higher, then maybe you just want to delete automatically. If the score is above a certain threshold you can have SpamAssassin automatically train on the message as a spam sample, and likewise as a non-spam sample if the score is below some threshold. It's all up to you how to use it. 2. if I can check which mails are marked as to delete and when I decide to do so, if they are truly deleted. Sure, see above, but basically SA just adds headers, and it's up to you or your mail management software to determine how to use those headers. 3. if the documentation is understandable in a finite time. See for yourself at http://spamassassin.apache.org/doc.html or check out the O'Reilly book (http://www.oreilly.com/catalog/spamassassin/). My script is dummy compared to spamassassin, but to write it, is an exercice like another to learn perl, and perhaps I must thanks the spammers to give me some exercices from time to time :-) Sure, but as I said before, there's little chance that your version of the wheel will be any rounder than SA, and a very strong chance that it will be much less round. SpamAssassin is pretty easy to extend, and it's mostly written in Perl, so if you want to have something productive to practice on, you can start adding or modifying SA rules in Perl. -- Chris Devers ¤y'a½y;'Í -- 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 recognize strange subject in a mail ?
On Fri, 25 Nov 2005, Gerard Robin wrote: Can someone give me some advices to recognize such subject if it's possible. Yes, it's possible. The solution is already available, it's called SpamAssassin, and if you're trying to hand-roll your own approach to this problem, you're reinventing an already impressively round wheel. http://spamassassin.apache.org/ http://search.cpan.org/dist/Mail-SpamAssassin/lib/Mail/SpamAssassin.pm Now if SpamAssassin does an inadequate job of filtering based on garbage subject lines, there's a very easy mechanism for adding rules to it so that you can make it do a better job. My strong hunch though is that, out of the box, it will already come with dozens of rules that can be applied to identifying spam just based on characteristics of the subject header alone, as well as hundreds of rules for matching based on other properties, including other headers and the message body itself. Plus, just to make things even better, SpamAssassin can do Bayesian statistical analysis of the messages that *you* consider to be spam or not-spam, so that even messages that slip through the canned rules can still be identified just based on their similarity to spam you've received in the past. Outdoing all this would take considerable effort and a lot of time. You have, I am sure, better ways to spend your time :-) Install SpamAssassin and go find a better way to spend your time than managing your junk mail -- you'll be glad you did :-) -- Chris Devers R±Ð6×ÄÜì -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: 15 Million RAW
On Thu, 24 Nov 2005, Pierre Smolarek wrote: Lorenzo Caggioni wrote: The program I written takes 25 sec for 10.000 line... too much How quickly do you need to it if 25 seconds is too long? If 10,000 lines take 25 seconds, you're doing 400 lines per second. At that rate, 15,000,000 lines will take 37,500 seconds, or 10h25m. While asking for a firmer definition for faster is a fair question, it's fair to assume that he wants to do better than 10.4 hours :-) That said, the canned answer applies here. If the problem is -- 1 Read Line from an input file 2 Validate the raw (for example: is second char == 2?) 3 Split the line 4 Write the validated and splitted raw in an output file with a different order (for example: last 2 digits I have to write as first 2 digits) -- then, in order to give *any* constructive advice, we need: * to see the code in question * to know if the code has been benchmarked If we can't see the code, we can't possibly offer useful suggestions. If we don't have benchmark info to know what part of the code is taking so long, we can't even speculate as to where to start optimizing things. One of the suggestions in Damian Conway's _Perl Best Practices_ is a simple piece of advice: Don't Optimize Code -- Benchmark It. For details, look over this excerpt from the book: http://www.perl.com/lpt/a/2005/07/14/bestpractices.html It's sound advice. The book's next suggestion -- which I can't seem to find a reference to online, so you're just going to have to find a copy of the book itself -- is Don't optimize data structures -- measure them. This is also sound advice. If you use a module like Devel::Size to determine how space is being allocated, you can get a better sense of where you might be choking on data and, in turn, have a sense of where you need to fix things. Once you've used such tools to map out how your program is consuming time and space, you can start making decisions about how to reduce that consumption, by speeding up critical sections, reducing memory use, or just throwing more RAM and CPU at the problem if you're starved there and software optimizations seem like they might not be enough. But until you've figured out where the time is being spent, or what system resource is being exhausted, you can't properly address the problem. Really, you could do a whole lot worse than by just getting a copy of _Perl Best Practices_ and using its advice to rewrite your program from scratch. Almost everyone could improve their code this way... :-) -- Chris Devers O3Õ×lQzSó® -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: number of spaces in a given sentence using regular expression.
On Tue, 22 Nov 2005, Bob Showalter wrote: [EMAIL PROTECTED] wrote: ... please give me the answers of these questions. Chris Devers will be along shortly... :~) Sorry, I was on vacation :-) Please, in the future, direct all such questions to [EMAIL PROTECTED] (You'll probably be the only subscriber to the list, but oh well.) There, have I met my obligation now? :-) -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Looking for a perl wiki or BBS
On Fri, 18 Nov 2005, Dennis G. Wicks wrote: Does anyone have any particular favorites they would suggest I look at? Search Google for Twiki or Kwiki. Both are pretty good, both are Perl based. Twiki is considerably more complex out of the box than Kwiki -- not necessarily harder to set up, mind you, just more fleshed out. This may or may not appeal to you. Keep in mind that wiki-spam is starting to be a big problem. If this wiki is for public use, you may want to consider finding ways to throttle or at least record who is changing what documents, so that if you get flooded with spam content, you can cut it off /or delete it. -- Chris Devers ) [$ÜEOÂM -- 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 to do dos2unix for entire directory
On Wed, 16 Nov 2005, Bob Showalter wrote: Santosh Reddy wrote: I want to convert all the files which are in dos format to UNIX format. perl -pi -e 's/\cM$//' * Running this on a directory of image files would be painful :-) While dos2unix seems like a simple enough utility, modern versions of it should have safety features that should prevent it from damaging non-text files. Reimplementing it fully properly in Perl is, while certainly doable, a bigger task that it may seem at first glance. If there's already a utility avilable to do exactly what you want to do, why reinvent it? Some assumption that your version of this particular wheel will be extra super duper round? Good luck with that... :-) -- Chris Devers \?Çfê ¦¸# -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: ok GD::Graph question
On Thu, 17 Nov 2005, Michael Gargiullo wrote: I've been driving myself crazy with this for a few hours, any help would be great. 1. Read the documents. 2. Write some code. 3. Show us the code you tried. Please demonstrate 1, 2, and 3, and we will be happy to assist you :-) -- Chris Devers £Hõ£·äêýì9 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: cookies
On Mon, 14 Nov 2005, S, karthik (IE03x) wrote: my $username = 'name'; my $cookiereplace = Set-Cookie: username=$username; expires= \n; print $cookiereplace print header; #print htmls To unset the cookie : my $cookiereplace = Set-Cookie: username='';; Okay, that's a start, thank you. Now, please, can you point out the documentation you were reading that led you to believe that this would do anything useful? I have a hunch you may have mis-read something :-) Here's a hint: among a great many other ways to do this, the CGI.pm module has built-in methods to handle this for you. Look up for the cookie sections of the CGI perldoc; an online version is here: http://perldoc.perl.org/CGI.html#HTTP-COOKIES Additionally, higher-level modules like CGI::Application do a lot of the work needed to make you forget that cookies are even necessary. Documentation on it is available at http://search.cpan.org/~markstos/CGI-Application/lib/CGI/Application.pm But if you just want to do things the old-fashioned way with raw cookies, don't roll your own code to do this when it's a problem that has been solved a hundred thousand times now -- just let CGI.pm do it. -- Chris Devers 0%T [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: cookies
On Mon, 14 Nov 2005, S, karthik (IE03x) wrote: Could some one help me out by explaining how to set and delete a cookie using perl... Probably. Can you help us out by showing us what code you've tried so far, /or what documentation you've read so far? Give us a hint that you've at least *tried* to answer such a Frequently Asked Question for yourself, and we'll be happy to help you out. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Hi All
On Tue, 15 Nov 2005, Santosh Reddy wrote: This is my first mail to this mailing list. I am just starting to learn Perl. Please help me in getting the basics cleared. Here's some basics: http://learn.perl.org/ Here's another: This list responds best to direct questions about specific problems. If you want open-ended help with something that you haven't yet taken any time to research for yourself, stop right there, fire up your web browser (or get out your O'Reilly books), and spend some time studying up on the copious material that is already available for people that are just learning, as you are. Once you get your feet wet, and are working on specific tasks that you need help with, feel free to send specific questions -- along the lines of why doesn't this code work? or why doesn't this line do what I think it should or how can I complete the following subroutine? -- and we will be happy to help you out. But i you just want to open-endedly get the basics cleared, then this list is utterly the wrong place to ask. Start with a web search. Start with an excellent site like learn.perl.org. Start with some independent reading and practicing. And then come back to us once you're ready for the next step. -- Chris Devers ©957ðVÓ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: info pls
On Sat, 12 Nov 2005, Ssavitha wrote: [Please] let me know the connection string in perl script to connect to SQL server. 'Please' let us know if you searched CPAN first. If you had, you would have seen the answer, along with a nice long useful description, at the top of http://search.cpan.org/dist/DBD-ODBC/ODBC.pm This uses Perl's DBI module's DBD::ODBC driver to establish an ODBC connection to the database server of your choice. -- Chris Devers 3åÄY÷S³c¡ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: uninitialized variable
On Tue, 1 Nov 2005, Adedayo Adeyeye wrote: my $action = param('form_action'); Try setting a default value when 'form_action' isn't specified: my $action = param('form_action') or ''; Or set it to 0, or 'do nothing' or undef, or whatever is appropriate. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: uninitialized variable
On Tue, 1 Nov 2005 [EMAIL PROTECTED] wrote: from Perl Best Practices use my $action = param('form_action') | | q{ } instead of or ' ' Good catch. Yes, that's clearer than simple apostrophes. However, you probably didn't really mean | | over ||, right ? :-) I still think 'or' is clearer than '||' for this kind of thing, but if PBP had a different rationale I can't remember what it was... -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: uninitialized variable
On Tue, 1 Nov 2005, Adedayo Adeyeye wrote: I'm also trying to connect to an mssql db from a cgi, and I'm getting the following error: Cannot connect: [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. (SQL-08001)[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()). (SQL-01000)(DBD: db_login/SQLConnect err=-1)Aborting at C:\Savant\cgi-bin\connect_rodopi.cgi line ... This seems to be the meat of the problem: SQL Server does not exist or access denied Sounds like a DB admin issue to me. Can you use the same login credentials to connect to the database via some other means than the CGI script you're writing? If you can't, then there's the problem; if you can, then something about using that user / password pair from the host where your CGI script is running is broken. Either way, it sounds like a SQL Server admin config issue, not CGI. -- Chris Devers by¯LcìØL è 8 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: perl compilers
On Tue, 1 Nov 2005, Brent Clark wrote: Just a thought, is it possible to compile perl code in to some type of binary format file, and then perl can execute the bin file. Just somthing I was thinking. http://www.google.com/search?q=perl+compiler But then, I'm sure you spent the three seconds it would take to do a search for the hundreds of hits that 'perl compiler' turns up before repeating this FAQ to the list, right? Of course you did :-) * * * The short answer is that yes, it's possible, with the help of tools like perlcc and Perl2EXE, but these generally don't work as well as most people would prefer. For one thing, they build everything in, so your 20 line Perl script ends up being 5 or 10 mb or more compiled because the binary has to include both the Perl executable binary as well as the binary versions of any CPAN modules your script depends on. Yow! In most cases, particularly on civilized platforms where Perl is likely to be installed on the system from the start (e.g. everything but Windows), you're better off just distributing the regular text version of your scripts. That way, they end up being smaller, faster, and much easier to maintain. But yes, if you really want to do this, it's possible. As the three second Google search I'm sure you did would have already told you :-) -- Chris Devers -- 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 to change the Owner of a file
On Mon, 31 Oct 2005, Shawn Corey wrote: Yes, you must the the recipient of the change, unless you have superuser privileges. In other words, you must be $uid. This is because many UNIX systems have quotas on how much data you can store. What?? That's hardly why this constraint exists. If anyone can make changes to any other account's files, then there's no point in having ownership constraints at all. This is the broad bedrock of Unix security. Managing user account quotas is only a small facet of that, but there's much more to it. To borrow someone else's capacity, create your file and chown to someone who doesn't have much data stored. If it has read-access for everyone, you can get the file back by copying it. Unfortunately the new version of chown prevent this. The new version of chown prevents what? I'm sorry, I'm having trouble following you, but to the extent that I do understand, the description just skims the surface of what's going on. * * * * * This topic is really beyond the scope of this list, but I'll try to do the short, short version of the topic. On Unix systems -- Linux, OSX, Solaris, BSD, Irix, etc -- every file on the system has, among other things, two fundamental properties: ownership, and permissions. Every file belongs to a specific user account, and to a group. Every file has access permissions pertaining to the user/owner, to the group, and to everyone else. The most obvious permissions are read, write, and execute; if you do a `ls -l` command, you'll see these represented as something like rwxrwxrwx -- full permissions for everyone rwxr-xr-x -- read/write/execute for owner, read/execute for others rw-rw-rw- -- read/write for everyone, no execute for anyone r--r--r-- -- read-only access for everyone, no write/execute at all --x--x--x -- execute-only for everyone, no read/write at all Etc. If someone else's file has group-read permission, and I'm in the same group, then I can read -- and so copy -- that file. If I'm not in the same group, but 'other'/'world' has read permission, then again I can read or copy the file. But if both group and world forbids access, or group permits it but I'm not in the right group, then I'm locked out, and cannot read or copy the file. That's it. Nothing about quotas. Only the owner of a file, or an administrative user (root, or someone using sudo to grant themselves root access) can change permissions on a file. Only the admin / root user can reassign ownership from one account to another account. If non-admins could do these things, then you've defeated the whole point of this privilege separation, because anyone can do anything, and you're set back to Windows 95 level security -- i.e. none at all. If this still doesn't make sense to you, then go find a good Unix book and spend half an hour reading the chapter on ownership permissions. Two excellent ones are _Unix Power Tools_ (has a drill on the cover) and _Unix Administration Handbook_ (red or purple cover with a hand-drawn cartoon illustration; the _Linux Administration Handbok_ is most of the same material but has a green cover). * * * * * But, again, please don't come to the conclusion that this model has anything to do with quota management -- it's really the other way around. Saying that things work this way to support quotas is a bit like, I don't know, perhaps saying that American drivers drive on the right side of the road because that's the side with all the signage. Well, yes, that *is* the side with all the signage, but we don't drive on that side to make reading easier, we put the signs there because that's where all the drivers are. It's a side effect, not the original purpose. Similarly, quota management is a *side effect* of the way permissions are set up -- they're something you get nearly for free once this framework is in place -- but they are not the primary purpose, nor is keeping them correct the primary motivation for why things work, or deliberately don't work in some contexts, the way they do. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Dir Command to an array
On Fri, 28 Oct 2005 [EMAIL PROTECTED] wrote: I would like to execute a dir */s command in windows and save the output into an array. I know I can do this in perl by doing executing the following command in a perl script: @allfiles = `find / -print`; You can, but you shouldn't. The tool you're looking for, on Unix or Windows, is File::Find: $ perldoc File::Find It should, I believe, be a core module with recent Perl versions. -- Chris Devers õùo¯áVѸ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: what happened to pdl.perl.org?
On Thu, 27 Oct 2005 [EMAIL PROTECTED] wrote: Does anyone know what happened to pdl.perl.org? This is supposed to the the home site of Perl PDL, a scientific programming and graphics-producing add-on for Perl. The website is defunct, and I am seeking an alternative source of information. Did you try Google? This looks promising, if modestly so: http://pdl.sourceforge.net/ The site is very un-fleshed-out, but there's at least a snapshot of the source archive -- http://pdl.sourceforge.net/PDLsnap/snapshot.html http://pdl.sourceforge.net/PDLsnap/PDL-2.4.1snap071004.tar.gz -- along with some documentation -- http://pdl.sourceforge.net/PDLdocs/ Ah. This seems to be the home page now, look here: http://pdl.sourceforge.net/WWW/ -- Chris Devers ÊÉ4ONÌ=ÎBkÒ -- 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 to decode raw G3 data to plain txt file
On Wed, 26 Oct 2005, Jeff 'japhy' Pinyan wrote: On Oct 26, J.Peng said: It's the unix 'file' command show: file 1_zhangcha_01_1000v+40.mbox 1_zhangcha_01_1000v+40.mbox: raw G3 data, byte-padded According to my /usr/share/misc/file/magic file and Google, raw G3 data is a raw fax transmission. As for parsing this format, I have absolutely no idea. When all else fails, search CPAN: http://search.cpan.org/search?query=faxmode=all The first two hits are Data::Fax and Fax::Hylafax::Client, both of which look possibly useful, though neither seems to directly mention g3 :-/ :-/ -- Chris Devers Ö¬qåUî×uÓ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: New Line Character(s)
On Wed, 26 Oct 2005, Timothy Johnson wrote: I think you can use \r instead of \n for Access and Excel. Are you sure about that? I thought Windows used \r\n as a pair (or \n\r?) for the line delimiter. But then, I don't do Windows anymore, so I could be wrong :-) -- Chris Devers }#UÙ¯¼~ºQÿ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: log filtering
On Tue, 25 Oct 2005, mynullvoid wrote: At the moment I only have my script in bash, and found that there are many issues with my script. I would appreciate if anyone can write me a script that can accomplish what this. Super. How much were you thinking of paying? Are you taking bids? (Hint: this is not a free script writing service. We can help you improve the code you're writing yourself, but if you want people to do your job or your homework for you, this is the wrong place to ask.) Posting the bash code would at least be a start. Showing, concretely, how you want to translate it to Perl is better. Showing, specifically, what you've tried so far is best. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: CPAN module for file upload/download
On Mon, 24 Oct 2005, Dhanashri Bhate wrote: Could anyone please suggest what module is available on CPAN for this? Take a look at WWW::Mechanize. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Thank you for your answer. And yesterday i was write from Nahid`s email address
On Thu, 20 Oct 2005 [EMAIL PROTECTED] wrote: Hello. Please help me write this script. Before this mail i sent to you amil, and i explained what i need. Thank you very much in advance. This list continues not to be a free script writing service. Sorry. Additionally, many of the people on the list will not receive attachments, so sending a JPG of ... something is, while quite imaginitive, not an effective way to communicate about programs. If you want help, send the material you want help with as plain text pasted directly into the body of your message, not as an attachment. Also, send specific questions -- please help me write this script is not a question we can help with, but I can't get FOO to work or why doesn't BAR work the way I expect it to are things we can help. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Need Some Guidance
On Wed, 19 Oct 2005, Gladstone Daniel - dglads wrote: I am trying to learn Perl, I was told to go out and get the Camel=3D20 Book - Programming Perl I got the book today and I was wondering if this is the best way to=3D20 Learn Pearl. Can anyone give me suggestions on how best to proceed through the book I got - Third Edition While it is a great book, and is widely considered to be the canonical reference manual for the language, it's also an intimidating piece of work, with so much detail on the trees that it can be hard to keep track of the forest, to mangle a phrase. Learning about Perl from that book might be a little like, I don't know, learning about the English language by reading a copy of the Oxford English Dictionary; it's a great resource, yes, but it probably has more value for people that are already at a basic level of understanding of the material. The companion book _Learning Perl_ might be a bit more approachable, as might _Perl Cookbook_, which has canned recipies for approaching hundreds of different common programming tasks that can be assembled together to do many of the things one would want to accomplish in Perl. The other approach is to just pick what you want your first project to be and start working on it, using the book you already have to help you get into the material. The best way to learn -- regardless of the support material (books, websites, friends, etc) -- is by doing, so you might as well get started that way. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: major newbie
On Wed, 19 Oct 2005, Brian Franco wrote: OK ...im working my way through learn perl in a weekend Okay, anything with a title like that is very safe to ignore. The book you're looking for is _Perl for System Administration_: http://www.oreilly.com/catalog/perlsysadm/ http://www.amazon.com/exec/obidos/tg/detail/-/1565926099 As for more concrete advice, that depends on the specific task. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Need Some Guidance
On Wed, 19 Oct 2005, Gladstone Daniel - dglads wrote: I noticed that there is various version of Learning Perl + Perl Cookbook The most version (Version 4) costs the most. Does it matter the version if I want to learn or do I need to get the most recent version? What is the groups thoughts? Well, on one hand it's good to be up to date, and there *will* be material in there that is now considered outdated or wrong. On the other hand, if the current 'Cookbook is $45 and you can find a remaindered copy of the original edition for $5, that's significant, and understandable. I've gotten several books this way have been mostly happy with them -- an outdated, but once authoritative, reference book is a lot more useful than no reference at all :-) That said, depending on your employer, you might be able to talk your company into buying the current edition for you. If you can make a case that having the books will make you better at your job, then sometimes they'll let you expense the price of books. It's worth a try... -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: ssh and sudo not working together....
On Mon, 17 Oct 2005, O'Brien, Bill wrote: I have this so far but it is not allowing sudo, just wondering if it is NET::SSH or that RSA type of SSH we are running? I have tried to pass numerous commands but that doesn't seem to work, how can I run numerous commands via the single SSH connection? Stepping away from Perl for a moment, if you're trying to have ssh run an interactive command, such as sudo, then you have to allocate a tty for that command to interact within. With the ssh command, you have: $ man ssh | grep -i '\-[a-z] .*alloc' -T Disable pseudo-tty allocation. -t Force pseudo-tty allocation. This can be used to execute arbi- $ Therefore, you can do things like: $ ssh -t [EMAIL PROTECTED] sudo ls -al This will connect to $host and issue the command; sudo will then come back over the ssh connection and ask you to authenticate; once that is done, sudo will then proceed as normal. So, to get back to your question, I think what you need to do is figure out a way to pass the -t argument to ssh via Net::SSH. Skimming over the perldoc at http://search.cpan.org/dist/Net-SSH/SSH.pm, it looks like you might be able to use the ssh_cmd() method to set this up. Look up the section that mentions OPTIONS_HASHREF for hints, and good luck! -- Chris Devers ÷0~g±ê -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Perldoc question...
On Mon, 17 Oct 2005, Charles K. Clarkson wrote: Octavian Rasnita mailto:[EMAIL PROTECTED] wrote: : perldoc is a program included in the perl package. : : Just run the commands: : : perldoc perldoc : perldoc perl You can run the commands from a dos (or command prompt) window on a Windows type machine. Much of the same material is also available on the web, at sites such as http://perldoc.perl.org/ You can also find a lot of the same material on the CPAN site, along with the module itself. Do a search on search on http://search.cpan.org/ for the module you're interested in and you should be able to turn up module-specific perldoc reference material. You may find reading the material this way, in a web browser, nicely formatted, with varying colors, fonts, etc, more convenient and comfortable than reading it in a DOS / *nix terminal window. -- Chris Devers D3Y¸«ñmá -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: config parser
On Mon, 17 Oct 2005, Beast wrote: To avoid hardcoding parameter in program, Im trying to make a separate file for config. However its not as simple as key/value which can be easily parse using split. Why not ? A crude split might fail, but splitting on / = / should work for the format you describe. But even that wheel doesn't need reinventing. The format your describe isn't all that different from the old Windows .ini format: [Marketing] [EMAIL PROTECTED] [EMAIL PROTECTED] subject=Test mkt body=this is a test msg for mkt [Accounting] [EMAIL PROTECTED] subject=Test acc body=this is a test msg for acct There's already a very good module to parse this format. You can write your own, but you might as well just use Config::IniFiles: http://search.cpan.org/~gcarls/Config-IniFiles/IniFiles.pm You could make this as simple or as complex as you want, but a basic script using this module should be very easy to implement. A CPAN search for 'ini' turns up several similar modules, if this one seems like overkill. Config::Abstract::Ini looks promising, as is Config::IniHash, Config::Tiny, etc. There seem to be dozens... -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: implementing links on a system command output
On Fri, 14 Oct 2005 [EMAIL PROTECTED] wrote: I have written a CGI Perl program that allows my users to view relevant data. The data is produced by a Unix application command and I have told it to write to a intranet page that looks like: What it looks like is irrelevant. The raw HTML is a little bit relevant, but the really relevant thing is the data that gets sent to the script and the results that are expected to be returned from the script. What I want to do now is create a link using CGI Perl for each H string that will pull a different data set either on a new page or on the same page embedded. Originally I just created another radio button for the new data set, but there will be 6 different views (6 different strings) and I already have 7 buttons (minus the Tape-Capacity button) and I do not want to button out myself or the users. I looked in the CGI Programming with Perl and saw an entry in there on page 269 referencing access.conf and in access.conf you enter a line with Action Tracker /cgi/track.cgi Can anyone help? I'm sorry, I'm confused by the question. You seem to want help organizing how data is presented to and retrieved from the user of your web application, but then you're asking a CGI list how to go about doing advanced Apache web server configuration. How was the access.conf suggestion supposed to help solve this problem? IF the answer to your problem is to start mucking around with Apache directives -- and so far I'm not convinced that it is -- then putting those directives in access.conf is outdated advice anyway. Modern Apache administration tends to have people put everything in httpd.conf so that there's one file to look in; some people break things into separate conf files that httpd.conf includes, but this generally isn't how it's done by people just getting started with Apache administration now. In any case, it isn't clear to me how this was supposed to solve your problem to begin with. What were you hoping would happen if you changed the behavior of /cgi/track.cgi in Apache? I think you're better off just concentrating on your HTML and CGI code for now, and leave mucking with the web server for later. Reduce the problem to a flow of desired inputs and outputs. The inputs are generally going to be forms in plain HTML documents or as generated by the output from CGI scripts; the outputs will generally be generated from CGI scripts, though in some cases could be static HTML, too. You may want to sketch things out on paper rather than just blindly start coding things. If some part of the input system is doing too much or is too confusing for users or maintainers, then break it apart as needed. You seem to be asking general systems design questions without giving enough material to clarify what the system is doing now or how it is supposed to be working differently in the future. This is only tangentally a CGI question; your first priority here seems to be to sort out exactly how this is all supposed to be interoperating in the first place. Once you have a clearer sense of that, implementing the specific components of the system should get easier for you. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Thank you for your answer. And yesterday i was write from Nahid`s email address
If you want to discuss Beginners Perl, send your messages to the beginners@perl.org list address. I am a subscriber and will see your response there, as will dozens of other helpful people. On Fri, 14 Oct 2005 [EMAIL PROTECTED] wrote: My name is Ulfet. Yesterday i was written from Nahid`s email address. So, i need to write script in PERL languiage on UNIX OS. Exactly Unix AIX (for IBM). So, i found some scripts, and me wrote some scirpt. But there are some problems. Firstly let me tell you that what i found that scripts does not work. And i get it as text and want to send you. But also i want to send you scripts which i have written. If you have samples of code you need help with, send it to the list, not to me directly. And if you want help, it is best to send clear questions with samples of code that you do not understand, or do not work the way you expect them to. Just sending a big set of programs usually doesn't get much help. And just now, i want to explain that i need a script which must be write in PERL for OS Unix AIX. That script have to take XML file and convert it to text. Shortly, that script have to take only without tags words. Example: this is a xml file and its content below nameUlfet/name age24/age I need to take Ulfet and 24. Great. That can be done. Show us what you've tried and we can try to help. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: I need help here
On Fri, 14 Oct 2005, Sreedhar reddy wrote: I am very new to PERL and I need a program to do following task. Can [you] help me [please][question-mark] I have a file with following contents. 454 NV_DS_DEFAULT_BAUDRATE_I 455 NV_DIAG_DEFAULT_BAUDRATE_I 516 NV_WCDMA_RX_LIN_VS_TEMP_I I am expecting out put like NV_DS_DEFAULT_BAUDRATE_I 454 NV_DIAG_DEFAULT_BAUDRATE_I 455 NV_WCDMA_RX_LIN_VS_TEMP_I 516 Basically it is interchanging of columns. Looking forward for your help. Yes, this is possible. Have you tried anything so far? You sent your message to beginners@perl.org and beginners-cgi@perl.org, but not [EMAIL PROTECTED] On the lists you wrote to, you need to take the effort to write at least some code, which we can then help you with. Here's a hint, but it's intentionally incomplete: sub swap_columns { my ( $first, $second ) = @_; return ( $second, $first ); } You should be able to apply that to each line of input to generate each line of output. There's lots of other ways to go about this as well though, and if you provide some code we can help you work through it. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: I need help here
You accidentally replied just to me, not to the list. Please don't do that. Send all messages to the list and I will read them there, along with all the other helpful list subscribers. On Fri, 14 Oct 2005, Sreedhar reddy wrote: I tried like this... INPUT = fopen(filename); OUTPUT -- I opened another file here to write output while(INPUT) { chomp @_; @strings = split(@_, ); print OUTPUT strings[1] + strings[0]; } But I got error [message]...Can [you] modify this program if it is correct??? If it's correct, it doesn't need to be modified, does it? :-) If you want help with your errors, you need to *tell us what the error message was*! Is the text above literally what you wrote? If so, it can't work -- INPUT isn't a valid variable name (it needs to have a 'sigil', like $, @, or %) and the OUTPUT -- I... line just looks like a comment. I assume that isn't really your code, is it? Please show the list exactly what you're doing and what's happening when you try to do it: what the exact statements are to declare your input and output files are, what the while{} loop is (this appears complete, but I want to be sure), and what the error message was. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Identifying or finding paragraphs
On Fri, 14 Oct 2005, Dave Adams wrote: How paragraphs are delimited is actually my question. In otherwords, when perl reads in my string, can it identify where the paragraphs breaks are? In my example, $text was created in wordpad where 'This is the FIRST paragraph' and 'This is the SECOND paragraph' are seperated by a paragraph break. My desired output is: This is the FIRST paragraph^PThis is the SECOND paragraph Thank you for your interest and your efforts to help me out. Very much appreciated. What's a paragraph break? I'm familiar with newlines or line breaks (\n), and I'm familiar with carriage returns (\r), but I'm not aware of an ASCII paragraph break. I *have* seen -- and in fact am using to type this very message -- a convention where two or more newlines delineate paragraph boundaries. If that fits what you're working on, then you could maybe match /\n\s*\n/ or something like that, matching a new line, zero or more spaces (I assume they wouldn't matter), then another newline. If you want to extend that to the case of the two or more newlines, as here, then you need to extend the regex. This might work: /\n\s*\n+/ But that doesn't properly check for spaces after the first newline. If that matters, you'll have to tweak it a bit further. Make sense? -- Chris Devers -- 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 to get CONVERTER script which XML file convert to text
On Thu, 13 Oct 2005 [EMAIL PROTECTED] wrote: I need to perl scriptcode which is convert XML file to txt(TEXT). Please any body help me how can i find or write this converter. Search Google for Perl's XML modules. XML::Simple might be a good one to start with. Look it up, read the documentation, get it installed, then try it out. If you have problems, show us the code you've tried, and we can try to help you. If you need more help, you have to specify [a] what you've written so far (this list is not a free script writing service), and [b] exactly what you need to accomplish (as another person noted, XML is already a text format, so you need to clarify what you want your result to be). Also, in the future, asking one list is plenty. A lot of people are on both the beginners and beginners-cgi list, so there's no need to ask us the same question twice. This question doesn't appear to have anything to do with CGI programming, so I'm deleting that CC. Again, if you have problems, show us the code you've tried, and we can try to help you. -- Chris Devers ù -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Sending HTML file as mail from mail command (mail -s )
On Thu, 13 Oct 2005, Mazhar wrote: i have a requirement where in i need to send alerts to a set of users for which i have developed a script and it is working fine. For the body of the mail i am writing into a text file everytime and i am sending across using the command, cat textfilename | mail -s Subject set of users This above is working fine i need help for sending the same textfile as a HTML file as the body of the mail please help me. Seeing as you appear to be happy with a solution that doesn't make use of Perl, it's a little biit confusing to me as to why you're asking us. Nevertheless. If textfilename contains HTML formatted text, then that's what will be sent to the recipient and, depending on the mail client on the other end, it may or may not Just Work. Depending on your platform and version of `mail`, you may be able to add a command line argument that specifies that the message body will have a certain content-type, in this case text/html. If you want to remove the ambiguity and try to guarantee that things will work, I suggest writing the whole thing in Perl, using a module such as Mail::Simple. (There's at least a dozen others that could also work, but anything with ::Simple in the name is usually promising to start with.) Read over the documentation for that module and you should be able to find examples that get you started. -- Chris Devers EB#Fm+¥ukþ¢ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: running interactively
On Wed, 12 Oct 2005, Adriano Allora wrote: I need to use a a shell-program but I cannot pass all the arguments to this program via system() function. In other words: the program doesn't accept all the arguments via command line: I need to open it and write interactively some instructions. Is there a module which works in this way? Yes: Expect.pm How can I do? Read the documentation, then write a program that uses Expect.pm. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: input web page question
On Wed, 12 Oct 2005, Luinrandir wrote: I know this question has been asked before. Then you may recognize the forthcoming answer, too... :-) I have done a search on thelist and the web.. I can't find it.. thought i saved it.. help? how do a capture a web page to a var so I can strip the html? Try writing a program. That's a popular approach. What have you tried doing so far? Show us some code. Have you looked at LWP? -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: input web page question
On Wed, 12 Oct 2005, Luinrandir wrote: there is no code yet.. i will write the code. i need the one line that get the web page $Input=?? answers like your suck.. why do you bother. Funny, I was wondering the same thing about your question :-) The answer is to look up, and read, the documentation for the LWP suite of modules. In there you will find sample code that does what you want. Plugging LWP into Google returns about two million hits; the top dozen or so all look promising for answering your question. If you didn't find any of those two million pages, then I can only assume that you haven't actually done any searching for answers yet. Once you've tried that, and have some code that you need help with, then you can expect constructive responses from members of the list. So, again. What have you tried so far? -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: input web page question
On Wed, 12 Oct 2005, Luinrandir wrote: ok this is the code i have so far there it is... since i don't know how to call/capture/open the web page and get the HTML to a variable, there is not much I can do. Once I get the HTML into a var.. i can do the rest. as to moduals.. i barly know perl.. much less moduals.. LWP has no meaning to me... don't know what it does So... as I said, try a search engine search for the term. It will take you about five seconds to get started, and thirty to have a decent answer to your question. Within five minutes, you should be well on your way to having the problem solved. I *could* just answer your question for you, but then you're going to come back to the list for every step along the way in writing your code. If, on the other hand, you figure out how to seek out your own answers for the basic questions, then you'll not need our help. I'm not trying to be a pain in the butt, I'm trying to help you. Trust me, you're better off learning how to answer questions yourself with a simple Google search. It won't always work, but in most cases, it will, and it will get your results faster than repeating a FAQ to a mailing list that has already been asked and answered a million times. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: keeping track of the 'age' of a file
On Mon, 10 Oct 2005, ZHAO, BING wrote: I am doing this CGI upload website, by saving files submitted by other people, (there is no problem with the storage capacity) Famous last words. What happens when someone points a malicious program towards your script that uploads not a simple file, but unending random data? Eventually, if you don't cut off the connection, it *will* fill up your storage. There *MUST* be an upper bound on what you will accept for uploads. *ESPECIALLY* if you're thinking of keeping these uploads around for an extended period of time. Figure out how to throttle how much data users can upload. You'll be glad you did. Better still, figure out how other people are solving this problem, as your wheel is unlikely to be any rounder than theirs are. You'll be even gladder that you didn't have to write it from scratch. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: two questions
On Thu, 6 Oct 2005, ZHAO, BING wrote: 1. How do I change the unix system background to black, mine is while which is so annoying whenever I do perl. How? Carefully. (Hint: that's not a Perl question, so this is the wrong place to ask. If you have general Unix questions, I suggest picking up a good book on it. _Unix Power Tools_ is superb, and should have sections on this sort of thing. If that book or one like it can't help you, find a Unix using friend in your area that can show you which config file to poke.) 2. How do I download perl modules form CPAN, I completely understand the 4 steps listed there, but the problem is I need the perlmodule.gar.gz file to start with, whenever I click on the module to download Don't bother with the old wget ... ; perl Makefile.PL make make test make install approach anymore; the CPAN and CPANPLUS shells make this *much* easier. Look up `perldoc CPAN` or `perldoc CPANPLUS` for more information. (by the way, I am on windows XP Secure Shell to a Unix machine), I got a zipped folder, after I extract the zipped file, I then get a normal windows folder containing a bunch of files. You're downloading to your local terminal, not the remote host on which you want to install it. That doesn't really help you. Download it on the remote side, or better still, just run the CPAN shell remotely and have it do the download and install for you. Is there a way to download the module and load it into the unix ? Yes. See above. -- Chris Devers !¨1×oº³ÐÑ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response