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. Post a new question!
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.
In a perl script i am calling a ksh file to copy files. (ie.) inside ksh file i am running the below tar command to copy the files from source to destination.
My task is, Need to create a 'success.ok' file, if tar command got succeed, else create 'failure.ok'. The issue is, while running ksh file through perl script, by default i am getting the exist value as '0' for both failure and success scenario..
KIndly please suggest how to solve this.
(tar cvf - * | cd /var/tmp/dump; tar xcf - ); output=\$\?; if \$output -eq 0; then touch /var/tmp/dump/success.ok; );
I'm observing an odd interaction of my module with MD5::Digest that I haven't been able to figure out.
I'm implementing a read/write interface to a gzip variant using tied filehandles, with full seek/read/readline/tell support. I'm in the testing phase and nearly all of the tests I'm throwing at it seem to be working (basically performing exactly the same combinations of seek, read, <>, etc, on both my tied filehandle object (with the compressed file loaded) and a regular Perl filehandle opened on the uncompressed version, and comparing the output).
The one exception at this point is when I try to provide my tied filehandle to MD5::Digest's addfile() method. This doesn't work:
my $fh = B2B::BGZF::Reader->new_filehandle( $fn_bgzf );
my $hex = Digest::MD5->new()->addfile($fh)->hexdigest;
print $hex, "\n"; # prints d41d8cd98f00b204e9800998ecf8427e
The test returns almost immediately and it appears the hash returned is that of an empty string, so clearly the file is not actually being read. However, this works as expected:
my $fh = B2B::BGZF::Reader->new_filehandle( $fn_bgzf );
my $d = Digest::MD5->new();
my $buf = '';
$d->add($buf) while ( read $fh, $buf, 4096 );
my $hex = $d->hexdigest;
print $hex, "\n"; # prints the expected sum
Basically, I have only been able to observe the issue when using my module with the XS implementation of Digest::MD5. Debugging is difficult because I'm not sure what code is actually being called (apparently not the addfile() method of Digest::base or any other actual perl code I can find on my system). I have no problem just using the explicit read()/add() form with Digest::MD5, but if this is an indication of a subtle bug in my code I'd like to work it out - I'm just not sure how to do so.
Any help with understanding what Digest::MD5::addfile() is actually calling under the hood or what might be going on here would be greatly appreciated.
How can I get a match counter and use it as a prefix in the peplace term. For example, I have several times "position" in my text and want to peplace it with "position 1", "position 2" and so on. Many thanks in advance!
I'm running on SLES12, with apache 2.4.10 and mod_perl 2.0.8
In a vhost config file, I have a "PerlFixupHandler MyHandler" directive. Myhandler.pm is in /etc/apache2/script
If I do a perl -e'use MyHandler' from the commandline, everything works fine. But when it gets used from the server, it fails and is logging this in the error_log:
[Fri Aug 28 18:15:43.053198 2015] [perl:error] [pid 22133] [client x.x
+.x.x:x] failed to resolve handler `MyHandler': Can't locate Digest/SH
+A.pm: Permission denied at /etc/apache2/script/MyHandler.pm line 7.
+\nBEGIN failed--compilation aborted at /etc/apache2/script/MyHandler.
+pm line 7.\nCompilation failed in require at (eval 5) line 2.\n, refe
If I comment out the reference to Digest::SHA, it just fails on the next module.
For debugging, I added a BEGIN block to dump INC and to try and read the SHA.pm file, and that does not appear to cause any errors.
This configuration used to work fine on apache 2.2 ; I did some minimal updates to the configuration files for the new authentication stuff in 2.4, but nothing related to perl.
Any idea on what's wrong and how to fix it?
Edit: Here's the start of the .pm in question:
use Apache2::Const qw(:common);
use Digest::SHA qw(sha256_hex sha1_hex);
use Apache2::URI ();
use APR::Pool ();
Can I pass a given month to Time::Piece and get its last day?
use Time::Seconds qw(ONE_DAY ONE_WEEK ONE_MONTH ONE_YEAR);
# Create Time::Piece New Object for the dates
my $t = Time::Piece->new();
my $year = $t->year;
# Pass November, but it can be any month
my $month = "11";
my $last_day_month = $t->month_last_day($month); #??
print $last_day_month." days\n";
Hello , What I would like to do, is create a "duplicate" perl instance from the OS installed system perl . This would be 5.8.8. This is in relation to an early post I had made (#1135687). My perl users have been using the OS install and I now want to move them off of it to their own.
So that my OS upgrades do not effect their current perl. I can easily copy/create a new directory structure for them ( /usr/opt/perl5/* -> /segregated). But not sure how best to alter the @INC declaration or any other pieces that may need pointed to this area. In looking at perlbrew, I'm not quite sure if this will do it (not installing different, but replicated). Nor do I know/think autobundle is what I need , or if autobundle is overkill. I know that future module adds would require me to add Prefix= to the "perl Makefile.PL " step.Would appreciate any wisdom/suggestions you may have on this. Thanks very much in advance.
I inspected the $som object, and looked at some of the stuff in the code, and I think I can see where there might be an error, (and it is not with my credentials) but I am hesitant to start debugging all of this, when the point is to have a package that just works.
So, the question is: Is there an easy way to access an exchange server, via the web, with a perl program. What would be the best package?
Making a bit of progress... but can't seem to find the right credentials to log in.
Have established that the server is NOT https://exchange.domain.com/owa
as that is for the web-client not the soap client.
Am able to login (via a browser) to https:://exchange.domain.com/EWS/Services.wsdl with my standard username password, but does not work when I am using this from a perl script.