Hello. I have the following program.
#!/usr/bin/perl sub print_user_input { my $input = <STDIN>; print $input; } sub mock_user_input { local *STDIN; open STDIN, '<', \"this is fake user input\n"; print_user_input(); } mock_user_input(); __END__ $ perl ./scratch.pl this is fake user input
I have successfully used the pattern displayed in the
mock_user_input
subroutine to test some user interfacing code I have. However I cannot wrap my head around how this actually works. What exactly does *STDIN
mean and why does it need to be localized? Why are we passing a string reference as the third argument to open
here? A detailed explanation of this code would be helpful for me. Thanks in advance. submitted by /u/nicholas_hubbard
[link] [comments]
Guys, Perl is famous for backwards compatibility. What is the oldest bit of perl use that is still relevant that you have heard of?
submitted by /u/saiftynet
[link] [comments]
I would like to know whether function which takes complex data structure of N depth, performs ANY changes on it. Should I Dumper() before and after, use tied hashes/arrays, or some other clever technique?
submitted by /u/mpapec2010
[link] [comments]
My client would like the package files in their project encrypted to protect the source code.
I have spent at this stage around 50 hours trying various cpan modules and its just not working, i also tried compiling an exe which also just fails.
Project is running apache2.2/perl5.10/mod_perl 2.0.4 and the majority of cpan modules fail to install for some or other reason
Please help me, are any alternatives to these methods, the documentation and online resources are slim.
The project runs on a local windows environment so the files are easily accesible.
The project is also a big mess so dependencies and libraries are a bit hard to pin down.
submitted by /u/Mowntain-Goat8414
[link] [comments]
Is there a common way or best practice, for creating a HTML "checkbox" form field and marking it checked?
This is what I started using:
print qq{ <input type="checkbox" name="fieldName" value="1" @{ ($fieldValues{fieldName}) ? 'checked="checked"' : '' } /> };
submitted by /u/ComparisonExtension3
[link] [comments]
How does the following work, specifically the triple equal sign print "hello" =~ y===c # -> 4
submitted by /u/Both_Confidence_4147
[link] [comments]
Hey friends, a few weeks back we introduced SlapbirdAPM (an open-source Perl application performance monitor), and received some great feedback from the community! Today we'd like to announce that you are now able to track DBI queries in your applications (only available for Dancer2 and Mojolicious for now), regardless of your database, ORM, etc. Here's what it looks like! You can see the dancer2 code that generated these queries here. preview.redd.it/l2jvz1bne8nd1.… This is just one of the many monitoring features provided by SlapbirdAPM, hopefully you find them as useful as we do! And a reminder we have a *forever* free tier available for everyone! submitted by /u/ivan_linux |
Since the language formerly known as Perl 6 has officially gone off on its own, has there been any effort to implement a true Perl 5 successor?
In my opinion, Raku tried to do too much with the syntax itself, scaled Perl's flexibility to infinity, and made itself unusable.
Perl 5 does not need much for it to become a "modern" language. Instead of extending the flexibility of the syntax, the direction for Perl 6 should emphasize standardizing core utilities to facilitate integration with modern workflows.
- Package/module management and import/export could benefit from streamlining
- Stronger LSP and debug/error tooling (Rust has spoiled me)
- "Prettier" auto-formatting for source code (For those 30yo system scripts, you know the ones I mean)
What would be on your wishlist?
submitted by /u/J_Stach
[link] [comments]
Mo utilities for email.
Changes for 0.02 - 2024-04-26T23:02:53+02:00
- Add tests for error parameters.
- Rewrite the tests so that the functional tests are first and then the errors.