include files in perl
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
"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
Re: include files in perl
In article <email@example.com>, daniel kaplan
> 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
> "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
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.
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.
|All times are GMT. The time now is 01:37 AM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.