Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7870509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:38:33+00:00 2026-06-03T01:38:33+00:00

My Perl program is reading data from a serial device attached through USB. Headlines

  • 0

My Perl program is reading data from a serial device attached through USB. Headlines of my script in pseudo-Perl:

use warnings;
use strict;

use Device::SerialPort;
my $PortObj = tie( *$handle , "Device::SerialPort" , $PortName ) or die "Cannot open serial port: $!\n";
while ( 1 ) {
  my $readLength = read( $handle , my $frameData , $frameLength )
}

All works fine and even when I unplug the device from USB I’m able to recover from that situation, when the device file disappears and reappears. I can catch all errors spawned from my own script, but the loaded modules (Device::SerialPort) spawns warnings too and I don’t want them to appear in my logging.

Can I add some sort of flag to my code so I don’t see these specific warnings? It is important for me that only warnings from the module(s) are suppressed, not the warnings from my own script. Currently it looks like this:

[/dev/ttyUSB1]   0x0020 : 00 00 00 00 00 00 00 00 00 AA 93 82 73 68 5E 58 : ............sh^X
[/dev/ttyUSB1]   0x0030 : 55 54 52 52 4F 4E 50 51 50 00 00 00 00 00 00 00 : UTRRONPQP.......
Use of uninitialized value $count_in in addition (+) at /usr/lib/perl5/Device/SerialPort.pm line 2214.
Use of uninitialized value $string_in in concatenation (.) or string at /usr/lib/perl5/Device/SerialPort.pm line 2232.
[/dev/ttyUSB1] Restart required!
[/dev/ttyUSB1] Cannot open serial port: No such file or directory
[/dev/ttyUSB1] Cannot open serial port: No such file or directory
[/dev/ttyUSB1] Cannot open serial port: No such file or directory

[/dev/ttyUSB1]   0x0000 : 41 42 01 40 71 01 1C E4 80 99 80 80 80 80 00 00 : AB.@q...........
[/dev/ttyUSB1]   0x0010 : 00 03 00 00 83 00 01 01 00 00 00 00 00 00 00 00 : ................

So it is about the two Use of uninitialized value warnings that I want to get rid of. The other warnings are my own logging.

  • libdevice-serialport-perl 1.04-2build1
  • perl v5.12.4
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T01:38:34+00:00Added an answer on June 3, 2026 at 1:38 am

    You could try and intercept the warnings:

    $SIG{'__WARN__'} = sub { warn $_[0] unless (caller eq "Device::SerialPort"); };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to run a Java program from my Perl script. I would
I have a Perl program that is reading html tags from a text file.
I have a Perl program, intended to be run from a subversion post-commit script,
I am just trying to run a simple perl program to import data from
My task is to filter some data from perl script with external utility (the
Has anyone ever try to use DB2 import from within a Perl program? My
I wrote a Perl program to capture a live data stream from a tail
We have a Perl program to validate XML which is invoked from a Java
I have a Perl program, that needs to use packages (that I also write).
My Perl program looks like: foo/ foo/bar/ for/bar/test.pm foo.pm foo/bar.pm test.pl and use perl

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.