Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

DateTime throwing an error

by nachtmsk (Acolyte)
on Apr 16, 2021 at 00:16 UTC ( [id://11131352]=perlquestion: print w/replies, xml ) Need Help??

nachtmsk has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I have a script in cron that I haven't changed in months. I use the DateTime module in the script. This afternoon, the script stopping running properly. I ran the script manually and received the error below.

Unrecognized character \x0E; marked by <-- HERE after warnings;<-- HE +RE near column 14 at /usr/local/share/perl/5.28.1/Role/Tiny/With.pm l +ine 4. Compilation failed in require at /usr/local/share/perl/5.28.1/Specio/C +oercion.pm line 10. BEGIN failed--compilation aborted at /usr/local/share/perl/5.28.1/Spec +io/Coercion.pm line 10. Compilation failed in require at /usr/local/share/perl/5.28.1/Specio/D +eclare.pm line 11. BEGIN failed--compilation aborted at /usr/local/share/perl/5.28.1/Spec +io/Declare.pm line 11. Compilation failed in require at /usr/local/lib/arm-linux-gnueabihf/pe +rl/5.28.1/DateTime/Types.pm line 12. BEGIN failed--compilation aborted at /usr/local/lib/arm-linux-gnueabih +f/perl/5.28.1/DateTime/Types.pm line 12. Compilation failed in require at /usr/local/lib/arm-linux-gnueabihf/pe +rl/5.28.1/DateTime/Duration.pm line 12. BEGIN failed--compilation aborted at /usr/local/lib/arm-linux-gnueabih +f/perl/5.28.1/DateTime/Duration.pm line 12. Compilation failed in require at /usr/local/lib/arm-linux-gnueabihf/pe +rl/5.28.1/DateTime.pm line 14. BEGIN failed--compilation aborted at /usr/local/lib/arm-linux-gnueabih +f/perl/5.28.1/DateTime.pm line 14. Compilation failed in require at processcamerathree.pl line 8.

I thought possibly something because corrupt so I tried to reinstall DateTime using cpan.
When I do that I get a lot of the same error as above.

Any suggestions on how to proceed?

Thanks!
Mike

Replies are listed 'Best First'.
Re: DateTime throwing an error
by talexb (Chancellor) on Apr 16, 2021 at 02:46 UTC

    Whenever I heard 'x stopped working', my first reaction is, 'OK -- what changed?'

    Typically, software works one way only. When you change something, a different result is possible. Therefore, you must have changed something (or you're on a shared host, and someone installed, removed or changed one of the modules).

    All we know so far is that when you run your script you get some sort of a compile error. Where?

    Compilation failed in require at processcamerathree.pl line 8.
    Oh. OK, so what's on line 8? You haven't shown us. That early in the file, it might be a module's use statement. If that were the case, I'd try to just compile the module from that line, and see if that works.

    Let us know what happens!

    Alex / talexb / Toronto

    Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

      Hi Alex,

      Thanks for the reply. Your right, something had to have changed. But it wasn't the script. After I made the post I looked at the errors more carefully; in particular the error with the most information.

      Unrecognized character \x0E; marked by <-- HERE after warnings;<-- HERE near column 14 at /usr/local/share/perl/5.28.1/Role/Tiny/With.pm line 4.

      I opened file at the end of that path "With.pm". Then I looked at line 4. Sure enough there was some odd control character there. In fact there were odd control characters peppered through the file. But the strange this is the timestamp on the file was from 2019. So it was the original timestamp of the installed file (my script was made in 2021). Fortunately, I have a copy of this same file (With.pm) on another Linux box I have that was built at the same time. I checked that file and it had no control characters. I swapped it out with the (corrupted) one. Then ran my script - and it was fine. No more errors.

      My problem is solved but what I don't understand is how the file got corrupt (maybe a power surge or power outage?). But what I really don't understand is how that file from 2019 (With.pm) was changed but the filetimestamp didn't change. Maybe a corruption doesn't always trigger a timestamp update?

      Thanks again for the reply. I was going to write that I had it solved just as I saw your post.

      Mike

        what I don't understand is how the file got corrupt

        Time for a filesystem check (fsck) and a check of the disks (smartctl). If a RAID is involved, also check the RAID for errors (cat /proc/mdstat for a Linux SW RAID).

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
        > I don't understand is how the file got corrupt (maybe a power surge or power outage?)

        Sounds like it was purposefully edited somehow. Or some well aimed sun spots. Let's go with that :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11131352]
Approved by ikegami
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-19 21:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found