|
List Info
Thread: improve B::Concise -src support
|
|
| improve B::Concise -src support |

|
2007-09-24 01:28:28 |
this patch does:
1 - improves -src lookup by finding the
"_<$file" in %::
This makes it work for relative paths, where it previously
used *only* the basename extracted from the COP
[jimc harpo bc-stash]$ ./perl -d -Iext/B -MO=Concise,-src
../ex-optrees.pl
...
# 30: print $i;
2p <;>
dbstate(main 15
ex-optrees.pl:30) v ->2q
2 - adds a 1-liner tip showing that concise_stashref
exists,
and how to use it. Changes for 1 also work here with -src
perl -MB::Concise -e
'B::Concise::compile("-exec","-src",
%B::Concise: ->()'
|
|
|
| Re: improve B::Concise -src support |

|
2007-09-24 10:38:10 |
On 9/23/07, Jim Cromie <jim.cromie gmail.com> wrote:
> 2 - adds a 1-liner tip showing that concise_stashref
exists,
> and how to use it. Changes for 1 also work here with
-src
>
> perl -MB::Concise -e
'B::Concise::compile("-exec","-src",
> %B::Concise: ->()'
That's neat. What do you think of promoting that to an
import option
so O.pm can still be there as normal:
perl -MO=Concise,-exec,-src=B::Concise -e1
> - open (my $fh, $file)
> - or warn "# $file: $!, (chdirs not
supported by this feature yet)n"
> + unless (-f $fullnm) {
> + ($fullnm) = grep /$file$/, keys %:: ;
> + $fullnm =~ s/^_<//;
If <_$file exists, shouldn't it be preferred over the
file system?
They can be different. Also, my filenames almost always have
the '.'
regexp meta character. All the other ones are also allowed.
How about
a quotemeta in there?
> + open (my $fh, $fullnm)
Again, '<' and other things special to open() are allowed
in my
filename. This oughta be three-arg or with the piles of
"< $fullnm "
stuff
> +This renders all functions in the B::Concise package
with the source
> +lines. It eschews the O framework so that the
stashref can be passed
> +directly to B::Concise::compile().
Does this matter?
Josh
|
|
| Re: improve B::Concise -src support |

|
2007-09-24 11:40:45 |
On 24/09/2007, Jim Cromie <jim.cromie gmail.com> wrote:
>
> this patch does:
>
>
> 1 - improves -src lookup by finding the
"_<$file" in %::
> This makes it work for relative paths, where it
previously
> used *only* the basename extracted from the COP
Thanks, applied.
|
|
| Re: improve B::Concise -src support |

|
2007-09-24 12:44:20 |
Joshua ben Jore wrote:
> On 9/23/07, Jim Cromie <jim.cromie gmail.com> wrote:
>
>> 2 - adds a 1-liner tip showing that
concise_stashref exists,
>> and how to use it. Changes for 1 also work here
with -src
>>
>> perl -MB::Concise -e
'B::Concise::compile("-exec","-src",
>> %B::Concise: ->()'
>>
>
> That's neat. What do you think of promoting that to an
import option
> so O.pm can still be there as normal:
>
> perl -MO=Concise,-exec,-src=B::Concise -e1
>
thanks.
-src is currently a flag option, taking no arguments, it
would be confusing
(at best) to make it do double duty.
But you may be on to something here:
-stash=Digest::MD5
could walk the stash, and optionally load the package too.
>
>> - open (my $fh, $file)
>> - or warn "# $file: $!, (chdirs not
supported by this feature yet)n"
>> + unless (-f $fullnm) {
>> + ($fullnm) = grep /$file$/, keys %:: ;
>> + $fullnm =~ s/^_<//;
>>
>
> If <_$file exists, shouldn't it be preferred over
the file system?
> They can be different.
Are you referring to {"_<$filename"}
thats doc'd in L<Debugger Support> (in Camel 3
anyway)
IIUC, theyre only defined under -d operation, so theyre not
generally
available.
Moreover - I cant find them - and cant decode the
crypto-rules for what
form of filename is used:
DB<3> x {"_<../ex-optrees.pl"}
empty array
DB<10> x {"_<ext/B/B/Concise.pm"}
empty array
DB<11> x {"_<B/Concise.pm"}
empty array
DB<12> x {"_<Concise.pm"}
empty array
I cant even find the src-arrays for the files in %INC
DB<13> x %INC
0 HASH(0x861f824)
'AutoLoader.pm' =>
'/usr/local/lib/perl5/5.10.0/AutoLoader.pm'
'B.pm' => 'ext/B/B.pm'
'B/Concise.pm' => 'ext/B/B/Concise.pm'
'Carp.pm' => '/usr/local/lib/perl5/5.10.0/Carp.pm'
'Carp/Heavy.pm' =>
'/usr/local/lib/perl5/5.10.0/Carp/Heavy.pm'
'Config.pm' =>
'/usr/local/lib/perl5/5.10.0/i686-linux-thread-multi/Config.
pm'
DB<14> x {"_</usr/local/lib/perl5/5.10.0/Carp.pm"
}
empty array
can you elaborate on the diff youre speaking of ?
Ive seen the basename (as extracted from the COP)
vs pathname difference (I'll rename $file -> $basenm in
next iteration)
> Also, my filenames almost always have the '.'
> regexp meta character. All the other ones are also
allowed. How about
> a quotemeta in there?
>
>
sounds reasonable. and probably a '/' too, to preclude bad
finds on
FooBar.pm when looking for Foo/Bar.pm
This still leaves a prob with Foo::Bar vs Milk::Bar, but I
dont see a way
around that, given only the basename from the COP.
Or is the package name readily available somewhere ?
>> + open (my $fh, $fullnm)
>>
>
> Again, '<' and other things special to open() are
allowed in my
> filename. This oughta be three-arg or with the piles of
"< $fullnm "
> stuff
>
>
yes it should. I'll do that.
>> +This renders all functions in the B::Concise
package with the source
>> +lines. It eschews the O framework so that the
stashref can be passed
>> +directly to B::Concise::compile().
>>
>
> Does this matter?
>
>
I think it does matter. The reason I called compile
directly was so that
I could pass the stash - the more expected usage yields the
rendering
of the 'wrapper' -
$ perl -MO=Concise -e '%::'
7 < > leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e:1) v:{ ->3
6 <1> refgen vK/1 ->7
- <1> ex-list lKRM ->6
3 <0> pushmark sRM ->4
5 <1> rv2hv[t2] lKRM/1 ->6
4 <#> gv[*main::] s ->5
-e syntax OK
The real problem is that -e1 doesnt do useful stuff here
[jimc harpo dev]$ perl -MO=Concise -e1
3 < > leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e:1) v ->3
- <0> ex-const v ->3
-e syntax OK
It may well mean re-jiggering sub compile bit, in
combination with -stash
> Josh
>
>
Ooh, I see RGS has applied this while I was typing.
I'll work up a new-new-improvement based upon your
suggestions.
thanks
jimc
|
|
| Re: improve B::Concise -src support |

