http://www.perlmonks.org?node_id=161890
Lady_Aleena's user image
User since: Apr 25, 2002 at 08:28 UTC (16 years ago)
Last here: Dec 03, 2017 at 18:57 UTC (2 weeks ago)
Experience: 3239
Level: Curate (13)
Writeups: 367
Location:Woodsboro, MD
User's localtime: Dec 18, 2017 at 12:22 EST
Scratchpad: View
For this user:Search nodes

I am Aleena, the Lady of the Gray, Saver of bytes, and the Lonely coder. White space is not my friend but a good ally. I will fight white space wherever I come across it in large amounts. A byte saved today can be used tomorrow in good cause. I am in a tower alone with nothing but silence surrounding me.

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

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

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

GO d- s+:+ a C++ UL P+ L W++ N K- w M-- PS+ PE Y+ t+ 5++ X+ R+++ tv+ b +++ D- G e h- r++ x++

Last edited and updated: 2017-06-16


Posts by Lady_Aleena
System vs. User module version of List::Util in Seekers of Perl Wisdom
5 direct replies — Read more / Contribute
by Lady_Aleena
on Jun 17, 2017 at 21:12

    Hello. List::Util is a core module, but the system version has not been updated since 1.27. So I installed it in my user directory, and it is version 1.47. However, I am getting an error that uniq is not exported by List::Util. According to the docs, List::Util has had uniq since version 1.45. So, what do I do to get the system to look at the user installed List::Util instead of the system installed List::Util? Is there precedence in @INC? Do I have to beg the system administrators to update their List::Util?

    I went to the command line and read the perldoc for List::Util, and perldoc brought up the docs for 1.47 not 1.27. I am confused by that a bit.

    Here is my @INC from the command line, and it has my user directories first, so that makes this even more confusing.

    Here is my @INC from the browser, and it has my user directories first, so that makes this so much more confusing.

    Any and all help is appreciated.

    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 Text::CSV_XS return key-value pairs? in Seekers of Perl Wisdom
