Perl CGI File Information Primer Tutorial

Perl CGI File Information Primer Tutorial

Perl CGI File Information Primer Tutorial

Today we once again venture into the world of Perl CGI (Common Gateway Interface) on our Apache/PHP/MySql CentOS web server, this time to investigate using the Perl CGI to show some file information via the Perl access to the Linux operating system file information via Perl syntax:

  • if (-e $filename) { print "$filename found."; }
  • if (-d $filename) { print "$filename is a directory."; }
  • if (-r $filename) { print "$filename is readable."; }
  • if (-w $filename) { print "$filename is writable."; }
  • $filesz = -s "$filename"; # shows size of the file

Here is a live link for today’s tutorial where we show some server-side abilities of Perl as your CGI language of choice, as an alternative to the PHP in Apache/PHP/MySql that we normally associate with CentOS (maybe?!) … so maybe we should say Apache/PHP/MySql/PerlCGI … the latter not to be confused with that brilliant policewoman in Argentinian Riot Control whose name happens to be Poyle or is that Pearl.

Helpful for this Perl tutorial was Perl and CGI for the World Wide Web by Elizabeth Castro … thanks heaps!

Will leave you with some downloadable programming Perl source code you could call info_on_file.cgi supervised by some HTML code containing the calling form called info_on_file.html building on the previous Perl CGI Email Primer Tutorial as shown below.


Previous relevant Perl CGI Email Primer Tutorial is shown below.

Perl CGI Email Primer Tutorial

Perl CGI Email Primer Tutorial

Today we again venture into the world of CGI (Common Gateway Interface) on our Apache/PHP/MySql web server, this time to investigate using the Perl CGI to send emails via the Linux sendmail command.

Found with the use of sendmail there are configurations you probably shouldn’t touch, that you should work “with” (rather than against … doh!) … and for advice on this would strongly suggest getting the local web server advice on this via the command perldoc -q “How do I send mail” … would like to say that this idea was dreamed up by yours truly, but yet again, and again, and again, and again, and again (are you getting bored because I’m not … it’s a wet day), and again, and again, and again, and again it was an Open Source (and again) link here that helped. And to get here did this search (notice how CentOS is mentioned … ie. get specific).

This last bit is separate to (and on top of) testing code on a local web server (here we have MAMP for Apache/PHP/MySql Perl CGI) … all these Perl CGIs go through that level of testing first, way before they go to any real web server (would highly recommend this).

Have been meaning for three tutorials now to mention the Apache Error Log (called /Applications/MAMP/logs/apache_error.log here on MAMP (will be different location for other web servers)) which can guide you through Perl CGI (or other brands of CGI) error issues. This makes sense (as a place to look) because the web server (Apache) sits above the CGI code, which sits next to your HTML/(PHP)/Javascript/CSS code, which, today, have the role of providing the HTML form whose action goes to Perl CGI after validation goes through Javascript (remember Javascript Form Validation Primer Tutorial). Have a look at a bit of what such a log looks like here.

Here is a live link for today’s tutorial.

With all Perl tutorials, like Perl and CGI for the World Wide Web by Elizabeth Castro … thanks heaps!

Will leave you with some downloadable programming Perl source code you could call email_sender.cgi supervised by some HTML code containing the calling form called email_sender.html

Anything you want to ask? No? Well … we’ll be off then. Bye for now, and hope you try the live link and enjoy the little mathematical tidbits in the emails.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in eLearning, Operating System, Tutorials and tagged , , , , , , , , , , . Bookmark the permalink.

18 Responses to Perl CGI File Information Primer Tutorial

  1. Bonjour ! LOL ! J’aime bien comme site

  2. Great post. I was checking continuously this blog and I am impressed! Extremely useful info particularly the last part :) I care for such info much. I was seeking this particular info for a very long time. Thank you and good luck.

  3. Financing says:

    Thank you a lot for giving everyone a very breathtaking opportunity to read in detail from this site. It is often very brilliant plus stuffed with fun for me and my office friends to visit the blog at the least thrice weekly to learn the newest items you will have. Of course, I’m just certainly pleased with all the effective pointers you serve. Selected 3 points on this page are certainly the most suitable we have ever had.

  4. Very well written story. It will be helpful to everyone who utilizes it, including myself. Keep doing what you are doing – looking forward to more posts.

  5. I’ve been browsing online more than three hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. In my opinion, if all web owners and bloggers made good content as you did, the web will be much more useful than ever before.

  6. anal kratom says:

    Hello there, just became alert to your weblog by means of Google, and discovered that it is truly informative. IÒ€ℒm going to watch out for brussels. I will appreciate if you continue this in future. Numerous folks is going to be benefited from your writing. Cheers!

  7. you’re truly a just right webmaster. The site loading velocity is amazing. It sort of feels that you’re doing any unique trick. Furthermore, The contents are masterwork. you’ve done a wonderful activity on this matter!

  8. What is wonderful respecting is dealing with instead of depending on.

  9. I was just seeking this info for a while. After 6 hours of continuous Googleing, at last I got it in your website. I wonder what is the lack of Google strategy that don’t rank this kind of informative sites in top of the list. Usually the top web sites are full of garbage.

  10. DIY Home says:

    I like what you guys are up also. Such clever work and reporting! Keep up the superb works guys I have incorporated you guys to my blogroll. I think it’ll improve the value of my site :)

  11. Thank you, I have just been looking for information about this topic for a while and yours is the best I have discovered till now. But, what about the bottom line? Are you sure in regards to the supply?

  12. Hello!,I like your textwriting is very good! percentage we keep up a correspondence extra approximately your post on AOL? I require an expert on this area to resolve my problem.

  13. Hey mate, .This was an excellent post for such a hard subject to talk about. I look forward to seeing numerous more exceptional posts like this one. Thanks

  14. my blog says:

    I like the valuable info you offer inside your articles. IÒ€ℒll bookmark your blog and check again here regularly. IÒ€ℒm quite certain IÒ€ℒll learn many new stuff right here! Very good luck for the next!

  15. I simply want to tell you that I am very new to weblog and seriously savored this website. Probably I’m going to bookmark your site . You surely come with perfect stories. Thank you for sharing your webpage.

  16. I have to show my thanks to this writer for rescuing me from this problem. Just after scouting throughout the internet and finding views which were not productive, I figured my life was gone. Existing devoid of the solutions to the difficulties you’ve solved as a result of the guide is a critical case, as well as the ones that could have adversely damaged my career if I had not noticed your web page. Your primary know-how and kindness in controlling all the pieces was precious. I am not sure what I would have done if I had not come upon such a step like this. I am able to at this point look ahead to my future. Thanks very much for your expert and result oriented help. I won’t hesitate to suggest the blog to anybody who requires direction about this issue.

  17. tech news says:

    I would like to thank you for the efforts you have put in writing this site. I am hoping the same high-grade web site post from you in the upcoming also. In fact your creative writing skills has inspired me to get my own site now. Actually the blogging is spreading its wings fast. Your write up is a great example of it.

  18. What’s up to every one, it’s really a good for
    me to pay a quick visit this web page, it contains priceless Information.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>