Eric Wilhelm wrote:
# from Sébastien Aperghis-Tramoni
# on Monday 08 October 2007 16:02:
use relative;
my $Customer = import relative qw(Report Customer);
This changes the require() on Foo::Report and Foo::Customer to run-
time
though, right?
Right, but I'd say that for
--- Sébastien Aperghis-Tramoni [EMAIL PROTECTED] wrote:
Hmm.. As is, relative.pm already allows you to do that (thanks to Ken
Williams' suggestion):
package My::Enterprise::Framework;
use relative;
my $Customer = import relative qw(Report Customer);
my $customer =
--- A. Pagaltzis [EMAIL PROTECTED] wrote:
* Eric Wilhelm [EMAIL PROTECTED] [2007-10-09 01:55]:
This changes the require() on Foo::Report and Foo::Customer to
run-time though, right?
use Devel::BeginLift qw( require );
Cute trick, but I wondered if that would globally break require.
Ovid wrote:
I do get tired of writing code like that (it happens a lot in test
suites when I have use_ok $CLASS in a BEGIN block).
OT, but 'ok.pm' is quite nice:
use Test::More tests = 1;
use ok 'My::Module'; # test runs at compile time
Regards,
Jonathan Rockway
signature.asc
# from A. Pagaltzis
# on Monday 08 October 2007 22:50:
* Eric Wilhelm [EMAIL PROTECTED] [2007-10-09 01:55]:
This changes the require() on Foo::Report and Foo::Customer to
run-time though, right?
use Devel::BeginLift qw( require );
The import() method is calling require at run-time.
--- Jonathan Rockway [EMAIL PROTECTED] wrote:
OT, but 'ok.pm' is quite nice:
use Test::More tests = 1;
use ok 'My::Module'; # test runs at compile time
Oh, I really like that, but it still causes an issue for me. You see,
a lot of what I do is stuff like this:
my $CLASS;
BEGIN {
# from Sébastien Aperghis-Tramoni
# on Tuesday 09 October 2007 00:07:
This changes the require() on Foo::Report and Foo::Customer to run-
time though, right?
Right, but I'd say that for writing object-oriented code, there isn't
such a need to do things at compile time, is it?
Probably not,
* Eric Wilhelm [EMAIL PROTECTED] [2007-10-09 09:50]:
The import() method is calling require at run-time. That's
going to take some heavy lifting ;-)
Err, I meant `qw( import )`.
Regards,
--
Aristotle Pagaltzis // http://plasmasturm.org/
* Ovid [EMAIL PROTECTED] [2007-10-09 09:40]:
--- A. Pagaltzis [EMAIL PROTECTED] wrote:
* Eric Wilhelm [EMAIL PROTECTED] [2007-10-09 01:55]:
This changes the require() on Foo::Report and Foo::Customer
to run-time though, right?
use Devel::BeginLift qw( require );
Cute trick,
Ovid writes:
With the lovely ok.pm module, I still have the following clunky
construct:
my $CLASS;
BEGIN {
$CLASS = 'Customer';
}
use ok $CLASS or die;
can_ok $CLASS, 'new';
ok my $cust = $CLASS-new, '... and we can call it';
isa_ok $cust, $CLASS, '... and the
* Smylers [EMAIL PROTECTED] [2007-10-09 10:25]:
Well don't have them then -- put the assignment in the use
statement, which is run at BEGIN time anyway:
use Test::More tests = 1;
my $CLASS;
use ok $CLASS = 'DateTime';
Sneaky! I like.
--
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(,$\/,
Ovid wrote:
--- Sébastien Aperghis-Tramoni [EMAIL PROTECTED] wrote:
Eric Wilhelm wrote:
use relative;
my $Customer = import relative qw(Report Customer);
This changes the require() on Foo::Report and Foo::Customer to run-
time though, right?
Right, but I'd say
--- Sébastien Aperghis-Tramoni [EMAIL PROTECTED] wrote:
Hello,
The version 0.02 of relative.pm is now available on the CPAN.
Thanks to everybody who suggested improvements.
(And it still works on Perl 5.004 :-)
I like the idea of this module. Lots of people like the idea of
'aliased'.
On 8 Oct 2007, at 11:28, Ovid wrote:
[snip]
I like the idea of this module. Lots of people like the idea of
'aliased'. Would it be worth combining the two?
use My::Enterprise::Framework;
use relative -aliased = qw(Customer Report);
# instead of:
# my $customer =
Ovid wrote:
I like the idea of this module. Lots of people like the idea of
'aliased'. Would it be worth combining the two?
use My::Enterprise::Framework;
use relative -aliased = qw(Customer Report);
# instead of:
# my $customer = My::Enterprise::Framework::Customer-new($id);
#
# from Sébastien Aperghis-Tramoni
# on Monday 08 October 2007 16:02:
use relative;
my $Customer = import relative qw(Report Customer);
This changes the require() on Foo::Report and Foo::Customer to run-time
though, right?
If only we had userland pragmas, you could just create
* Eric Wilhelm [EMAIL PROTECTED] [2007-10-09 01:55]:
This changes the require() on Foo::Report and Foo::Customer to
run-time though, right?
use Devel::BeginLift qw( require );
:-
Regards,
--
Aristotle Pagaltzis // http://plasmasturm.org/
17 matches
Mail list logo