submitted by /u/briandfoy [link] [comments] |
- YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.www.youtube.com
This is not Perl specific, but in our new era of this Perl economy everyone should be thinking about side-hustles and income streams. Perl is perfect for creating SaaS and other services because for efficient practitioners it presents the most efficient way to prototype a lot of things via the web.
For example, shared hosting is dirt cheap and supports cgi-bin; VMs on the cloud are also dirt cheap and you probably don't need more than a $5 instance to POC something that will be good enough to test interest. Knowing more about pricing models is part of that. This is an interesting article about SaaS pricing models, and know more about that is certainly part of creating paid services. Enjoy.
https://garrettdimon.com/journal/posts/data-modeling-saas-entitlements-and-pricing
* sorry the code examples in here are Python, but I think for this purpose we can look past that
submitted by /u/OODLER577
[link] [comments]
Hi all! This is my first Perl script.
#!/usr/bin/perl use strict; use warnings; use Curses::UI; use Data::Dumper; use JSON; # Create the root Curses::UI object my $cui = Curses::UI->new(-color_support => 1); # Set up a signal handler to exit on Ctrl+C $cui->set_binding(sub { exit(0); }, "\cC"); # Create the main window my $win = $cui->add('window_id', 'Window'); # URL to fetch email address my $response = "https://www.1secmail.com/api/v1/?action=genRandomMailbox&count=1"; # Variable my $email_address = ''; my $username = ''; my $domain = ''; my $formatted_email = ''; my $formatted_json = ''; my $formatted_inbox = ''; my $Id = ''; my $box = ''; # my $filename = '/home/ola/Work/Languages/Perl/curses-ui/1/TempMail-Curses-UI/file.txt'; # Calculate the center Y position based on the window height my $window_height = $win->height(); my $center_y = int(($window_height - 1) / 2); # Create $win->add( 'buttonbox_id', 'Buttonbox', -y => $center_y, -buttons => [ { -label => '< Get Random Email >', -onpress => sub { $email_address = `curl -sL $response`; chomp($email_address); $email_address =~ s/^\["(.*)"\]$/$1/; print $email_address; # Split the email into username and domain my ($username, $domain) = split('@', $email_address); chomp($domain); print "Username is: $username\n"; print "Domain is: $domain\n"; # Copy system("echo $email_address | xsel --clipboard --input"); # Write to file open(FH, '>', $filename) or die $!; print FH $email_address; close(FH); # print "Writing to file successfully!\n"; # Send test mail # system("perl SendMailTest.pl"); # Display the output in a dialog $cui->dialog( -message => "Random Email:\n$email_address\n Copied To Clipboard", -title => "Email Address", -buttons => [ { -label => '< OK >', -value => 1, -shortcut => 'o', } ], ); } }, { -label => '< Update Inbox >', -onpress => sub { # my $command_output = `curl -sL "https://www.1secmail.com/api/v1/?action=getMessages&login=2gqhd4oz4wb&domain=laafd.com"`; my $command_output = `curl -sL "https://www.1secmail.com/api/v1/?action=getMessages&login=$username&domain=$domain"`; chomp($command_output); $formatted_json = decode_json($command_output); $Id = $formatted_json->[0]->{id}; # Display the output in a dialog box $cui->dialog( -message => $formatted_json->[0]->{subject}, -title => "$Id = $formatted_json->[0]->{id}", -buttons => [ { -label => '< Fetch Mail Body >', -value => 1, -shortcut => 'o', } ], ); $Id = $formatted_json->[0]->{id}, # my $inbox = `curl -sL "https://www.1secmail.com/api/v1/?action=readMessage&login=2gqhd4oz4wb&domain=laafd.com&id=$Id"`; my $inbox = `curl -sL "https://www.1secmail.com/api/v1/?action=readMessage&login=$username&domain=$domain&id=$Id"`; chomp($inbox); my $formatted_inbox = decode_json($inbox); my $box = $formatted_inbox->{textBody}; # print Dumper($formatted_inbox); print $box; $cui->dialog( -message => $box, -title => "$Id = $formatted_json->[0]->{subject}", -buttons => [ { -label => '< OK >', -value => 1, -shortcut => 'o', } ], ) } }, ], -buttonalignment => 'middle', ); $cui->mainloop;
This is a script to fetch a temp mail address from the API, then display the contents of its inbox.
Problem
Everything was working fine, but suddenly I'm getting an error about screen size. I am literally clueless at this point.
Error:
Your screen is currently too small for this application.
Resize the screen and restart the application.
Press <CTRL+C> to exit...
Info
Terminal has 45 lines and 189 coloumns, and is full screen.
This is perl 5, version 38, subversion 2 (v5.38.2) built for x86_64-linux-thread-multi
Curses::UI Version: INST_VERSION 0.9609
OS is Arch Linux
submitted by /u/GapIndividual1244
[link] [comments]
submitted by /u/briandfoy [link] [comments] |
- YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.www.youtube.com
submitted by /u/leejo [link] [comments] |
London Perl & Raku Workshop, 2024
London Perl & Raku Workshop. Perl & Raku Conference and training in London.act.yapc.eu
submitted by /u/oalders [link] [comments] |
Fixing a fifteen-year-old curve fit bug
The backwards compatibility of Perl software is wonderful. That’s why it’s all the more jarring when you find a package that doesn’t work. This is the story of a 15-year-old bug that I managed to track down and, fortunately, resolve.Paul Cochrane (P.T.C.)
submitted by /u/briandfoy [link] [comments] |
Signature named params by leonerd · Pull Request #54 · Perl/PPCs
Another PPC doc to add to the growing pile ;) As is traditional for me I didn't fill in the "Rationale" section as I still have no idea how that differs from a "Motivation"....GitHub
Hello friends,
Over the last 7 or so months I have worked with a very small team to build a performance monitor for the modern Perl web-application ecosystem. As of today, the project is now available to everyone via the free-tier only, later however, (a month or so) we will be opening up our priced tiers to business users who will most likely need more from the application.
Please feel free to check it out, and I look forward to hearing feedback!
https://slapbirdapm.com/r/perl/.rss
https://github.com/mollusc-labs/slapbird
submitted by /u/ivan_linux
[link] [comments]
GitHub - mollusc-labs/slapbird: Slapbird 🐦: An APM (Application Performance Monitor) for Perl 5 web-applications
Slapbird 🐦: An APM (Application Performance Monitor) for Perl 5 web-applications - mollusc-labs/slapbirdGitHub
submitted by /u/briandfoy [link] [comments] |
Perl Weekly #682 - Perl and CPAN
Originally published at Perl Weekly 682 Hi there, Please tell me how many of you remember the CPAN...Gabor Szabo (DEV Community)
submitted by /u/briandfoy [link] [comments] |
- YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.www.youtube.com
From a discussion on Hacker News:
One particulary mnemonic collection of switches is-plane
:perl -plane 'my $script'
.-n
and-p
are mutually exclusive, but as-p
overrides-n
, it is easier to just remove-p
if necessary.
Few other users in another discussion there mentioned -E
-n
-l
-p
options especially useful.
Is there anything really cool about -plane
or -Enlp
? Are they really somewhat a "Holy Grail" of running Perl scripts from the command line, and why?
submitted by /u/Impressive-West-5839
[link] [comments]
I thought I had seen somethink about this, but does Perl reserve a block of memory upon startup for user variables? Or are user variables always allocated when they are created/initialized with Newx, Newxz ?
From some benchmarks it seems that Perl does set some memory aside to avoid requesting memory from the OS all the time, and I thought I had seen some material about how to modify this "scratch space" but I could be very wrong or senile.
submitted by /u/ReplacementSlight413
[link] [comments]
I have noticed the Perl Cookbook, 2nd Edition as an outstanding reference. How about the work Perl by Example, Fifth Edition? How does it compare? Would you recommend it as a reference as well?
submitted by /u/fosres
[link] [comments]
Hi Everyone.
I am learning from the book "Learning Perl" and so far the journey is thankfully going great!
One thing noticed about Perl is that although the developer community here is smaller than other mainstream languages it feels very tight-knit. Is that just me or were you also drawn to Perl because of the strong community responsiveness to each other?
submitted by /u/fosres
[link] [comments]
[link] [comments]
(dix) 9 great CPAN modules released last week
Updates for great CPAN modules released last week. A module is considered great if its favorites count is greater or equal than 12. App...niceperl.blogspot.com
UUID::Tiny has a weird way of getting a random 32bit integer using 2x random 16 bit integers bitwise OR'd together:
sub _rand_32bit { _init_globals(); my $v1 = int(rand(65536)) % 65536; my $v2 = int(rand(65536)) % 65536; return ($v1 << 16) | $v2; }
Anyone know why you would do this instead of just: my $rand = int(rand(2**32));
? Also why the modulus, isn't it redundant?
submitted by /u/scottchiefbaker
[link] [comments]
I forgot it was CPAN Day, but it still is CPAN Day in parts of the world so maybe you can get some CPAN housecleaning in. I use this day to delete old versions of my distributions from CPAN.
submitted by /u/briandfoy
[link] [comments]
submitted by /u/briandfoy [link] [comments] |
- YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.www.youtube.com
I found a script from 2008 year, that renames files to random filenames:
```
!/usr/bin/perl
randomize the filenames for the photo frame
https://www.bulkrenameutility.co.uk/forum/viewtopic.php?t=114
$dir = $ARGV[0] || die "directory?\n"; chdir($dir) || die "chdir";
opendir(D, ".") || die "opendir"; @files = grep {/jpg/} readdir(D); closedir(D);
array shuffle from perl FAQ
srand; @newfiles = (); for (@files) { my $r = rand @newfiles + 1; push(@newfiles,$newfiles[$r]); $newfiles[$r] = $_; }
if ($#files != $#newfiles) { die "$#files != $#newfiles\n"; }
while ($old = pop @files) { $new = pop @newfiles; $new =~ s/p/r/; ! -f $new || die "won't overwrite $new - check the regexp\n"; print "$old -> $new\n"; rename $old, $new || warn "rename $old -> $new: $!\n"; } ```
If I run it as perl foo.pl ./
, there is won't overwrite bar.jpg - check the regexp
error. And if I run it as perl fo.pl ./bar.jpg
, there is chdir at foo.pl line 7
error. How to make it work?
I have Perl 5.34.1 installed.
submitted by /u/Impressive-West-5839
[link] [comments]
Abe Timmerman ABELTJE has passed away yesterday after a long fight with cancer.
A long time participant in what are now called Perl Toolchain Summits, he was co-responsible for setting up the Perl smoking infrastructure.
And was always a welcome guest at almost all YAPC::EU conferences, as well as many Dutch and Belgian Perl Workshops, and NLPM (Dutch PerlMongers) meetings.
He will be missed. R.I.P.
submitted by /u/liztormato
[link] [comments]
[link] [comments]
The Day Perl Stood Still: Unveiling A Hidden Power Over C
Sometimes the unexpected happens and must be shared with the world … this one is such a case.Killing-It-with-PERL
As a security engineer I am obsessed with building computer systems that are reliable and fault-tolerant. I was researching Erlang and Elixir to build servers that are designed that way. But others here mentioned Perl is used in production ready projects where availability of the system is key -- such as Amazon.
What are the pros and cons in using Perl to deploy production ready servers vs Erlang, Elixir, Golang, C++ and other common back end languages / frameworks?
submitted by /u/fosres
[link] [comments]
Aside from the Perl project itself what were the Perl projects published that had a positive impact in the world--whether in the tech industry or even for hackers and hobbyists. I ask to better understand what Perl is and is not useful for.
submitted by /u/fosres
[link] [comments]
So I came across a book named "Higher-Order Perl" which teaches how to apply functional coding concepts to complete tasks in Perl. Have you used the book's techniques in your production-deployed projects? If so how did the book's advice help?
submitted by /u/fosres
[link] [comments]
Hi everyone. I am still researching how to benefit from Perl as a security engineer. I heard you can use Perl to test for security exploits in codebases? What have you used Perl for in he past? What did you find of most helpful for in your coding journey?
submitted by /u/fosres
[link] [comments]
[aside] This is not a cross-post. Few days ago I asked the same thing on Stack Overflow, and there were several answers, but none of them works really perfect.)
I have a folder with the following files there:
1.mp3 1.mp3.mp4 1.mp4.mp3 1.txt 2.mp3 2.mp3.mp4 2.mp4.mp3 2.txt foo.mp3 foo.mp3.mp4 foo.mp4.mp3 foo.txt foo1.mp3 foo1.mp3.mp4 foo1.mp4.mp3 foo1.txt foo2.mp3 foo2.mp3.mp4 foo2.mp4.mp3 foo2.txt
Filenames like foo.mp4.mp3
mean that originally the file was MP4 and later converted to MP3.
I need to batch rename MP3 files there, so that their numbers will be padded with leading zeros, that is, 1.mp3
should be renamed 0001.mp3
, 1.mp4.mp3
to 0001.mp4.mp3
, foo1.mp3
to foo001.mp3
, and so on.
Here are several attempts by other people:
rename -n 's/(\d+)/sprintf "%03d", $1/e' *.mp3
rename -n 's/(\d+)\.mp3/sprintf "%03d.mp3", $1/e' *.mp3
rename -n 's/(\d+)(\.mp3)/sprintf("%03d", $1) . $2/e or s/(\d+)(\.mp3)/sprintf "%03d%s", $1, $2/e' *.mp3
rename -n 's/(\d+)(\.mp3)/sprintf "%03d%s", $1, $2/e' *.mp3
rename -n 's/(\d+)(?=\.mp3)/sprintf "%03d", $1/e' *.mp3
- and my own, doesn't work either:
rename -n 's/(\d)(\.[^.]+)/sprintf "%03d%s", $1, $2/e' *
Maybe there is a Perl wizard here who could help me?
submitted by /u/Impressive-West-5839
[link] [comments]
Hello Perl Community. I was trying to build a secure string library in C resistant to buffer overflow vulnerabilities when I realized parsing inputs matters. Perl is well known for string rendering. What books would you recoendnd to a proficient C coder that is trying to learn Perl to master the art of parsing and editing strings to avoid common security exploits?
submitted by /u/fosres
[link] [comments]
submitted by /u/oalders [link] [comments] |
Deploying Dancer Apps (Addendum)
Some more thoughts about deploying Dancer apps as persistent daemonsPerl.com
submitted by /u/briandfoy [link] [comments] |
- YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.www.youtube.com
#!/usr/local/bin/perl use v5.40; use Syntax::Operator::Matches qw( matches mismatches ); use Type::Tiny; my $x = "123"; my $y; my $z = 'abc'; if ( $x matches $z ) { say "1"; } else { say "2"; }
Coded runs and compiles fine.
perltidy error
MacBook Pro 2021:lt administrator$ perltidy matches.pl matches.pl: Begin Error Output Stream matches.pl: matches.pl: 9: if ( $x matches $z ) { matches.pl: -- ^ matches.pl: found bareword where operator expected (previous token underlined)
.perltidyrc
# PBP .perltidyrc file # Uncomment #-st to fully emulate perltidy -pbp -l=278 # Max line width is 78 cols -i=4 # Indent level is 4 cols -ci=4 # Continuation indent is 4 cols #-st # Output to STDOUT -b # Write the file inline and create a .bak file -se # Errors to STDERR -vt=2 # Maximal vertical tightness -cti=0 # No extra indentation for closing brackets -pt=1 # Medium parenthesis tightness -bt=1 # Medium brace tightness -sbt=1 # Medium square bracket tightness -bbt=1 # Medium block brace tightness -nsfs # No space before semicolons -nolq # Don't outdent long quoted strings #-icb # Break before all operators -wbb="% + - * / x != == >= <= =~ !~ < > | & = **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x= matches"
spent an hour on this without luck; is there anyway to make perltidy aware of the imported matches operator?
submitted by /u/kosaromepr
[link] [comments]
Is there a way to make a readonly blessed reference that detect attempts to modify it at compile time of the script? Package Readonly , Package Const::Fast and Readonly::Tiny die at runtime
submitted by /u/ReplacementSlight413
[link] [comments]
Hi,
I have been programming in perl for the last 25 years but things have dried up with my long term set of clients recently. I see a lot of posts on here about how there is a huge amount of perl code out there and a need for experienced perl developers ... but I am struggling to find it. I used to go to jobs.perl.org but there hasn't been much there for ages. Upwork seems to have minimal perl projects, so I am a bit stumped. I was on LinkedIn for ages but it became too much of a spammer's paradise.
I'd really appreciate some tips on how to re-expand my client base in 2024!
Rob
submitted by /u/GeneralIsopod6298
[link] [comments]
This works and returns several files: ``` my $image_name = quotemeta('Screenshot-2024-02-23-at-1.05.14'); my $files = $wac->get_all_files_in_dir($dir . '/uploads', qr/$image_name.*\.png$/); ``` This returns no files: Note the space in the file name before AM. This also returns no files: I tried with and without quotemeta and with and without /Q /E to no avail. Is it possible the space is some kind of invisible UTF8 character? This is driving me nuts. **UPDATE:** I jumped on regex101.com and copied and pasted in the file name from the terminal and indeed there appears to be some kind of hidden character that is not whitespace: Did a hex dump of the string: 00000000 53 63 72 65 65 6E 73 68 - 6F 74 2D 32 30 32 34 2D Screenshot-2024- 00000010 30 32 2D 32 33 2D 61 74 - 2D 31 2E 30 35 2E 31 34 02-23-at-1.05.14 00000020 E2 80 AF 41 4D 2D 31 30 - 32 34 78 36 39 38 2E 70 ...AM-1024x698.p 00000030 6E 67 0A ng. submitted by /u/anki_steve |
submitted by /u/briandfoy [link] [comments] |
Perl Weekly #680 - Advent Calendar
Originally published at Perl Weekly 680 Hi there, I know we still have 4 months before the Advent...Gabor Szabo (DEV Community)
submitted by /u/briandfoy [link] [comments] |
Which way would you like to refresh the advisory data for CPAN::Audit? · briandfoy cpan-audit · Discussion #61
At the moment, CPAN::Audit updates the data it uses by releasing a new version of itself. Even if the code has not changed, the versions of the module and tools change. That gives the appearance of...GitHub
[link] [comments]
Perl and Raku Conference 2024 Sessions Now Available Online
Programming book reviews, programming tutorials,programming news, C#, Ruby, Python,C, C++, PHP, Visual Basic, Computer book reviews, computer history, programming history, joomla, theory, spreadsheets and more.www.i-programmer.info
submitted by /u/briandfoy [link] [comments] |
- YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.www.youtube.com
I try to use Perl's rename
utility to translate filenames to lower case. I tried two different solutions, one from perldoc rename
and another from Perl Cookbook:
rename 'y/A-Z/a-z/' ./*
rename 'tr/A-Z/a-z/ unless /^Make/' *.txt
But either version gives me an error because of complaining that file with such a filename already exists:
./fOoBaR.tXt not renamed: ./foobar.txt already exists
How to make it work?
submitted by /u/Impressive-West-5839
[link] [comments]
While refactoring some code with the usual desire to improve/simplify, I came by this interesting example on S.O. that uses the dispatch table structure:
ref _ https://stackoverflow.com/questions/844616/obtain-a-switch-case-behaviour-in-perl-5
my $switch = { 'case1' => sub { print "case1"; }, 'case2' => sub { print "case2"; }, 'default' => sub { print "unrecognized"; } }; $switch->{$case} ? $switch->{$case}->() : $switch->{'default'}->(); #($switch->{$case} || $switch->{default})->() # ephemient's alternative
Dispatch tables are powerful and I use them often.
Gabor Szabo offered a post with an example of given/when, but in the end he suggests just using the if/else construct.
given ($num) { when ($_ > 0.7) { say "$_ is larger than 0.7"; } when ($_ > 0.4) { say "$_ is larger than 0.4"; } default { say "$_ is something else"; } }
ref _ https://perlmaven.com/switch-case-statement-in-perl5
= = =
Which approach do you prefer? Or do you prefer some other solution? Saying no to all the above is a viable response too.
submitted by /u/singe
[link] [comments]
Obtain a switch/case behaviour in Perl 5
Is there a neat way of making a case or switch statement in Perl 5?. It seems to me they should include a switch on version 6. I need this control structure in a script, and I've heard you can impo...Stack Overflow
perl -CADS -le 'print $ARGV[0]' -- -v=αβγ -v=αβγ perl -CADS -sle 'print $v' -- -v=αβγ αβγ
submitted by /u/appomsk
[link] [comments]
[link] [comments]
(dviii) 11 great CPAN modules released last week
Updates for great CPAN modules released last week. A module is considered great if its favorites count is greater or equal than 12. App...niceperl.blogspot.com
Are there new modern alternatives to PerlNET? I am using a Perl game automation library whose ui is built with Wx using Perl bindings. I want to create my own UI using C#(WPF) so wanted to kno if there are existing solutions to this?
submitted by /u/vizim
[link] [comments]