Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Lady_Aleena

by Lady_Aleena (Priest)
on Apr 25, 2002 at 08:28 UTC ( [id://161890]=user: print w/replies, xml ) 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

Goal

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.

The past

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).

I had to see perl in a new light to get my project into motion again. When I wrote my first working module, I really got things going.

Coding history

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!

The present

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. :)

Web frameworks

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.

Mojolicious Dancer2
#!/usr/bin/env perl use Mojolicious::Lite; get '/' => sub { my $c = shift; $c->render(text => 'Hello World!'); }; app->start;
#!/usr/bin/env perl use Dancer2; get '/' => sub { return 'Hello World!'; }; start;

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.

Objects

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.

Over-complication

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?

/*SQL*/ databases

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.

MySQL test...

/users/fantasy>mysql db_name ERROR 2002 (HY000): Can't connect to local MySQL server through socket + '/tmp/mysql.sock' (2)

SQLite test...

/users/fantasy>sqlite3 test.db sqlite3: Command not found.

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 s‎crip‎ts 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.

Version control

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!

Toolbox

Coding Toolbox

  • What I have:
    • Unlimited web space
    • Markup
      • HTML
      • CSS
      • SSI
    • S‎crip‎ting
      • perl
        • 5.28.1 (local)
        • 5.16.3 (web host with #!/usr/bin/perl shebang [preferred shebang])
        • 5.30.0 (web host with #!usr/local/cpanel/3rdparty/bin/perl shebang)
      • javas‎crip‎t
    • Programs
      • geany
      • Filezilla
      • Firefox
  • What I don't have or understand:
    • PHP
    • ASP
    • MySQL
    • SQLite

Quote

"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

Geek Code

-----BEGIN GEEK CODE BLOCK----- Version: 3.1 G! d- s+:+ a+ C++ UL>++++>$ P++>$ W++>$ N !o !K w M-- PS+ PE Y+ t+(---) 5++ X+ R+++ tv+(--) b++ D- G e h- r++ x+ ------END GEEK CODE BLOCK------

Last edited and updated: 2020-05-26


Posts by Lady_Aleena
What do I use to release a module to CPAN for the first time? in Seekers of Perl Wisdom
9 direct replies — Read more / Contribute
by Lady_Aleena
on Oct 09, 2020 at 18:04

    Several months ago I read a tutorial on module creation. It got me thinking about releasing some of my modules. I got to work getting my code organized. At the time I had all of my work in the directory for my site. So I moved my general purpose modules to their own directory and then started reading more about what is needed to get a module published on CPAN.

    I first installed Module::Starter. It seemed like a good place to start, but then Dist::Zilla was suggested, so I installed it. Most recently Minilla suggested, and now it is installed. The problem is, I do not know which one to use. Do I use any of those at all, or is there yet another packaging module (with executable) out there?

    Module::Starter (module-starter) appears to be for those starting with well thought out plans for what they want to write. I have been told Dist::Zilla (dzil) is not for a first time releaser. Minilla appears to be for those who have a complete package written and just need to get it compressed to send to CPAN.

    I have also read Release::Checklist.

    I know after the code, documentation, and tests are written; the rest should take maybe half an hour or less. I have lost all confidence I had several months ago when I thought it would be easy. I am drowning in an ocean of documentation that most might find to be only a wading pool. I am reaching out and grasping at whatever scrap I can find that might match my specific circumstances, but I keep getting bogged down. I am fairly sure releasing modules to CPAN should not cause tearful emotional breakdowns on a semi-regular basis, especially when it is just one module with less than 30 lines of code to it.

    My circumstance is I have around 60 free floating .pm files I am thinking about publishing to CPAN. All have plain old documentation in various states of completion. All have at least their first tests written. (Only 2 have more than the use_ok test in a BEGIN block.)

    The module I want to release first is Fancy::Open. It has a separate .pod file and one test file (see below).

    Where do I go from here? I am willing to do this all "by-hand" if need be since this is my very first package and release.

    Apologies if this is not well written. I am so confused, but I do not want to give up like I have on other aspects of Perl.

    Note: Due to calls for a name change, I moved Fancy::Open to File::Slurp::Affix (.pod - test file).

    My OS is Debian 10 (Buster); my perl versions are 5.28.1 local and 5.16.3 or 5.30.0 on web host depending on the shebang.

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena
RFC: How did I do writing my first test? in Seekers of Perl Wisdom
4 direct replies — Read more / Contribute
by Lady_Aleena
on Sep 23, 2020 at 16:40

    The test I needed help with in Can Test::MockObject mock a file? is finished. I would like to know how I did writing it.

    I got some advice on looping I did not quite get a handle on, but this is a short test for a little module.

    Here are links to the Fancy::Open module and Fancy::Open pod (unfinished).

    My OS is Debian 10 (Buster); my perl versions are 5.28.1 local and 5.16.3 or 5.30.0 on web host depending on the shebang.

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena
Can Test::MockObject mock a file? in Seekers of Perl Wisdom
2 direct replies — Read more / Contribute
by Lady_Aleena
on Sep 19, 2020 at 16:44

    I am going to start writing tests for my Fancy::Open module that needs a file to open. Test::MockObject was suggested. In reading the beginning of the documentation, I saw it can mock arrays, scalars, code, and globs, but I do not see files.

    So, can Test::MockObject mock a file? If yes, how does it work? I am having a difficult time understanding the documentation.

    My OS is Debian 10 (Buster); my perl versions are 5.28.1 local and 5.16.3 or 5.30.0 on web host depending on the shebang.

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena
div class reputation nit in Perl Monks Discussion
2 direct replies — Read more / Contribute
by Lady_Aleena
on Sep 14, 2020 at 13:18

    <center> elements are being used in the divs with the class reputation. <center> has been rendered obsolete, deprecated in HTML 4 and XHTML 1.

    Obsolete

    This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

    - <center>: The Centered Text element (obsolete) on MDN web docs

    Please remove the <center> elements in favor of using the CSS property text-align: center?

    Edit: It is easier to restyle text-align: then to style the <center> tag.

    My OS is Debian 10 (Buster); my perl versions are 5.28.1 local and 5.16.3 or 5.30.0 on web host depending on the shebang.

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena
Title bar and menu face lift? in Perl Monks Discussion
3 direct replies — Read more / Contribute
by Lady_Aleena
on Sep 08, 2020 at 17:27

    I played around with some new code for the top bar and the menu. I removed the tables and used flex. It isn't perfect, but it might be a slight improvement.

    Note:This, or something close to it, is what I originally posted. The code in the first one is different.

    My OS is Debian 10 (Buster); my perl versions are 5.28.1 local and 5.16.3 or 5.30.0 on web host depending on the shebang.

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena
Getting better at this? in Meditations
2 direct replies — Read more / Contribute
by Lady_Aleena
on Sep 06, 2020 at 20:29

    Hello everyone.

    I think I have made some improvements on how I write and use what I write.

    Since I began using git, I have made several changes to my code for my site.

    First, I moved everything used only for my site and have no intention of sharing on CPAN into one directory/name space called Page, This is the code so many dislike, so now it is all in one place away from everything else most are somewhat neutral about.

    After that bit of reorganization, I wanted to get the code not used for my site away from my site's code, so decided to do something about it. After a lot of digging on CPAN to get some site related code out, I had to know where to put external data used in half a dozen modules. It took me a while to figure it out. Once I did, File::ShareDir made it into my code.

    Next, I had to get my site's modules out of PERL5LIB, so I finally used FindBin after fighting against it all these years. I had been putting my site's lib into PERL5LIB since I was using Windows XP. It followed through when I switched to Debian. So, now $HOME/perl5/lib/perl5 is the only lib in PERL5LIB.

    Once I got that done, I had to figure out where to move the site independent modules to.

    I moved the ones I use for my personal non-site scripts to $HOME/bin/files/lib. These are the reason I learned how to use FindBin. I know it is not the best place for them, but they are not pretty and are not even version controlled now.

    I moved the ones I want to share to $HOME/mods/lib where I can write tests and whatever else I need to learn.

    There are some duplicate modules in my site's lib dir as are in mods/lib, but that will change once I get those packaged and on CPAN.

    I thought some of you might be interested in these little changes in my coding practices; some have been arguing with me over them for a very long time. I hope that the changes I made are slight improvements. If you are interested in looking at what I have done in the past two months, you can see my site's and module's repositories. I am trying to stay excited about sharing, but it can be hard when I see just how much more I need to do to get these ready for it.

    Have a nice day everyone...

    I hope this was not too scattered.

    My OS is Debian 10 (Buster); my perl versions are 5.28.1 local and 5.16.3 or 5.30.0 on web host depending on the shebang.

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena
Instance of 'use lib' won't accept relative path in Seekers of Perl Wisdom
3 direct replies — Read more / Contribute
by Lady_Aleena
on Aug 21, 2020 at 13:06

    I've been using relative paths in my use lib for years without any problems. However, today I used lib with a relative path in a script, and it is not finding the lib. I used the absolute path, and the lib was found. Could the problem be that the lib in question is not in PERL5LIB or PATH? Could the problem be something else entirely?

    Update: I added the dir to PERL5LIB, and it worked. I just did not want to add it to @INC.

    My OS is Debian 10 (Buster); my perl versions are 5.28.1 local and 5.16.3 or 5.30.0 on web host depending on the shebang.

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena
Last hour of cb has not updated since Aug 05, 2020. in Perl Monks Discussion
3 direct replies — Read more / Contribute
by Lady_Aleena
on Aug 11, 2020 at 16:07

    Just thought you would like to know that the last hour of cb has not updated since Aug 05, 2020 at 12:55 EDT.

    My OS is Debian 10 (Buster); my perl versions are 5.28.1 local and 5.16.3 or 5.30.0 on web host depending on the shebang.

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena
Marketing and branding for The Perl Foundation (TPF) poll in Meditations
2 direct replies — Read more / Contribute
by Lady_Aleena
on Aug 07, 2020 at 21:51

    I came across the Marketing and branding for The Perl Foundation (TPF) poll, and thought you all might want to participate in helping the TPF come up with a marketing plan.

    My OS is Debian 10 (Buster); my perl versions are 5.28.1 local and 5.16.3 or 5.30.0 on web host depending on the shebang.

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena
Should I worry about "Inappropriate ioctl for device"? in Seekers of Perl Wisdom
4 direct replies — Read more / Contribute
by Lady_Aleena
on Aug 07, 2020 at 08:29

    I just saw that one of my dies returned "Inappropriate ioctl for device" at the end of the string I wanted to be returned. Is it something I need to worry about, or can I safely ignore it? I've tried to figure out what it means, and what I did wrong from various Google searches and reading here and elsewhere about it. I just do not understand it. So, other than knowing that "ioctl" stands for "input/output control" and I did something inappropriate with it, I am a bit lost.

    So, do I dive in and drive myself a little crazy trying to figure it out? Can I safely ignore it, not letting it worry me? Could it bite me later?

    Here is the code where I got the message.

    My OS is Debian 10 (Buster); my perl versions are 5.28.1 local and 5.16.3 or 5.30.0 on web host depending on the shebang.

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-03-19 08:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found