2 direct replies — Read more / Contribute
by Lady_Aleena
on Jun 11, 2017 at 07:17

    Hello. I'm currently rewriting one of my more loathed subs with Text::CSV_XS. I was wondering if there were a way to write it so that it returns key-value pairs instead of an array or hash of hashes when there are only two fields in the file.

    My code so far...

    The file...

    So what I want from this file is the first field to be the keys and the second field to be an array ref. Here is an example of what I want.

    Is it possible with Text::CSV_XS?

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena
Is what you want available? in Meditations
6 direct replies — Read more / Contribute
by Lady_Aleena
on Jun 08, 2017 at 18:07

    As some of you may know, I am trying to become a better Perl writer. Part of it is finding where I wrote something that can be done better by someone else and using the better way.

    One time I needed to do a numeric comparison of months written as text. So I wrote a module to get the month numbers needed. After I wrote it, I found to my dismay, I had not needed to write it. Date::Calc had a subroutine called Decode_Month that was much better than what I wrote. I am so embarrassed I did not think to look in Date::Calc first before I wrote my silly little module. Date::Calc is far better at date manipulation than anything I could write. So, I dropped the use of my module for Date::Calc. It was a learning experience I took forward to the rest of my code.

    Another part of becoming better is rewriting and renaming the modules I have written. To find names for my modules, I have been crawling CPAN to find what name spaces already exist.

    I was looking for a new name for my Util::Number module. I crawled CPAN and found "Number" is a top name space. Then I found Number::Format. I sighed thinking my little Util::Number's days were numbered. Number::Format has a subroutine called round and so did Util::Number. Both do the same thing. Number::Format has a subroutine called format_number that puts commas in numbers and rounds numbers together, just like commify and my pretty_number. I thought commify and pretty_number were not going to be able to match format_number's power.

    So, I installed Number::Format and was going to discontinue using my Util::Number. Why? Using Number::Format in code that I need help with, you can install it from CPAN without any trouble. Using Util::Number in code that I need help with, you would have to guess at what it does unless I also put Util::Number in the node with my problem code.

    So, I was changing over my code from pretty_number to format_number and making sure it returned what I wanted. Then I got a big surprise. format_number has limitations commify and pretty_number do not have. format_number can not put commas into very big numbers. It outputs an error about the big number and suggests using Math::BigFloat.

    format_number

    perl -e 'use Number::Format qw(format_number); print format_number(123 +45678987654321)."\n";'

    returns...

    round() overflow. Try smaller precision or use Math::BigFloat at -e li +ne 1.

    commify

    perl -e 'use Util::Number qw(commify); print commify(12345678987654321 +)."\n";'

    returns...

    12,345,678,987,654,321

    In the change over from commify and pretty_number to format_number, I got another surprise. format_number does not do ordinal numbers either. I fed it an ordianal number in Happy unbirthday redux! and other birthday stuff, and it returned the following error.

    Argument "16725th" isn't numeric in numeric comparison (<=>) at /home/ +me/perl5/lib/perl5/Number/Format.pm line 599.

    So, I went back to commify in my code and got...

    Happy 16,725th unbirthday, Aleena! You have 32 days until your next bi +rthday on July 10, 2017.

    This was all so surprising to me. Here I was ready to use a module readily available on CPAN instead of my own silly little module, but the CPAN module could not do what mine does. I was thinking "But it's is so much better than mine. It's got all those bells and whistles. And it's on CPAN!"

    This is not a rant against Number::Format. It is on CPAN and is better written than my little Util::Number. I will use Number::Format in code when I need help. Number::Format also has options I do not currently have, so I will be using it whenever one of those options is needed. Util::Number may become a fallback module when Number::Format will not work for what I am doing currently. Util::Number will not be going to CPAN since I did not write commify or round, I just put them together in pretty_number.

    Util::Number

    I am trying to make my modules more useful with better names and code. I am also trying to get better by using what is already available. However, sometimes, what is available is a little less than what is wanted. That does not mean I will stop searching.

    Afterward...

    I cracked opened my now disused month module just to look at it. Then I saw the hash of arrays. What do I do with hashes of arrays of similar data? I randomize it of course. So my Util::MonthNumber is now Random::Month... 8)

    Random::Month

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena
Text::CSV_XS function does not accept headers and key together in Seekers of Perl Wisdom
1 direct reply — Read more / Contribute
by Lady_Aleena
on Jun 07, 2017 at 05:03

    Hello. In my effort to improve my perl writing, I was going to take some of my own advice and stop trying to find reasons to not use something. With that in mind, I finally decided to look into Text_CSV_XS to replace my hand rolled flat file processor. I gravitated right to the function csv in the module as it looked easier to use. However, I came upon a problem. In the POD it says that when key is set, headers is set to auto, so the headers I set would not work.

    So, other than going through every flat file I have and adding the headers, can anyone think of a way to work around? I have so very many flat files and could possibly miss a few, so adding headers in now would be problematic.

    What I want is a hash of hashes with the first item on each line to be the key to the hash along with being a named value in the hash.

    Is there maybe someone who would hold my hand as I try to work through the method in Text::CSV_XS?

    My data

    Crystal Skull|Stargate SG-1, Crystal Skull;The Librarian: Return to Ki +ng Soloman's Mines;Indiana Jones and the Kingdom of the Crystal Skull Spear of Destiny|The Librarian: Quest for the Spear;Hellboy;Constantin +e Book or Key of Soloman|The Librarian: Return to King Soloman's Mines;S +eason of the Witch Necronomicon|H.P. Lovecraft

    My code

    #!/usr/bin/perl use strict; use warnings; use Text::CSV_XS qw(csv); my $file = '/home/me/Documents/www/files/data/Miscellany/Magic_items.t +xt'; open(my $fh, '<', $file) || die "Can't open $file $!"; my $list = csv ( in => $file, sep_char => '|', headers => ['item', 'seen in'], key => ['item'], ); use Data::Dumper; print Dumper $list;

    My result

    Use of uninitialized value in anonymous hash ({}) at /home/me/perl5/li +b/perl5/x86_64-linux-gnu-thread-multi/Text/CSV_XS.pm line 1223, <$fh> + line 4. Use of uninitialized value in anonymous hash ({}) at /home/me/perl5/li +b/perl5/x86_64-linux-gnu-thread-multi/Text/CSV_XS.pm line 1223, <$fh> + line 4. Use of uninitialized value in anonymous hash ({}) at /home/me/perl5/li +b/perl5/x86_64-linux-gnu-thread-multi/Text/CSV_XS.pm line 1223, <$fh> + line 4. Use of uninitialized value in anonymous hash ({}) at /home/me/perl5/li +b/perl5/x86_64-linux-gnu-thread-multi/Text/CSV_XS.pm line 1223, <$fh> + line 4. $VAR1 = { '' => { 'seen in' => 'H.P. Lovecraft', 'item' => 'Necronomicon' } };

    Update: This is as far as I have gotten with the method version.

    $csv = Text::CSV_XS->new ({ sep_char => '|', quote_char => undef, blank_is_undef => 1, empty_is_undef => 1, allow_whitespace => 1, });
    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: Proofread POD for my main random module, please? (more) in Seekers of Perl Wisdom
