Re: RFC: relative.pm

2007-10-06 Thread Sébastien Aperghis-Tramoni

Hello Aristotle,


A. Pagaltzis wrote:


Hi Sébastien,

* Sébastien Aperghis-Tramoni [EMAIL PROTECTED] [2007-10-06 03:05]:

package BigApp::Report;
use relative to_parent = qw(Utils);
# loads BigApp::Utils

use relative to_self = qw(Create Publish);
# loads BigApp::Report::Create, BigApp::Report::Publish


I like the idea. Catalyst privately invents something like that,
so obviously there are other people who feel the same need.


Yes, POE also provide a similar mechanism, that's why I was thinking  
to provide a generic module to do that.



But I like neither the name nor the interface. How about this:

package BigApp::Report;
use subclass qw(..::Utils Create Publish);
# loads BigApp::Utils, BigApp::Report::Create,  
BigApp::Report::Publish


subclass would imply more OO semantic than I'd like, as the module  
just loads others modules, but I agree it's a better name than  
relative and I can't find a better one.
Also agreeing for the API change. I know I was pondering about using  
.. but can't remember why I didn't.



Thanks

--
Sébastien Aperghis-Tramoni

Close the world, txEn eht nepO.




Re: RFC: relative.pm

2007-10-06 Thread Andy Armstrong

On 6 Oct 2007, at 11:17, Sébastien Aperghis-Tramoni wrote:

I like the idea. Catalyst privately invents something like that,
so obviously there are other people who feel the same need.


Yes, POE also provide a similar mechanism, that's why I was  
thinking to provide a generic module to do that.



But I like neither the name nor the interface. How about this:

package BigApp::Report;
use subclass qw(..::Utils Create Publish);
# loads BigApp::Utils, BigApp::Report::Create,  
BigApp::Report::Publish


subclass would imply more OO semantic than I'd like, as the  
module just loads others modules, but I agree it's a better name  
than relative and I can't find a better one.
Also agreeing for the API change. I know I was pondering about  
using .. but can't remember why I didn't.


Would it also do

use relative [to = 'My::Big::Namespace'] = qw( This That  
Munger::Fast Munger::Precise );


?

--
Andy Armstrong, Hexten





Re: RFC: relative.pm

2007-10-06 Thread Sébastien Aperghis-Tramoni

Andy Armstrong wrote:


But I like neither the name nor the interface. How about this:

package BigApp::Report;
use subclass qw(..::Utils Create Publish);
# loads BigApp::Utils, BigApp::Report::Create,  
BigApp::Report::Publish


subclass would imply more OO semantic than I'd like, as the  
module just loads others modules, but I agree it's a better name  
than relative and I can't find a better one.
Also agreeing for the API change. I know I was pondering about  
using .. but can't remember why I didn't.


Would it also do

use relative [to = 'My::Big::Namespace'] = qw( This That  
Munger::Fast Munger::Precise );


It can easily do that. The problem is more the name. In this case,  
use relative to ... works well. But in y original example, use  
subclass works better. Maybe I should provide both modules then.


--
Sébastien Aperghis-Tramoni

Close the world, txEn eht nepO.




Re: RFC: relative.pm

2007-10-06 Thread Andy Armstrong

On 6 Oct 2007, at 11:46, Sébastien Aperghis-Tramoni wrote:

Would it also do

use relative [to = 'My::Big::Namespace'] = qw( This That  
Munger::Fast Munger::Precise );


It can easily do that. The problem is more the name. In this case,  
use relative to ... works well. But in y original example, use  
subclass works better. Maybe I should provide both modules then.


I always hesitate to suggest Aristotle is mistaken - it's not a  
common occurrence - but I really think 'subclass' is wrong. As you  
said this is an extension to the semantics of use that has (I  
presume) nothing to do with any inheritance relationship the modules  
may have with each other.


I quite like 'relative' to be honest. And I like the idea of the  
module. I'll use it immediately when you release it, thanks.


--
Andy Armstrong, Hexten





Re: RFC: relative.pm

2007-10-06 Thread Sébastien Aperghis-Tramoni

Andy Armstrong wrote:


Would it also do

use relative [to = 'My::Big::Namespace'] = qw( This That  
Munger::Fast Munger::Precise );


It can easily do that. The problem is more the name. In this case,  
use relative to ... works well. But in y original example, use  
subclass works better. Maybe I should provide both modules then.


I always hesitate to suggest Aristotle is mistaken - it's not a  
common occurrence - but I really think 'subclass' is wrong. As you  
said this is an extension to the semantics of use that has (I  
presume) nothing to do with any inheritance relationship the  
modules may have with each other.


Mixing both your and Aristotle's suggestions, here is the new synopsis:

package BigApp::Report;

use relative qw(Create Publish);
# loads BigApp::Report::Create, BigApp::Report::Publish

use relative qw(..::Utils);
# loads BigApp::Utils

use relative to = Enterprise::Framework = qw(Base Factory);
# loads Enterprise::Framework:Base, Enterprise::Framework::Factory


I quite like 'relative' to be honest. And I like the idea of the  
module. I'll use it immediately when you release it, thanks.


