Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > include files in perl

Reply
Thread Tools

include files in perl

 
 
daniel kaplan
Guest
Posts: n/a
 
      09-17-2004
i am a newbie PERL programmer, oldtime C guy here....anyway, i am starting
some PERL scripts on a shared LINUX server. i cannot store my MySQL login
parametrs in the apache config, since it is shared....so i was suggested
this:

"Typically the best way to handle mysql password protection is to put it in
a "config" file, that will not be rendered as text by the web server, such
as config.php. This way if someone calls the file directly, they get a blank
page. Then use the config.php as an include in your web code. This way you
only have the password in one place, and it is protected."

my questions are, what permissions do i need to set the file at, and how do
you INCLUDE a file in a PERL (PL) script? my only perl reference book makes
no metnion?

thanks


 
Reply With Quote
 
 
 
 
Jim Gibson
Guest
Posts: n/a
 
      09-17-2004
In article <>, daniel kaplan
<> wrote:

> i am a newbie PERL programmer, oldtime C guy here....anyway, i am starting
> some PERL scripts on a shared LINUX server. i cannot store my MySQL login
> parametrs in the apache config, since it is shared....so i was suggested
> this:
>
> "Typically the best way to handle mysql password protection is to put it in
> a "config" file, that will not be rendered as text by the web server, such
> as config.php. This way if someone calls the file directly, they get a blank
> page. Then use the config.php as an include in your web code. This way you
> only have the password in one place, and it is protected."
>
> my questions are, what permissions do i need to set the file at, and how do
> you INCLUDE a file in a PERL (PL) script? my only perl reference book makes
> no metnion?


You can use 'do', 'eval', 'require', or 'use' to include statements
from external files. Each has a slightly different action. Check your
Perl documentation.

P.S.: Many experienced Perl users dislike the all-caps version of the
word. Same for Linux. They are words, not acronyms.

FYI: this newsgroup is defunct; try comp.lang.perl.misc in the future.
 
Reply With Quote
 
 
 
 
Windex007 Windex007 is offline
Junior Member
Join Date: Dec 2009
Posts: 1
 
      12-18-2009
Jim Gibson,

I recognize that I'm half a decade late into this thread, but even if you don't read this, I hope someone similar to you (and there seem to be many in the Perl forums) does.

I NEVER post in forums. I had to create this account just to respond to this one. I do a lot of programming in PHP, and it has a great and helpful community. Learning it was very easy because you can google almost any obscure problem imaginable and you'll turn up some kind of relevant result.

While the manual is extremely useful, sometimes you don't know exactly how to describe what you're looking for or what functions are appropriate for the task you want to accomplish (and lets be honest here, perl nomenclature deviaties from other similar languages in some, IMO, unintuitive ways). In those situations, googeling a well constructed thought and adding the term of the programming language you want to apply this concept to will very likely turn up forum results. Searching the Perl Documentation for the same phrase would likely turn up nothing.

As I mentioned before, the PHP community is great. The vast majority of forum posts that I stumble upon have relevant answers, often a personal useage anectode, and maybe even some words of warning. As a courtesy code snippets are usually included. If the user is aware of a document with an exceptionally well written explation they'll hyperlink it. And beyond all of that, I would say the MOST important thing, is that as a general rule most people in those forums arn't so full of themselves and snooty that reading their posts doesn't make you want to throw up.

The perl community is abysmal. In my searches I have found forum post after forum post with people asking for help and essentially getting RTFM'ed. Half the time it isn't even relevant. Have you read the documentation well enough to know that the question being asked is directly addressed in the documentation? Sometimes (nearly always) the "answer" lies in a combination of different things that are spread out in different areas.

The breakdown of your response is basically this: "do, eval, require, or use ... allow me to preach at you about when it isn't ok to use capital letters... FYI: never come back here".

Your actual post was strong on grammar and spelling. Other then that it was worthless and condescending. I would be willing to bet that whoever asked that question was already aware of those constructs because I'm sure they're capable of a trivial google search. I'm pretty sure they were looking for guidance on which of them would be the best to use in the situation that he took the time to describe. Maybe even an explanation on WHY so that he could draw off of your EXPERIENCE and WISDOM so that instead of becoming a library of syntax he could instead have the tools to synthesize brilliance. Maybe instead of wanting to solve a simple problem, he wanted to solve it ELEGANTLY.

So, in short. This is my open letter to the perl community: Stop being such f****** a** holes. Lurking through your cummunity forums is beyond frustrating, I can't even imagine how discouraged the actual posters are.

Sincerely,
Shawn
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FAQ 5.38 Why does Perl let me delete read-only files? Why does "-i" clobber protected files? Isn't this a bug in Perl? PerlFAQ Server Perl Misc 0 03-09-2011 11:00 PM
FAQ 5.38 Why does Perl let me delete read-only files? Why does "-i" clobber protected files? Isn't this a bug in Perl? PerlFAQ Server Perl Misc 0 02-11-2011 05:00 AM
Perl / cgi / include file a la #include me Perl Misc 10 03-26-2010 10:21 PM
/* #include <someyhing.h> */ => include it or do not include it?That is the question .... Andreas Bogenberger C Programming 3 02-22-2008 10:53 AM
include files with Perl Dan P Perl Misc 4 07-15-2004 05:00 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57