|
2007-09-25 18:34:09 |
Rafael Garcia-Suarez wrote:
> On 24/09/2007, Jim Cromie <jim.cromie gmail.com> wrote:
>
>> this patch does:
>>
>>
>> 1 - improves -src lookup by finding the
"_<$file" in %::
>> This makes it work for relative paths, where it
previously
>> used *only* the basename extracted from the COP
>>
>
> Thanks, applied.
>
>
this followup does the following (motivated by Josh ben
Jore's feedback)
*- uses 3 arg open
*- adds -stash=<pkg>, suggested by Josh ben Jore
now loads pkg if needed, and renders the stash.
also works for inlined packages.
*- adds 7 tests for -stash and -src options
*- comments out the $^P |= 831;
I added this as part of -src feature, but did so while
hacking at it,
and forgot about it. It doesnt seem to do anything, so
doesnt belong.
*- fixes the basename nonsense
looking a dozen lines up from where fill_srclines was called
in concise_op
I realized that $loc had the full path, so I juggled things
around,
and dropped the pathname finding sludge from
fill_srclines()
*- added =item -stash=<somepkg> to pod
*- version bump
*- updated ext/B/t/optree_specials.t
Apparent large changes, affecting BEGIN tests,
due to 2 added 'no strict "refs"'
Passes all relevant tests on threaded/unthreaded
Failed 4 tests out of 1392, 99.71% okay.
../lib/Archive/Tar/t/02_methods.t due to my
lndir cloning
../lib/feature.t # With err, should
work ..
op/magic.t FAILED at test 26
(comes and goes)
../lib/Config.t
Failed at ../lib/Config.t line 268
# Failed at ../lib/Config.t line 268
# Failed at ../lib/Config.t line 268
# INC is:
# /usr/local/lib/perl5/5.10.0/i686-linux
# /usr/local/lib/perl5/5.10.0
# /usr/local/lib/perl5/site_perl/5.10.0/i686-linux
# /usr/local/lib/perl5/site_perl/5.10.0
# /usr/local/lib/perl5/site_perl/5.9.5
# /usr/local/lib/perl5/site_perl/5.8.8
# /usr/local/lib/perl5/site_perl/5.8.7
# /usr/local/lib/perl5/site_perl
# .
FAILED at test 136
|
|
|
| Re: improve B::Concise -src support |

|
2007-09-26 03:38:46 |
On 26/09/2007, Jim Cromie <jim.cromie gmail.com> wrote:
> this followup does the following (motivated by Josh ben
Jore's feedback)
Thanks, applied as #31973.
> Passes all relevant tests on threaded/unthreaded
>
> Failed 4 tests out of 1392, 99.71% okay.
> ../lib/Archive/Tar/t/02_methods.t due to
my lndir cloning
I use -Dmksymlinks, and that works for me...
> ../lib/feature.t # With err,
should work ..
You have probably a left-over file t/lib/feature/err. It has
been removed.
> op/magic.t FAILED at
test 26 (comes and goes)
> ../lib/Config.t
Weird. What does the magic.t test test ?
The Config failure might be caused by your lndir setup, is
that plausible ?
> Failed at ../lib/Config.t line 268
> # Failed at ../lib/Config.t line 268
> # Failed at ../lib/Config.t line 268
> # INC is:
> # /usr/local/lib/perl5/5.10.0/i686-linux
> # /usr/local/lib/perl5/5.10.0
> # /usr/local/lib/perl5/site_perl/5.10.0/i686-linux
> # /usr/local/lib/perl5/site_perl/5.10.0
> # /usr/local/lib/perl5/site_perl/5.9.5
> # /usr/local/lib/perl5/site_perl/5.8.8
> # /usr/local/lib/perl5/site_perl/5.8.7
> # /usr/local/lib/perl5/site_perl
> # .
> FAILED at test 136
>
|
|
| Re: improve B::Concise -src support |

|
2007-09-26 12:07:40 |
Rafael Garcia-Suarez wrote:
> On 26/09/2007, Jim Cromie <jim.cromie gmail.com> wrote:
>
>> this followup does the following (motivated by Josh
ben Jore's feedback)
>>
>
> Thanks, applied as #31973.
>
>
>> Passes all relevant tests on threaded/unthreaded
>>
>> Failed 4 tests out of 1392, 99.71% okay.
>> ../lib/Archive/Tar/t/02_methods.t due
to my lndir cloning
>>
>
> I use -Dmksymlinks, and that works for me...
>
old habits / scripts die hard.
I do use -Dmksymlinks when I anticipate config changes.
>
>> ../lib/feature.t # With
err, should work ..
>>
>
> You have probably a left-over file t/lib/feature/err.
It has been removed.
>
>
I do. I checked with the repo-browser after it was
discussed here,
suspecting it was removed, theres no indication - just 1
revision.
Is there a perforce log-entry thats filtered by code behind
the button ?
Actually, I just deleted them (lib/feature.*), and reran
rsync (to
perl-current)
they were re-fetched.
>> op/magic.t FAILED at
test 26 (comes and goes)
>> ../lib/Config.t
>>
>
> Weird. What does the magic.t test test ?
>
Everything that follows is weird - not entirely
explainable..
it used to fail a lot, now I mostly dont see it.
main::(t/op/magic.t:268): ok((($Is_MSWin32 ||
$Is_os2) ?
uc($_) eq uc($s1) : $_ eq $s1), " :$_:!=:$s1:");
tested against a straight clone
not ok 26
# Failed test at line 268
# :$^X is /mnt/extra/jimc/perl/core/bleadperl/perl, $0 is
/mnt/extra/jimc/perl/core/dev/copy/show-shebang
:!=:$^X is /mnt/extra/jimc/perl/core/dev/copy/perl, $0 is
/mnt/extra/jimc/perl/core/dev/copy/show-shebang
:
not ok 27
# Failed test at line 273
# :$^X is /mnt/extra/jimc/perl/core/bleadperl/perl, $0 is
/mnt/extra/jimc/perl/core/dev/copy/show-shebang
:!=:$^X is /mnt/extra/jimc/perl/core/dev/copy/perl, $0 is
/mnt/extra/jimc/perl/core/dev/copy/show-shebang
: after `/mnt/extra/jimc/perl/core/dev/copy/perl
/mnt/extra/jimc/perl/core/dev/copy/show-shebang`
ok 28
IE I get a new extra failure Ive never seen before.
Since the test involves shell redirects, it seems likely
that lndir of that file is involved.
> The Config failure might be caused by your lndir setup,
is that plausible ?
>
>
>> Failed at ../lib/Config.t line 268
>> # Failed at ../lib/Config.t line 268
>> # Failed at ../lib/Config.t line 268
>> # INC is:
>> # /usr/local/lib/perl5/5.10.0/i686-linux
>> # /usr/local/lib/perl5/5.10.0
>> # /usr/local/lib/perl5/site_perl/5.10.0/i686-linux
>> # /usr/local/lib/perl5/site_perl/5.10.0
>> # /usr/local/lib/perl5/site_perl/5.9.5
>> # /usr/local/lib/perl5/site_perl/5.8.8
>> # /usr/local/lib/perl5/site_perl/5.8.7
>> # /usr/local/lib/perl5/site_perl
>> # .
>> FAILED at test 136
>>
>>
>
>
this one is ODD, and not reproducible now (naturally :-/)
The failures dont dont issue a message from ok(), but
258 # This is the order that directories are pushed onto
INC
in perl.c:
259 foreach my $lib (qw(applibexp archlibexp privlibexp
sitearchexp
sitelibexp
260 vendorarchexp vendorlibexp
vendorlib_stem)) {
261 my $dir = $Config{$lib};
262 SKIP: {
263 skip "lib $lib not in INC on
Win32" if $^O eq 'MSWin32';
264 skip "lib $lib not defined" unless
defined $dir;
265 skip "lib $lib not set" unless length
$dir;
266 # So we expect to find it in INC
267
268 ok (exists $orig_inc{$dir}, "Expect $lib
'$dir' to be in INC")
269 or $failed++;
270 }
271 }
sorry for the noise -
In the future I'll not report junk like this until I can
reproduce w/o
lndir.
|
|
[1-7]
|
|