Re: module for development

2011-12-15 Thread Ken Peng
2011/12/15 Shlomi Fish : > > See: > > http://search.cpan.org/dist/Devel-TraceUse/ > Great module, the result it prints is good. Thanks Shlomi. Ken. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: module for development

2011-12-15 Thread Shlomi Fish
Hi Ken, On Thu, 15 Dec 2011 21:01:28 +0800 Ken Peng wrote: > Hello, > > Which module could show the order of loading modules? > For example, > > use Foo; > use Bar; > > BEGIN { > require A; > } > > I want to know in what order Perl loads these modules. > See: http://search.cpan.org/d

Re: module for development

2011-12-15 Thread Shawn H Corey
On 11-12-15 10:09 AM, Brian Fraser wrote: Close, but that won't work, because keys in %INC are paths, and you are still leaving the ::'s unchanged. use 5.014; use File::Basename; # must be before `use lib` use lib dirname( $INC{ __PACKAGE__ =~ s!::!/!r . '.pm' } ); That should do. Plus more mang

Re: module for development

2011-12-15 Thread Ken Peng
> Hm, that's not quite right. It updates %INC as soon as it can open a filehandle and start reading, but I don't think it ever updates @INC unless you ask it to (e.g. by 'use lib' or -I on the command line, or mucking with it manually). > sorry my typo. it is %inc not @inc. if perl updates %inc a

Re: module for development

2011-12-15 Thread Brian Fraser
On Thu, Dec 15, 2011 at 12:00 PM, Shawn H Corey wrote: > On 11-12-15 09:02 AM, Ken Peng wrote: > >> BEGIN { >> my $module_dir = $INC{'Net/Evernote.pm'}; >> $module_dir =~ s/Evernote\.pm$//; >> unshift @INC,$module_dir; >> } >> >> This begin block setup the @INC by adding a path as the

Re: module for development

2011-12-15 Thread Shawn H Corey
On 11-12-15 09:02 AM, Ken Peng wrote: BEGIN { my $module_dir = $INC{'Net/Evernote.pm'}; $module_dir =~ s/Evernote\.pm$//; unshift @INC,$module_dir; } This begin block setup the @INC by adding a path as the module itself, it does work. Try this instead (no BEGIN needed): package

Re: module for development

2011-12-15 Thread Brian Fraser
On Thu, Dec 15, 2011 at 11:02 AM, Ken Peng wrote: > 2011/12/15 Brian Fraser : > > > > The second way is using an @INC hook, which is explained in perldoc -f > > require. Here's a pretty simple form: > > > > BEGIN { unshift @INC, sub { say "@_[0..$#_]"; return } } > > > > But the real question her

Re: module for development

2011-12-15 Thread Jenda Krynicky
From: Brian Fraser > On Thu, Dec 15, 2011 at 10:09 AM, shawn wilson wrote: > > > Strace stat(64) should do you. > > On Dec 15, 2011 8:03 AM, "Ken Peng" wrote: > > > > > Hello, > > > > > > Which module could show the order of loading modules? > > > For example, > > > > > > use Foo; > > > use Bar

Re: module for development

2011-12-15 Thread Ken Peng
2011/12/15 shawn wilson : > > hence why i recommended strace so that you could see where perl looks > for modules and in what order. > > that said, if someone has a way inside perl to do the same thing, it > might be cool to know. Yup I did the strace as you suggested and got some useful stuff. T

Re: module for development

2011-12-15 Thread shawn wilson
On Thu, Dec 15, 2011 at 09:02, Ken Peng wrote: > 2011/12/15 Brian Fraser : >> > Since these modules exist in  the same library dir as Evernote.pm. > (in my OS it's /usr/local/share/perl/5.10.0/Net/Evernote.pm) > But their names are not began with "Net::“ as they should be. > (in my OS,  they are

Re: module for development

2011-12-15 Thread Ken Peng
2011/12/15 Brian Fraser : > > The second way is using an @INC hook, which is explained in perldoc -f > require. Here's a pretty simple form: > > BEGIN { unshift @INC, sub { say "@_[0..$#_]"; return } } > > But the real question here is, why do you need to know this? > Thanks Brian, your info is m

Re: module for development

2011-12-15 Thread Brian Fraser
On Thu, Dec 15, 2011 at 10:09 AM, shawn wilson wrote: > Strace stat(64) should do you. > On Dec 15, 2011 8:03 AM, "Ken Peng" wrote: > > > Hello, > > > > Which module could show the order of loading modules? > > For example, > > > > use Foo; > > use Bar; > > > > BEGIN { > > require A; > > } >

Re: module for development

2011-12-15 Thread shawn wilson
Strace stat(64) should do you. On Dec 15, 2011 8:03 AM, "Ken Peng" wrote: > Hello, > > Which module could show the order of loading modules? > For example, > > use Foo; > use Bar; > > BEGIN { > require A; > } > > I want to know in what order Perl loads these modules. > > Thanks. > > -- > To u