If
you have a question on how to do something in Perl, or
you need a Perl solution to an actual real-life problem, or
you're unsure why something you've tried just isn't working...
then this section is the place to ask.
However, you might consider asking in the chatterbox first (if you're a
registered user). The response time tends to be quicker, and if it turns
out that the problem/solutions are too much for the cb to handle, the
kind monks will be sure to direct you here.
...
my $mt = Mojo::Template->new( vars => 1, auto_escape => 1 );
my $data = ... # Not where the issues is.
my $code = "PERL";
print $q->header( -charset => 'utf-8' ), $mt->render_file( myfile.html
+.ep, { data => $data }, { test => $code } );
...
Hello All, I am getting the following error Crypt-Random-Source: 0.14 fails to install while installing OIDC::Lite. I am in Windows 10 platform
Please check below errors
t/sugar.t .............. 1/? Undef did not pass type constraint "Class
+Name" (in $self->{"weak_source"}) at (eval 121) line 17
"ClassName" is a subtype of "Str"
"Str" is a subtype of "Value"
"Value" is a subtype of "Defined"
Undef did not pass type constraint "Defined" (in $self->{"weak_sou
+rce"})
"Defined" is defined as: (defined($_))
# Tests were run but no plan was declared and done_testing() was not s
+een.
# Looks like your test exited with 255 just after 3.
t/sugar.t .............. Dubious, test returned 255 (wstat 65280, 0xff
+00)
All 3 subtests passed
Test Summary Report
-------------------
t/factory.t (Wstat: 65280 Tests: 1 Failed: 0)
Non-zero exit status: 255
Parse errors: No plan found in TAP output
t/sugar.t (Wstat: 65280 Tests: 3 Failed: 0)
Non-zero exit status: 255
Parse errors: No plan found in TAP output
Files=7, Tests=17, 4 wallclock secs ( 0.11 usr + 0.09 sys = 0.20 CP
+U)
Result: FAIL
Lockfile removed.
ETHER/Crypt-Random-Source-0.14.tar.gz
C:\Strawberry\perl\bin\perl.exe ./Build test -- NOT OK
//hint// to see the cpan-testers results for installing this module, t
+ry:
reports ETHER/Crypt-Random-Source-0.14.tar.gz
Stopping: 'install' failed for 'Crypt::Random::Source'.
Failed during this command:
ETHER/Crypt-Random-Source-0.14.tar.gz : make_test NO
I've got a script that uses named capture groups to parse file records. The
record format is always the same (four fields wide, colon separated), just like
a passwd file (except for the number of fields).
For example:
0:1:bob:Bob
1:1:bob:Bob
1:0:alice:Alice
You get the idea. At first I used to split it, but later I came to the
conclusion that using a regex with named groups could provide a more
understandable code. The (simplified) example below might help you get the
picture.
Now, I've noticed (according to
perlretut)
that named capture groups were introduced in Perl 5.10. I don't expect the
script to run in older versions, but would it be wise to use v5.10
pragma?
Would it have any unwanted side effects? I'm not using any of the
features of the
bundle, just wanted to state that version 5.10 is required. Is that a good
idea?
I am trying to use ExifTool to extract some Metadata TAGS. I've searched for a specific use case but was unsuccessful. Ive constructed some simple code to accomplish what I am trying to do, but I am looking for verification that I am doing it correctly to extract the necessary variables or is there a simpler way.
use Image::ExifTool qw(:Public);
use Data::Dumper;
$file='d:/60486581538__715F9238-09E5-4806-8146-0626DAFB0E36.JPG';
$ExifTool = new Image::ExifTool;
#$ExifTool->Options(DateFormat => '%Y-%m-%d');
$info = $ExifTool->ImageInfo($file,'SubSecCreateDate','LensModel');
#$info = $ExifTool->ImageInfo($file);
print "INFO: $info\n";
$createdate=$$info{'SubSecCreateDate'};
$lens=$$info{'LensModel'};
print "\nCreate Date: $createdate\n";
print "Lens Model: $lens\n\n";
print Dumper($info);
exit;
D:\>metadata.pl
INFO: HASH(0x2b9f148)
Create Date: 2020:03:02 13:16:55.336-05:00
Lens Model: iPhone 7 back camera 3.99mm f/1.8
$VAR1 = {
'LensModel' => 'iPhone 7 back camera 3.99mm f/1.8',
'SubSecCreateDate' => '2020:03:02 13:16:55.336-05:00'
};
D:\>
I have this line in my code and I am trying to see if there is a way to add more than one file match in this line, the files comes as "*.txt", "*.TXT", "*.png", "*.PNG".
It breaks if in this line the file extension is "*.TXT" instead of "*.txt".
If it is called as get_ids( 'format' => 'json' ); it works fine but asking it to return a text string returns undef and warns Useless use of string in void context at line 229. The way I think it should work is that if $result{'message'} evaluates as true, that will get returned but if it evaluates as false then "$result{'api-key'}:$result{'session'}" wil be returned instead.
Can you explain why this is not behaving as expected?
As an aside, in searching for an answer I found this post -> Useless use of string in void context
There it is suggested that Perl reports the wrong line number for this warning so it is quite possible that I'm actually looking in the wrong place!
I'm perplexed. Can you tell me what is wrong with this script?
#!/usr/bin/perl -w
use strict; use warnings; use diagnostics;
use File::Find;
open (my $t, '>', '/home/myuser/myfilename.sql') or die $!;
print $t "blah blah\n";
find( { preprocess => \&hi, wanted => \&work, postprocess => \&bye, fo
+llow_skip => 1 }, ".");
sub hi { print $t "hi\n"; return;} # works correctly
sub bye { print $t "bye\n"; return;} # works correctly
sub work { print "my name is: ", $File::Find::name;
print $t "I'm a file!";
return;}
close $t;
Searching CPAN I was rather surprised that the only general modules for connecting to LinkedIn seem to be WWW::LinkedIn and Net::Linkedin::OAuth2 - both of these date from before Microsoft acquired LinkedIn 5 years ago...unbelievable that it is that long ago!
Since the 5th April, Hootsuite have reduced the number of scheduled posts permitted on free accounts down to just 5 and we don't use the other features to warrant the paid price tag. We already have an automated Twitter scheduler and I want to add LinkedIn to it so just need something to authenticate, read the timestamp of the latest post and be able to create a post containing media.
Before I write something to do this, are there any modules available or should I try out the modules above despite their age?