Heh, thanks. I'll announce here when the module is available.


--
Sébastien Aperghis-Tramoni

Close the world, txEn eht nepO.



Re: RFC: relative.pm

2007-10-06 Thread David Golden
On 10/6/07, Andy Armstrong [EMAIL PROTECTED] wrote:
 I always hesitate to suggest Aristotle is mistaken - it's not a
 common occurrence - but I really think 'subclass' is wrong. As you
 said this is an extension to the semantics of use that has (I
 presume) nothing to do with any inheritance relationship the modules
 may have with each other.

++

 I quite like 'relative' to be honest. And I like the idea of the
 module. I'll use it immediately when you release it, thanks.

I agree with relative vs subclass -- and it does seem to be a very
useful module for anything with many classes and subclasses.

David


Re: relative.pm

2007-10-06 Thread Dr.Ruud
Sébastien Aperghis-Tramoni schreef:

  package BigApp::Report;

These would also be nice:

package BigApp::__FROMFILE__;

package BigApp::__FROMFILE__($RCSfile);

-- 
Affijn, Ruud

Gewoon is een tijger.



Moving a module to another distribution

2007-10-06 Thread Chris Dolan
We're thinking about promoting one of the Perl::Critic::More policies  
to the core Perl::Critic distribution.  As long as the version number  
increases and PAUSE permissions are OK that should be fine, right?


  http://search.cpan.org/perldoc? 
Perl::Critic::Policy::ValuesAndExpressions::ProhibitMagicNumbers


Chris


Fwd: CPAN Upload: S/SA/SAPER/relative-0.01.tar.gz

2007-10-06 Thread Sébastien Aperghis-Tramoni

Hello,


relative.pm is now available on the CPAN. Thanks to Aristotle and  
Andy for their suggestions.

For people who care about this, it even works on Perl 5.004


Forwarded message:


From: PAUSE [EMAIL PROTECTED]
Date: 6 octobre 2007 18:39:45 HAEC
To: Sebastien Aperghis-Tramoni [EMAIL PROTECTED]
Subject: CPAN Upload: S/SA/SAPER/relative-0.01.tar.gz

The uploaded file

relative-0.01.tar.gz

has entered CPAN as

  file: $CPAN/authors/id/S/SA/SAPER/relative-0.01.tar.gz
  size: 3962 bytes
   md5: 1127c3c21734e2ffd12bff036b944581

No action is required on your part
Request entered by: SAPER (Sébastien Aperghis-Tramoni)
Request entered on: Sat, 06 Oct 2007 16:38:50 GMT
Request completed:  Sat, 06 Oct 2007 16:39:45 GMT

Thanks,
--
paused, v929


--
Sébastien Aperghis-Tramoni

Close the world, txEn eht nepO.





Re: RFC: relative.pm

2007-10-06 Thread Ken Williams


On Oct 5, 2007, at 9:04 PM, Sébastien Aperghis-Tramoni wrote:

The interest of such a module would be to ease writing modules  
using a big set of sibling modules (in the same hierarchy), and  
would also simplify refactoring and renaming.


As of now the user still has to write the whole package later in the  
code:


package BigApp::Report;

use relative to_self = qw(Create Publish);
my $p = BigApp::Report::Publish-new;

If there were a return value from import(), they could do something  
like this instead:


package BigApp::Report;

use relative;
my $Pub = import relative to_self = qw(Create Publish);
my $p = $Pub-new;

 -Ken



Re: RFC: relative.pm

2007-10-06 Thread A. Pagaltzis
* Sébastien Aperghis-Tramoni [EMAIL PROTECTED] [2007-10-06 20:30]:
 As a side note, using find(1) on a mini-CPAN and Google
 CodeSearch, I only found 3 modules named tp.pm:

Don’t forget the darkPAN though.

 An acceptable compromise it to write it as C -to = Root 

That’s what I’d suggest. FWIW, even with the current interface,
it’s possible to load a to.pm if you do it this way:

use relative to = __PACKAGE __, qw(to from before after boo);

But that’s a) noisy b) less than self-suggesting. I’d stick the
hyphen on there to avoid that sort of irregularity. It’s a really
tiny change anyway.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/


Re: RFC: relative.pm

2007-10-06 Thread Eric Wilhelm
# from A. Pagaltzis
# on Saturday 06 October 2007 13:44:

Then again, I’d called mine lib::relative. Maybe this one should
be pkg::relative?

That sounds good.

--Eric
-- 
We who cut mere stones must always be envisioning cathedrals.
--Quarry worker's creed
---
http://scratchcomputing.com
---


Re: Fwd: CPAN Upload: S/SA/SAPER/relative-0.01.tar.gz

2007-10-06 Thread A. Pagaltzis
Hi Sébastien,

* Sébastien Aperghis-Tramoni [EMAIL PROTECTED] [2007-10-06 18:55]:
 relative.pm is now available on the CPAN.

nit:

--- relative.pm.orig2007-10-06 22:58:22.0 +0200
+++ relative.pm 2007-10-06 22:58:32.0 +0200
@@ -70 +70 @@
-# loads Enterprise::Framework:Base, Enterprise::Framework::Factory
+# loads Enterprise::Framework::Base, Enterprise::Framework::Factory

