|There's more than one way to do things|
Lady_Aleenaby Lady_Aleena (Curate)
|on Apr 25, 2002 at 08:28 UTC||Need Help??|
What I like about PerlMonks is the only expectation of me they have is I improve myself. To that end, PerlMonks go out of their way to give me the resources to do so. Also, I will more than likely be remembered most for the cookies I give out. :)
Over the years I have been here, most made me feel welcome here, but a few have made it plain my presence is very unwelcome. I hope to not push away those who have been friendly to me so far. I also hope that those who actively dislike me will soften their views after reading this, if they read it.
"I thought that once I get syntax OK, I would be out of the woods. That only makes the woods thicker when there is a problem." - by me
703rd Saint on 19 May 2017
Socialize with me
My programming goal is to completely rewrite my entire web site using Perl. This task is daunting as I have so many different ways I have to manipulate the data. I have gotten most of it figured out, though there are areas with which I am not quite happy.
Coming from the world of markup languages into the world of programming languages was extremely daunting for me and still is upon occasion. Not knowing the right questions to ask, the correct terminology, or even what to put into searches made me feel very, very anxious. I am interested in what can be done in Perl. Until I get a grip on those areas where I am weak, would you please be extremely patient with me?
Annoyance caused me to state when my currant project was finished, you would never hear from me again. My feelings got hurt and my project was at a complete standstill when my temper got the best of me (which it does quite often when my feelings are hurt).
A little less than a decade ago, I got 10 megabytes of complimentary web space from my internet service provider along with several e-mail addresses. Wanting to put my mark on the net, I created my first web page in Microsoft Word. Everything was going fine. My site got bigger and bigger, and Word even gave me frames. It was when I wanted to put some code on my site from somewhere else when the need to know how to write HTML caught up with me. No matter what I did in Word, the block would not go where I wanted it. I got the message, learn how to write a web page. Before that moment I did not care about the markup, I just wanted my pages to look pretty.
At first I found a site here and there which told me what all those things meant in between the < and >. With just the basics, I started to rewrite my site. I kept the frames and still did a lot wrong. I had depreciated tags everywhere. The amount of <font> tags was enough to make some throw their hands up in the air in exasperation. Not only did I have a lot of depreciated tags, I had tags unclosed. I just plain did not get it.
It took some very patient people talking me through my hysterics when something on my site did not work to finally get my site looking better and most areas working right. Then I ran out of space. I had filled my 10 megabytes rather quickly. Hysterics ensued. That is when someone casually mentioned CSS. When I saw what one line of CSS could do to cut my page size down, I nearly cried (or did I actually feel a tear?). Within weeks the size of my site was down by more than 75%. After that my whole coding philosophy became small is beautiful.
Let's pause for a moment. At the time the only browser on my computer was Internet Explorer. I was still a very lazy writer, so some of my HTML was browser specific. I was not writing for the masses, just those who were using IE. Then along came Firefox becoming the cause for a fresh bought of hysterics. I still have a few cross browser issues, but they are not critical.
The main issue causing my headaches was my frames looked bad in Firefox. So, I had to find another way of making my pages look and act the same without frames. Then I was introduced to <divs>s and in CSS scrolling. The problem with getting rid of the frames was I would have to put the same stuff on all of the pages, making them bigger. I did not want that. Then I was introduced to Server Side Includes. It was a miracle to me. I could put all kinds of stuff into one file and have it read by another. So slowly and up until six years ago, I had been altering all of my pages to have SSI.
I was talking to several people here on PerlMonks. When I told them that I was using SSI to add markup to my pages, I was told Perl could do the same thing. I was wondering, would Perl be smaller than SSI; and the answer is a resounding YES!
I still have a lot of hurdles to overcome before I get anywhere near good at Perl. I have been told that I have come a long way from when I started here; yet with the amount that I have left to learn, it seems that I am still at the beginning. I am getting better at reading the perldocs and finding modules that may work for me. I have also developed a few peeves which may or may not stick with me as I learn more.
Have a cookie for making it this far into my node! I am impressed with your resilience! I tend to babble when given the chance. Have another if you intend to continue reading. :)
Lately some have been suggesting strongly that I use one of the more popular perl web frameworks like Mojolicious or Dancer2. They seem to be good suggestions. However, I went and looked at their tutorials and got lost on the very first bit of code they both showed and did not understand what they were doing.
Neither started off with HTML as I expected web frameworks to do. I expected the first line to be print "Content-Type: text/html; charset=utf-8 \n\n"; or <!DOCTYPE html>. If I am to convert my code over to Mojolicious or Dancer2 code, I need to see HTML at the top. My code produces HTML, I do not know what their code is doing, but it is not HTML as I expected. Also, neither state whether or not they support HTML5, which I happily use.
I have not gotten my head around some of the most basic modules normally used by perl programmers. The two more commons ones that I do not use because I have not figured them out are File::Find and Text::CSV. So, do you really think that someone who does not know how to use File::Find and Text::CSV is ready for Mojolicious or Dancer2? I am still using hand rolled code to get a list of files that should be done with File::Find and making hashes with hand rolled code instead of Text::CSV. (My make_hash subroutine is disliked by most.)
So, when you need a list of files, you type furiously for a minute in a wanted subroutine for File::Find, get the list of files you want, and have them processed all while I am still listing the files to see if my first conditional is working. When you have a separated values file you want to make a hash out of, you type a minute using Text::CSV and have a hash that you have processed while I am rereading the module POD again.
It may seem to flatter me that some of you believe that I am ready for the bigger concepts, but it is a reminder of just how little I know. I have a lot that is hand rolled where I should have used more popular (common) modules, but those modules are over my head still.
Recently, I looked at Text::CSV again and still could not write working code with it. I am also cargo culting code to get File::Find work in one place.
I will not ask for help to convert my site to either of those frameworks because you have families, jobs, and lives outside of PerlMonks. Converting my code to either of those frameworks would take a deep dive into my code and that would take days or even weeks. You have your own work to do that is more important than my little website. Just know that both frameworks, from the start, overwhelm me with concepts I have never seen before. I am not ready for them and do not know if I will ever be ready for them.
It takes me, sometimes, up to a dozen runs of a list to get a grep or map written correctly. I cargo cult when I use File::Find. I have not figured out Text::CSV. I do not know when or how to write object oriented code.
I have read and searched and read again about them, but they still do not make sense to me. I would need to see them in action with some code that I have already written to maybe get a grip on them. There are no promises on that score; ikegami, GrandFather, and others have tried to show me without it sinking in how they work. Because of my frustration with the topic, I am beginning to dislike almost everything to do with objects, even eschewing object oriented modules. I would rather write my own function then wrestle with an object to make it behave.
Update 1: I am giving them another try again. I hope this time that how to write them sinks in.
Update 2: They have confounded me again! I do not get it!
Update 3: I gave it yet another try, nothing. I still do not understand what is so wonderful about objects. So after Why won't a hash in a hash work as a hash reference to create an object?, RFC on how I'm doing when it comes to writing objects?, and How do I go from procedural to object oriented programming?; I give up. If one day my code morphs into objects on their own, I won't know it. To me objects are just a pain the a** especially since everyone tells me to separate my data out of them. Well, I can not do that. My data stays where it is with the subroutines that use it.
I have been told that I have a knack for this. There are times when reinventing the wheel is a good thing. For example, I was going to use DateTime to get the current week of the year when all I had to do was int($day_of_year / 7). Sure DateTime has something like that, but why go through all the trouble of setting it up, when something else much simpler is already around?
So called templates
I am sorry, but I can't see how any of these so called template modules really create a template that will fill in everything that I need them to fill in. HTML::Template appears to do only very basic stuff, but since I use so many conditionals and list iterations and loops, it won't work. Template Toolkit doesn't even look like perl, so I will stay as far away from that mess as possible. I don't need to get all mixed up right now. Printing the titles of my pages based on a slew of conditions seems beyond their capabilities, so how could I get them to print my site's menu and the right list of style sheets?
Almost everyone I talk to here and elsewhere gets on my case about using a text based database system, with the directory structure being a part of it, over a SQL related database. I have tried to explain that I do not have access to either MySQL or SQLite on the server where my main site is, Xecu.net. When they tell me to move to somewhere that has either, I also try to explain that moving would mean a lot of trakking through the net trying to find everywhere I have a link to my site and changing the link. This is a lot of work.
I made attempts to check to see whether or not MySQL or SQLite was available to me on Xecu.net by trying to create a database at the command line. The results follow.
The above tells me that they are not available, so I had to find an alternative, which I did in separated values files. I would have to have a database and the access and editing scripts for that database to test, but since I can't make a /*SQL*/ database, I can't play with the concept either.
The last problem with /*SQL*/ databases is that they are binary, meaning I would not be able to edit them in my text editor. If I can't get a decent front end up for my text based databases, I would be horribly disadvantaged with a binary one. I would have to keep all the text around somewhere to edit in my text editor just to stuff that text into the binary database. So, I will use what I have available to make databases.
I would like this to be the last time I have to defend my use of separated values. I try to stay away from the database topic as much as possible these days whenever it comes up.
There are two schools of thought for this one. A few seem to feel that I will crash and burn without it; while others say that since I am working alone, I don't need it. I have looked around and haven't found anything to my liking. There is the whole concept of storing all of the changes to my files that really is not appealing to me. There is also the lack of automation, where the changes are stored whenever I save in my favorite text editor. I spoke to a few of its developers who seemed interested but nothing came of it. Maybe once its integrated into my text editor and automatic, I will give version control a whirl.
Take a break
Wow! You read it all! The rest is just tools I use to write perl. Have a plate of cookies!
"A man's knowledge is like an expanding sphere, the surface corresponding the boundary between the known and the unknown. As the sphere grows, so does its surface; the more a man learns, the more he realizes how much he does not know. Hence, the most ignorant man thinks he knows it all." - L. Sprague de Camp
Last edited and updated: 2020-05-26