Moved house - back on-line
Hi Folks
Well, I'm living with my mother, who has Alzheimer's, which is a bit like being out of work, in that I sit around a lot. But I can go out - I just have to lock the front door and garden gate so she doesn't accidently let my 2 miniature dogs out.
Nevertheless, I hope to be still productive in the Perl arena.
So, post frequently, and that'll give me things to read :-).
Hello, I need help writing a few Perl scripts. I have been working on them, but honestly Im not that good. Can I get a hand?
Hi Tony
The first question is: Is this a school/college assignment of some sort? If so, it's not my role to write such code for you.
If not, then the Training section of
https://www.socialtext.net/perl5/
is probably what you want.
That does not mean I won't help. It does mean, however, that there is no shortcut to learning Perl (or any other programming language).
Post a program somewhere and reply here with the URL, and I'll have a look at it.
Ron, I've been picking up pearl with my developers, learning a bit here and there - code mistakes all the time of course.
Any advise you have on going from PHP based to pearl based learning?
Bonnie Smith
COO/Director FXP
http://www.forexpulse.com
Hi Bonnie
Firstly, it's 'Perl', not 'pearl', since it stands for 'Perfect Language'. The program you run to process your program is called 'perl'.
It took me years to years to get to the point where I could say I was writing reliable Perl, as distinct from just writing Perl, so take your time.
The link in the answer to Tony is where to start. Write simple scripts - don't take on large, complex tasks or programs. You'll be trying to learn far to much at one doing that.
For instance, a well-written CGI script might entail dealing with:
o Quite a few Perl classes (coded as modules).
o HTML and HTML templates.
o CSS.
o Javascript
o Directory structure (of the code and templates).
o Coding, testing, debugging, documenting.
o Interaction with a web server.
o Interaction with a database server.
o Session handling.
o Installation of the code and templates, and file permissions.
So, suddenly, a 'simple' CGI script is a major project.
Accept that you'll have to become comfortable with classes and objects. Of course, you don't need to use objects in every program. Rather, they have 2 functions:
o Classes are the easiest way to incorporate other programmers' work into your code.
o They are a marvellous way of structuring your code.
Always search for a module, either on CPAN http://search.cpan.org/ by guessing a name, or ask someone. Don't reinvent the wheel, p-l-e-a-s-e.
Be prepared to deal with concepts which you may never have seen before. For instance, Try::Tiny
(http://search.cpan.org/~doy/Try-Tiny-0.09/) says 'minimal try/catch with proper localization of $@', and you may well say 'What? Why?'.
As for asking questions, here (http://www.catb.org/~esr/faqs/smart-questions.html) is a staggeringly long-winded suggestion of how to ask. Memorize the headings in that document, at least.
My short version is: State what you're trying to do (in English) and then state what you tried (in code).
Yes - that's it!
Beginners try so hard (which is good) they sometimes end up only wanting their attempt to be fixed. They find it far too hard to relax, abandon their effort, and accept that starting again, using advice, is better than persisting with a faulty approach.
Different programmers have different preferences, so I don't automatically accept suggestions as to what modules I should adopt. Rather, I read the docs and weigh each up against what I am familiar with. In the same way, feel free to be skeptical with my suggestions below.
There are often quite a few modules trying to solve the same task, which makes it very difficult for beginners to know which one to adopt. This is a regrettable situation, since it's precisely when we're struggling as a beginner that we don't want maximum confusion.
Hence ask often about which to use, and just accept you'll get incompatible replies.
For me, I often use:
o Capture::Tiny
o Config::Tiny
o Try::Tiny
o Text::Xslate
o Brannigan (silly name, since no-one would find it by guessing names and using a CPAN search).
When I review old code of mine I see I've used various alternatives to all those module. That just means I accept that programming involves continuous learning, so it's a great intellectual challenge, and an effort, but extremely rewarding.
Lastly, perhaps something at http://savage.net.au/ is of interest.
PS I'm submitting this post without previewing it, since there's a bug in the blogging code which deems me to be using an expired session if I click [Preview]. They ought to be using my session handling module Data::Session - hahaha.
Hi Bonnie
Forgot to mention the great module local::lib.
And Season's Greetings from the coldest Australian summer of my life.