Open dionys opened 9 years ago
Thank you for your input, @dionys.
This issue annoys me too, and maybe I didn't think it through when I was first creating the classes :) But still, I'm not quite sure of what would be the best way to go.
The third way seemed too long for me. The second way would seem messy with internal namespaces, so that Business::CPI::PayPal::*
is in the same namespace as Business::CPI::Role::*
, etc. Seems weird to me, but maybe I should just get over it. Another issue would be that it wouldn't be clear that Business::CPI::MyDriver::Gateway
is the main class of MyDriver. Maybe it should be called just Business::CPI::MyDriver
? But then again, there are things like Business::CPI::Util
. Seems incoherent to me.
Finally, the first case.. my issue with it is that a typical, complex, driver would have a directory more or less like this:
- lib/
- Business/
- CPI/
- Gateway/
- MyDriver.pm
- Buyer/
- MyDriver.pm
- Cart/
- MyDriver.pm
- Item/
- MyDriver.pm
- Receiver/
- MyDriver.pm
- Account/
- MyDriver.pm
That is also weird for me. When it gets installed, the driver won't have a directory of it's own, it will be scattered around the same folders as the other drivers.
Well, anyway, these are my thoughts on the issue. Do you still think ${class_name}::${driver_name}
is the way to go? Why do you prefer that way?
Hmm. You’re right.
Taking in response to your comments I see 2 ways:
Business::CPI::Gateway::MyDriver
Business::CPI::Gateway::MyDriver::*
DBI
& DBD
)
Business::CPG::MyDriver
(or CPIG
, or CPD
, etc)Business::CPG::MyDriver::*
I hadn't thought of the other namespace! Sounds very reasonable!
I think another name-space looks more intelligent decision!
Renato,
Eokoe.com
On Wed, Feb 4, 2015 at 6:58 PM, André Walker notifications@github.com wrote:
I hadn't thought of the other namespace! Sounds very reasonable!
— Reply to this email directly or view it on GitHub https://github.com/andrewalker/p5-business-cpi/issues/31#issuecomment-72937492 .
So. If you will use another namespace, then no more needed Business::CPI::Base
namespace: Business::CPI::Base::Buyer
will be Business::CPI::Buyer
, etc.
Sure. Much better.
The drivers and their parts (like buyer, card, etc) uses different methods to create the namespaces. For example, if we have the driver
MyDriver
, then its module will be namedBusiness::CPI::Gateway::MyDriver
(likeBusiness::CPI::Gateway::PayPal
). But the buyer module for this driver will be namedBusiness::CPI::MyDriver::Buyer
, becauseBusiness::CPI::Util::load_class()
function uses templateBusiness::CPI::${driver_name}::${class_name}
. So we have two different ways to create the namespaces${class_name}::${driver_name}
and${driver_name}::${class_name}
.I think that need to use only one of these ways:
or
or may be third
And I propose the first (
${class_name}::${driver_name}
) way.