Comments (6)
Devel::REPL gets this right. I think we may need to restore the usage of Devel::LexAlias, or something along those lines - I think this is related to why modifications to lexicals in Carp::Reply don't persist either.
from reply.
Devel::REPL has strange behavior with block scope:
~$ re.pl
$ my $v = 0;
0
$ do { my $v = 3 }
3
$ $v
3
from reply.
Reply does the same thing in this situation, and that is because of a separate issue. PadWalker doesn't give us enough of an API to differentiate between variables declared at the top level of a block and variables declared deeper inside the block. Fixing that one is going to be a lot harder.
from reply.
From the PadWalker documentation:
If the sub defines several "my" variables with the same name, you'll get the
last one. I don't know of any use for "peek_sub" that isn't broken as a result
of this, and it will probably be deprecated in a future version in favour of
some alternative interface.
from reply.
I was struggling with this behavior while making perl+emacs live coding environment - as result i came to somewhat cumbersome solution which uses PadWalker's peek_my and Package::Stash - https://github.com/vividsnow/perl-live/blob/master/perl-live.pl. Perhaps that could be a plugin/mode for Reply with same behavior.
from reply.
Fixed in 0.24.
from reply.
Related Issues (20)
- History hasn't been wrote out when received Ctrl+C
- wishlist: #vars (or similar) to show current variables HOT 2
- Reply::Plugin::ReadLine broken for PERL_RL=perl (a.k.a. Term::ReadLine::Perl) HOT 1
- accessing lexical variables from inside a named sub
- reply doesn't work on 5.22 on my system HOT 4
- unexpected output from map HOT 2
- plugin to page long results HOT 1
- ReadLine's history_file should expand '~' to $ENV{HOME} HOT 2
- ReadLine plugin can't handle quoted paths, but the pod implies it can HOT 1
- Multiline support HOT 1
- Bare heredoc HOT 1
- Term::ReadKey is a recommends, not a requires but tests fail without HOT 1
- Want to contribute my code to reply HOT 2
- Useless dependency on Devel::LexAlias
- Warn, don't die, on bad/missing plugins or missing optional dependencies
- cannot use feature 'say'
- Negative zero is misprinted as zero
- How about use perl not dosini as the config language HOT 1
- When it receives ctrl-C, reply will quit
- [feature] Shell completion
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reply.