4 direct replies — Read more / Contribute
by Lady_Aleena
on Jun 01, 2017 at 15:31

    Hello. Would some gentle monks please proofread my POD for my main random module and let me know if it makes sense?

    Also, I would love some help renaming the module. It is currently sitting at RolePlaying::Random. I am moving most of my random generation modules to Random::. If one day I decide to share my randomness with CPAN, I do not feel I can take the top spot in the Random name space for this module. It would not be right unless I get a whole lot of people from here and CPAN telling me it is okay. I am leaning toward Random::util, but I am not sure of it. What do you name modules that you use to build other modules?

    Please let me know if you see something in the code that needs improvement, too.

    Thank you in advence!

    Update 1: From the responses, I made changes that can be found here.

    Update 2: From the additional responses, I made more changes that can be found here.

    I did not realize until I posted this how long the pod got.

    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 not link to "id" in shortcuts in Perl Monks Discussion
2 direct replies — Read more / Contribute
by Lady_Aleena
on May 31, 2017 at 22:30

    I just tried to create a link to part of my scratchpad where I placed an id=. I tried [id://637756#laundry|my pad]. It did not munge. I just got [id://637756#laundry|my pad]. I would really like to link to tags with ids. For example, if I give an id to a section of my home node, I can link to just that section. Pretty please?

    Update: It looks like I can not add ids to the html elements. They do not make it to display. 8(

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena
Finding what modules use and what uses the modules in Seekers of Perl Wisdom
6 direct replies — Read more / Contribute
by Lady_Aleena
on May 26, 2017 at 21:16

    As some of you know, I'm doing an audit of my code. Part of that audit is finding what modules my modules use and what modules I have written are used by other modules I have written. If I ever get things nice enough in some of my modules, I might one day put a few up on CPAN. However, I need to know what modules my modules use so I can include them in the install if the user does not already have. Like, if I use Lingua::EN::Inflect in a module (or group of modules), it would need to be installed if the user does not have it already. At least I think so.

    I came up with the following code to find the information but there might be a better way.

    Update: I put the updated code I used here: Re: Finding what modules use and what uses the modules. Your options looked interesting but did not differentiate things the way I wanted.

    #!/usr/bin/perl use strict; use warnings; use File::Find; my @files; sub wanted { my $file = $_ =~/.pm$/ ? $File::Find::name : undef; push @files, $file if $file; } my @directories = ('/home/me/Documents/'); find(\&wanted, @directories); my $module_directory = $directories[0].'www/files/lib/'; my $modules; for my $file (@files) { open my $fh, '<', $file or die "$file: $!"; my $file_convert = $file; $file_convert =~ s/$module_directory(.+)\.pm/$1/; $file_convert =~ s/\//::/g; while (<$fh>) { chomp; if ($_ =~ s/^use ((:|\w)+)(.+)/$1/) { push @{$modules->{$file_convert}{'uses'}}, $1; # what modules + the module uses push @{$modules->{$1}{'used by'}}, $file_convert; # what modules + use this module } } } my $in = shift; use Data::Dumper; print Dumper($modules->{$in});

    Here is example output.

    me@office:~$ perl Documents/scripts/find_module_use.pl 'RolePlaying::R +andom' $VAR1 = { 'used by' => [ 'RolePlaying::CharacterMutation', 'RolePlaying::Random::Range', 'RolePlaying::Random::Time', 'RolePlaying::Random::SpecialAttack', 'RolePlaying::Random::Title', 'RolePlaying::Random::WildPsionics', 'RolePlaying::Random::Descriptor', 'RolePlaying::Random::Spell', 'RolePlaying::Random::SavingThrow', 'RolePlaying::Random::Color', 'RolePlaying::Random::Monster', 'RolePlaying::Random::GemMetalJewelry', 'RolePlaying::Random::Thing', 'RolePlaying::Random::Weapon', 'RolePlaying::Random::Size', 'RolePlaying::Random::Food', 'RolePlaying::Random::Misc', 'RolePlaying::Random::Event', 'RolePlaying::Random::Water', 'RolePlaying::Random::Class', 'RolePlaying::Random::MagicItem', 'RolePlaying::Random::Color::VisiBone', 'RolePlaying::Random::Body::Function', 'RolePlaying::Random::Body::Modification' ], 'uses' => [ 'strict', 'warnings', 'Exporter', 'List::Util' ] };

    If you know of a better way that will give me deeper or more sophisticated results, I am interested.

    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 figure out a way to get File::Grep's fgrep to chomp matches in Seekers of Perl Wisdom
3 direct replies — Read more / Contribute
by Lady_Aleena
on May 13, 2017 at 19:36

    Hello. I've been stuck for over an hour now. I can't figure out how to get File::Grep's fgrep to return chomped values in its matches. I've tried chomping $file, chomping $_ in the fgrep, and more. Am I using it wrong, not understand something in the module description, or just plain out of luck and have to munge the values of matches later?

    #!/usr/bin/perl use strict; use warnings; use File::Grep qw(fgrep); use Data::Dumper; my @line = fgrep { /^[2-6] .+$/ } *DATA; print Dumper(\@line); __DATA__ 2 foo 3 bar 4 baz 5 qux 6 quux 7 thingy 8 widget

    The output is

    $VAR1 = [ { 'filename' => *::DATA, 'count' => 5, 'matches' => { '1' => '2 foo ', '2' => '3 bar ', '3' => '4 baz ', '4' => '5 qux ', '5' => '6 quux ' } } ];

    I'm at the end of my abilities.

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena
Confession of a hard headed Monk in Meditations
2 direct replies — Read more / Contribute
by Lady_Aleena
on May 05, 2017 at 23:43

    Over the last few days, I've been doing a project that is forcing me take a new harder look at everything I've written: code and markup. One of the items which came up in my audit was a little subroutine which takes a number (usually scalar(@list)) and returns how many columns the list would be in according to exponential calculations. The default behavior of this subroutine is to return a word number not an integer. When I looked at it again, a voice in the back of my head told me the subroutine should return the integer by default because integers are more useful. I also had the sinking feeling someone here probably pointed that out to me, and I ignored it. I wanted what I wanted, and no one was going to make me change my mind at the time. I had to change my own mind and pay the price for it later.

    So, this is my confession. I am a doofus. I am hard headed and obstinate when it comes to attaining my short term goals. I crawled into my shell to avoid any good advice about coding for the future.

    So here is my old sub...

    use Lingua::EN::Inflect qw(NUMWORDS); sub get_columns { my ($max_cols, $amount, $number) = @_; if ($amount <= $max_cols ** 2) { for my $num (1..$max_cols) { if ($amount >= $num ** 2 && $amount < ($num + 1) ** 2) { return $number && $number =~ /^[yt1]/ ? $num : NUMWORDS($num); } } } else { return $number && $number =~ /^[yt1]/ ? $max_cols : NUMWORDS($max_ +cols); } }

    And the new more useful sub...

    use Lingua::EN::Inflect qw(NUMWORDS); sub get_columns { my ($max_cols, $amount, $word) = @_; if ($amount <= $max_cols ** 2) { for my $num (1..$max_cols) { if ($amount >= $num ** 2 && $amount < ($num + 1) ** 2) { return $word && $word =~ /^[yt1]/ ? NUMWORDS($num) : $num; ############################################# Delete to + get rid of Lingua::EN::Inflect } } } else { return $word && $word =~ /^[yt1]/ ? $NUMWORDS($max_cols) : $max_co +ls; ################################################### Delete +to get rid of Lingua::EN::Inflect } }

    I feel bad for only now realizing returning a integer by default would be more useful than returning a number word. I think I spoke aloud when I called myself a doofus for returning a number word by default.

    I've been doing a lot of rethinks lately. Some of my "utility" scripts seem useless in a broader sense.

    The great advice I got from Monks long ago is finally settling into my head. I hope I am better with future advice, but that is to be seen.

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena
Opening files to write in browser returns Permission denied in Seekers of Perl Wisdom
9 direct replies — Read more / Contribute
by Lady_Aleena
on May 02, 2017 at 18:14

    Hello. I just recently noticed when I try to open a file for writing in a script running in my browser, permission denied is returned. So, is there a way to programatically tell my script running in my browser it is okay to write to that file? Also, how do I do it?

    I've looked at open and nothing popped up at me say this is where permissions are granted. Even File::Slurp's write_file returned permission denied. I think this is weird because I can open files to be read in the browser without any issues with either open or File::Slurp's read_file.

    In the mean time, I have set both files' permissions to 666.

    Note: Please tell newbies to die to always include the $! at the end. If I had $! at the end of my die message, it would have cut at least 15 minutes of me traversing directories thinking the file did not exist. I felt like a doofus.

    Edit per hippo: My OS is Debian jessie.

    Update: Running the same script from my web host does not require me to set the permissions to 666. It writes to the file while it is 644.

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