in reply to Re^6: Perl vs. PHP
in thread Perl vs. PHP
It becomes a bigger deal when you get into non-OO stuff. In Perl, you can do something like this:
This imports the 'get' function into the 'Foo' namespace without trampling functions called 'get' in other namespaces. There is no equivalent to this in PHP because there is only namespace. You would always have to call all class methods by their fully-qualified names. That may not sound annoying until you consider some short and popular function names like try/catch. In Perl, you can define 'try' to mean one thing in one class and another thing in another, but not in PHP. This also means that if you want to override 'exit' in a certain place to do something special, you can do it in Perl but not in PHP.package Foo; use LWP::Simple qw(get); my $content = get('http://perlmonks.org/');
So, PHP5 classes look like they will help with isolation if you can stick with OO throughout, but are ultimately not as flexible as Perl's namespaces.
|
|---|