good chemistry is complicated,
and a little bit messy -LW
Seeing Perl in a new lightby Lady_Aleena (Curate)
|on Apr 12, 2009 at 12:40 UTC||Need Help??|
Going back to the drawing board
I decided to go with a full blown meditation because I think I had a revelation of sorts. Those who have wished upon so many occasions to reach through their monitors and bash my head into my monitor, desk, or keyboard for being so dense as to the power of Perl may now see their days of telling me to convert my site to Perl come to an end. I may have finally seen the light. I apologize ahead of time for the rambling, confusing, and disjointed nature of this meditation.
I also apologize for being so intransigent and belligerent about using Perl more broadly for my site. As with anything new, I am fearful of change. When I was first introduced to SSI I got belligerent with those trying to help me. After getting over my initial trepidation, I went as wild as a could with it. Once I find something I think of as good, I rarely want to change to anything else. My anxiety has shown through on so many occasions with those here having the tremendous burden of dealing with my dismissiveness of Perl for my simpler pages. Now, I think that I have taken SSI as far as I can but need to upgrade to something better. I now think Perl can help me with that.
What has changed you may be asking? Well, I was playing around with some subs when what Perl could possibly do for my site hit me square in my gray matter. The stray thought crossed my mind that Perl may be able to print the file name of the script on which I was working. Then it further hit me that it could probably print the directory name as well, all the script's sibling files, and maybe the entire directory structure above and below it. With that on my mind, I began to do some serious thinking about the structure and semantics of my site.
For the navigation of my site, I was thinking that I could probably have a script build it completely from the directories' and files' names. For the navigation within a directory, the first link would be to the "home" page which would be the top level index.pl file in the top directory (duh, right?). The navigation section of the page would include all the sub-directories and files in the same directory, and the files in the sub-directories (on down to the bottom) of each. For the home page and other files in the home directory, the navigation would basically be every page on the site. In sub-directories, there would be a path back home over the pages in that directory. For a second level directory, the top link would be home, and the second link would be the next directory up. The files in the parent directories would not be printed, however the files for the sub-directories would be.
Also in the navigation section of the pages, there may be external links. I could possibly set up a file called navigation_links.pl or something that could be read into the navigation section under the internal navigation. If there are more than a certain number of links, another script could be called upon to create a full blown external_links.pl (which would then delete navigation_links.pl), with a link in the navigation section to it. After the external_links.pl is created, it can be edited by hand to add any formatting needed. So the script would check for external_links.pl (if found print the link to it), then then navigation_links.pl (if found, print the list of links), or print nothing at the bottom of the navigation section.
At the very tail end of the navigation section would be an Amazon link (by section and if applicable), a Firefox link, and a valid HTML link.
I wouldn't have to do a thing when I add a new file with the navigation system above. If the script works as I think it will, any new files would be added to the navigation without me having to open a single file to add the page to the list. When I add a file now, I have to open up another file to make sure that the new file is listed.
With so much on my pages the same, having one script that has all of the base material on it would be great. The script would include little things like the DTD and charset and all of the other opening HTML needed for the pages and the ending HTML too. The individual scripts would just have the juicy centers in them from a page with just simple paragraphs to very complex tables needing gads of page specific scripting.
For all the directories, there will be index.pl files which will be part of the navigation but take their names from their directories. There is also some index page specific styles which will have to be added to them. I already know of one index file that will have to have something added to override a certain index style (maybe my $IndexStyle = "no";). Other files will have classes added to their body tags only if my $PageStyle is declared.
For the titles of the pages, I was thinking of them being Lady Aleena's sub-directory - file name. For the initial heading, just the file name. I will have to think about that a lot when naming the directories and files since I would like the titles to make sense. The renaming is going to be a bit of a headache. I don't know how Lady Aleena's movies - Favorites - Comedies would look. I would really like it to me Lady Aleena's favorite comedy movies, but I can't have different naming protocols for the various directories. I am also not sure if I want to have all lower case file names and do some sort of text transformation to make the initial letters capitals later. Also, for multiple word file names, I will be using underscores for the spaces, so I know I will have to add a regex to replace the underscores with spaces. So, I could name a file love_poems, and hopefully it can be printed out as Love poems or Love Poems. If that file is in the poetry directory, the title would be Lady Aleena's poetry - Love poems. In the navigation section, poetry would need to be capitalized.
For some pages, I may be including forms such as my movie list pages and proficiencies page. I would love to have a console where I can see all of the submissions on one page where I can vet them instead of getting them by e-mail.
I thought about writing a sub that would make internal links for my site. There could be a script generated listing of all the pages of my site, so that all I have to do is add '.SiteLink("page name").' whenever I wanted an internal link, or just '.Link("page name or external page title","external link").'.
With SSI I lost some of my directory structure, hopefully Perl will give it back to me. I am still trepidatious about doing this. There are some pages that seem too hard to convert over or would be very time consuming. I am not sure where to go after the following code:
If you have made it this far, thank you for bearing with me. I would like to know if any of these ideas are impossible in Perl. Are there any ideas you would tweak? Any just plain too silly? Am I on the wrong track with anything? I would like to start by getting my thoughts in the proper order and the right terminology down before I dive in (like what search terms to use to look up printing file names and such).
I have a blank slate in front of me, I would like to begin filling it.
Have a nice day!