[Chicago-talk] Shortening a module name

brian d foy brian.d.foy at gmail.com
Mon Feb 20 12:31:19 PST 2006

On 2/20/06, Jay Strauss <me at heyjay.com> wrote:

> is there a way I could provide a shortcut, in
> Finance::InteractiveBrokers::TWS, for the user to create a contract, without
> having to build a sub like
> sub new_Contract {
>     my $self = shift;
>     return
> Finance::InteractiveBrokers::TWS::com::ib::client::Contract->new(@_);
> }

Why don't you want to do it that way? It's easy to understand, doesn't
require any magic, and the user doesn't have to see it. :)

You can make a contract part of the TWS object (whatever that is)
using a has-a relationship.  In Finance::InteractiveBrokers::TWS, you
have a contract() method that returns the contract object. That then
allows you to do the method chaining that you want.

brian d foy <brian.d.foy at gmail.com>

More information about the Chicago-talk mailing list