HTH,
-- 
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1}
Just-another-Perl-hack;
#Aristotle


Re: RFC: relative.pm

2007-10-06 Thread Sébastien Aperghis-Tramoni

Ken Williams wrote:

If there were a return value from import(), they could do something  
like this instead:


package BigApp::Report;

use relative;
my $Pub = import relative to_self = qw(Create Publish);
my $p = $Pub-new;


Except that, 1), the API has changed a bit, 2) I think import should  
return a list in this case because it's importing several modules at  
once. So  would write it like this:


package BigApp::Report;

use relative;
my ($Create, $Publish) = import qw(Create Publish);
my publisher = $Publish-new;

Looks a good idea. It should also DTRT so

my $Publish = import qw(Publish);

works as one expects. The only case left is:

my $What = import qw(One Two Three);

It could return the last one in order to mimic the comma operator.


--
Sébastien Aperghis-Tramoni

Close the world, txEn eht nepO.




Re: RFC: relative.pm

2007-10-06 Thread Sébastien Aperghis-Tramoni

David Cantrell wrote:


Also agreeing for the API change. I know I was pondering about using
.. but can't remember why I didn't.


'..' is only meaningful in the Unix/Win32 world.  VMS, RISC OS and
others call it something else.  On the other hand, I think it's  
safe to

assume that anyone using those platforms and perl will know what ..
means and if they don't I'm sure you'll document it.


For best or worse, Unix semantics are pretty common and have  
contaminated many other things not related to filesystems. Think of  
URL or XPath[1] for example.


[1] http://www.w3.org/TR/xpath#path-abbrev


--
Sébastien Aperghis-Tramoni

Close the world, txEn eht nepO.



Re: RFC: relative.pm

2007-10-06 Thread Sébastien Aperghis-Tramoni

A. Pagaltzis wrote:


* Sébastien Aperghis-Tramoni [EMAIL PROTECTED] [2007-10-06 20:30]:

As a side note, using find(1) on a mini-CPAN and Google
CodeSearch, I only found 3 modules named tp.pm:


Don’t forget the darkPAN though.


On a side note, if some people here know Perl modules outside CPAN  
but available on the internet, I'll gladly accept patches to list  
them in Module::ThirdParty.



An acceptable compromise it to write it as C -to = Root 


That’s what I’d suggest. FWIW, even with the current interface,
it’s possible to load a to.pm if you do it this way:

use relative to = __PACKAGE __, qw(to from before after boo);

But that’s a) noisy b) less than self-suggesting. I’d stick the
hyphen on there to avoid that sort of irregularity. It’s a really
tiny change anyway.


Ok, ok, you've convinced me :-)
Will change this, along with your patch and Ken's idea.

--
Sébastien Aperghis-Tramoni

Close the world, txEn eht nepO.




Re: relative.pm

2007-10-06 Thread Sébastien Aperghis-Tramoni

Dr.Ruud wrote:


Sébastien Aperghis-Tramoni schreef:


 package BigApp::Report;


These would also be nice:

package BigApp::__FROMFILE__;

package BigApp::__FROMFILE__($RCSfile);


Not sure how this is supposed to work, but I think this is beyond the  
aim of relative.pm



--
Sébastien Aperghis-Tramoni

Close the world, txEn eht nepO.




Re: RFC: relative.pm

2007-10-06 Thread Bill Ward
On 10/6/07, Andy Armstrong [EMAIL PROTECTED] wrote:
 On 6 Oct 2007, at 11:46, Sébastien Aperghis-Tramoni wrote:
  Would it also do
 
  use relative [to = 'My::Big::Namespace'] = qw( This That
  Munger::Fast Munger::Precise );
 
  It can easily do that. The problem is more the name. In this case,
  use relative to ... works well. But in y original example, use
  subclass works better. Maybe I should provide both modules then.

 I always hesitate to suggest Aristotle is mistaken - it's not a
 common occurrence - but I really think 'subclass' is wrong. As you
 said this is an extension to the semantics of use that has (I
 presume) nothing to do with any inheritance relationship the modules
 may have with each other.

I quite agree.

 I quite like 'relative' to be honest. And I like the idea of the
 module. I'll use it immediately when you release it, thanks.

I think the word relative is correct but lacks context.  The only
good thing about subclass is that it gives context, but the OO
implications are too strong.  Maybe some other name that suggests
*what* is relative?

Would lib::relative be too weird?


Re: RFC: relative.pm

2007-10-06 Thread Bill Ward
On 10/6/07, David Cantrell [EMAIL PROTECTED] wrote:
 Sébastien Aperghis-Tramoni wrote:
  Also agreeing for the API change. I know I was pondering about using
  .. but can't remember why I didn't.

 '..' is only meaningful in the Unix/Win32 world.  VMS, RISC OS and
 others call it something else.  On the other hand, I think it's safe to
 assume that anyone using those platforms and perl will know what ..
 means and if they don't I'm sure you'll document it.

Mac OS X also uses '..' since it's Unix-based.  That covers the vast
majority of Perl platforms.