Ask a Question related to PERL Miscellaneous, Design and Development.
-
Garry Heaton #1
Perl way to do PHP includes?
Are the following Perl/PHP methods roughly equivalent in function and
efficiencey?
1. use Perl_package;
require_once(file.php);
2. open FILE, "< $perl_file";
include(file.php);
I'm trying to determine whether Perl/CGI.pm (no Embperl, Mason etc.) is
sufficient for converting PHP scripts without incurring serious inefficiencies.
Regards
Garry Heaton
Garry Heaton Guest
-
PHP Includes
Hello, I am installing coppermine photo gallery on my site. I think I am running into problems - I get the following error message after... -
PHP includes in DW Mx
I have just built a site and used php includes for the menu, for some reason when I am in design view it totally screws the page up and I am unable... -
Bogus error messages re Perl/lib/CORE/ includes
Hi, Every now and then I get errors like the following when trying to compile a perl extension (perl 5.8, Win32): ... -
Help w/ Includes & CSS
for some reason after I upgraded from MX 2004 to DreamWeaver 8, my site doesn't doesn't format with the style sheet i used previously in 2004. Also... -
XP includes ???????
ah, ok, thanks -
Eric Schwartz #2
Re: Perl way to do PHP includes?
Garry Heaton <none@none.com> writes:
Vaguely. You should read the perlmod docs ('perldoc perlmod') to find> Are the following Perl/PHP methods roughly equivalent in function and
> efficiencey?
>
> 1. use Perl_package;
> require_once(file.php);
out exactly how this works. PHP just reads in the file and defines
all the functions in it in the global namespace; Perl lets you be more
fine-grained if you choose.
Not even close. Did you read the Perl docs for open() to see what it> 2. open FILE, "< $perl_file";
> include(file.php);
does?
The question to be sure you've answered is why convert them if they're> I'm trying to determine whether Perl/CGI.pm (no Embperl, Mason etc.) is
> sufficient for converting PHP scripts without incurring serious inefficiencies.
working now? Assuming you have a good reason, then it's best to have
a good understanding of both languages. perldoc perlbook for more
details about learning Perl.
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
Eric Schwartz Guest
-
Garry Heaton #3
Re: Perl way to do PHP includes?
Eric Schwartz wrote:Sorry, should have followed-up:> Garry Heaton <none@none.com> writes:
>>>>Are the following Perl/PHP methods roughly equivalent in function and
>>efficiencey?
>>
>>1. use Perl_package;
>> require_once(file.php);
>
> Vaguely. You should read the perlmod docs ('perldoc perlmod') to find
> out exactly how this works. PHP just reads in the file and defines
> all the functions in it in the global namespace; Perl lets you be more
> fine-grained if you choose.
>
>>>>2. open FILE, "< $perl_file";
>> include(file.php);
>
> Not even close. Did you read the Perl docs for open() to see what it
> does?
>
>>>>I'm trying to determine whether Perl/CGI.pm (no Embperl, Mason etc.) is
>>sufficient for converting PHP scripts without incurring serious inefficiencies.
>
> The question to be sure you've answered is why convert them if they're
> working now? Assuming you have a good reason, then it's best to have
> a good understanding of both languages. perldoc perlbook for more
> details about learning Perl.
>
> -=Eric
2. open FILE, "< $perl_file";
while (<FILE>) {
print;
};
Garry
Garry Heaton Guest
-
Garry Heaton #4
Re: Perl way to do PHP includes?
Garry Heaton wrote:
Or maybe even:> Eric Schwartz wrote:
>>>>Garry Heaton <none@none.com> writes:
>>
>>>>>>>Are the following Perl/PHP methods roughly equivalent in function and
>>>efficiencey?
>>>
>>>1. use Perl_package;
>>> require_once(file.php);
>>
>>Vaguely. You should read the perlmod docs ('perldoc perlmod') to find
>>out exactly how this works. PHP just reads in the file and defines
>>all the functions in it in the global namespace; Perl lets you be more
>>fine-grained if you choose.
>>
>>
>>>>>>>2. open FILE, "< $perl_file";
>>> include(file.php);
>>
>>Not even close. Did you read the Perl docs for open() to see what it
>>does?
>>
>>
>>>>>>>I'm trying to determine whether Perl/CGI.pm (no Embperl, Mason etc.) is
>>>sufficient for converting PHP scripts without incurring serious inefficiencies.
>>
>>The question to be sure you've answered is why convert them if they're
>>working now? Assuming you have a good reason, then it's best to have
>>a good understanding of both languages. perldoc perlbook for more
>>details about learning Perl.
>>
>>-=Eric
>
> Sorry, should have followed-up:
>
> 2. open FILE, "< $perl_file";
> while (<FILE>) {
> print;
> };
>
> Garry
>
2. open FILE, "< $perl_file";
while (<FILE>) {
print;
}
Garry
Garry Heaton Guest
-
Tad McClellan #5
Re: Perl way to do PHP includes?
Garry Heaton <none@none.com> wrote:
> 2. open FILE, "< $perl_file";
You should always, yes *always*, check the return value from open():
open FILE, $perl_file or die "could not open '$perl_file' $!";
--
Tad McClellan SGML consulting
[email]tadmc@augustmail.com[/email] Perl programming
Fort Worth, Texas
Tad McClellan Guest
-
Eric Schwartz #6
Re: Perl way to do PHP includes?
Garry Heaton <none@none.com> writes:
These are still completely different from include('file.php') in PHP.> Garry Heaton wrote:>>> Sorry, should have followed-up:
>>
>> 2. open FILE, "< $perl_file";
>> while (<FILE>) {
>> print;
>> };
>>
>> Garry
>>
> Or maybe even:
>
> 2. open FILE, "< $perl_file";
> while (<FILE>) {
> print;
> }
It might not hurt to read the PHP docs to understand what include()
does, and why it's not the same thing as what you just printed above.
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
Eric Schwartz Guest



Reply With Quote

