[beginners-h...@perl.org: ezmlm warning] Bounce warning...what can i do?
Below it's a mail i received from ezmlm program...complains about some mails send to me from the list are bouncing. What can i do about it? I use gmail (you can see that) and mutt MUA. Thank you. - Forwarded message from beginners-h...@perl.org - Date: 16 Dec 2012 12:54:08 - From: beginners-h...@perl.org To: athanasios.zygou...@gmail.com Subject: ezmlm warning Hi! This is the ezmlm program. I'm managing the beginners@perl.org mailing list. I'm working for my owner, who can be reached at beginners-ow...@perl.org. Messages to you from the beginners mailing list seem to have been bouncing. I've attached a copy of the first bounce message I received. If this message bounces too, I will send you a probe. If the probe bounces, I will remove your address from the beginners mailing list, without further notice. I've kept a list of which messages from the beginners mailing list have bounced from your address. Copies of these messages may be in the archive. To retrieve a set of messages 123-145 (a maximum of 100 per request), send an empty message to: beginners-get.123_...@perl.org To receive a subject and author list for the last 100 or so messages, send an empty message to: beginners-in...@perl.org Here are the message numbers: 122132 --- Enclosed is a copy of the bounce message I received. Return-Path: Received: (qmail 18749 invoked from network); 4 Dec 2012 21:40:26 - Received: from x1.develooper.com (207.171.7.70) by x6.develooper.com with SMTP; 4 Dec 2012 21:40:26 - Received: (qmail 6793 invoked by uid 225); 4 Dec 2012 21:40:25 - Delivered-To: beginners-return-122132-athanasios.zygouris=gmail@perl.org Received: (qmail 5520 invoked by alias); 4 Dec 2012 21:39:20 - Received: from unknown (HELO x6.develooper.com) (10.0.100.16) by x1.dev with SMTP; 4 Dec 2012 21:39:20 - Received: by x6.develooper.com (Postfix) id A987817783; Tue, 4 Dec 2012 13:39:20 -0800 (PST) Date: Tue, 4 Dec 2012 13:39:20 -0800 (PST) From: mailer-dae...@x6.develooper.com (Mail Delivery System) Subject: Undelivered Mail Returned to Sender To: beginners-return-122132-athanasios.zygouris=gmail@perl.org Auto-Submitted: auto-replied MIME-Version: 1.0 Content-Type: multipart/report; report-type=delivery-status; boundary=A6F4E17767.1354657160/x6.develooper.com Message-Id: 20121204213920.a987817...@x6.develooper.com This is a MIME-encapsulated message. --A6F4E17767.1354657160/x6.develooper.com Content-Description: Notification Content-Type: text/plain; charset=us-ascii This is the mail system at host x6.develooper.com. I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below. For further assistance, please send mail to postmaster If you do so, please include this problem report. You can delete your own text from the attached returned message. The mail system athanasios.zygou...@gmail.com: host gmail-smtp-in.l.google.com[74.125.25.26] said: 550 5.7.1 Unauthenticated email is not accepted from this domain. o4si3669571paw.344 (in reply to end of DATA command) --A6F4E17767.1354657160/x6.develooper.com Content-Description: Delivery report Content-Type: message/delivery-status Reporting-MTA: dns; x6.develooper.com X-Postfix-Queue-ID: A6F4E17767 X-Postfix-Sender: rfc822; beginners-return-122132-athanasios.zygouris=gmail@perl.org Arrival-Date: Tue, 4 Dec 2012 13:39:19 -0800 (PST) Final-Recipient: rfc822; athanasios.zygou...@gmail.com Original-Recipient: rfc822;athanasios.zygou...@gmail.com Action: failed Status: 5.7.1 Remote-MTA: dns; gmail-smtp-in.l.google.com Diagnostic-Code: smtp; 550 5.7.1 Unauthenticated email is not accepted from this domain. o4si3669571paw.344 --A6F4E17767.1354657160/x6.develooper.com Content-Description: Undelivered Message Content-Type: message/rfc822 Received: from lists-nntp.develooper.com (localhost.localdomain [127.0.0.1]) by x6.develooper.com (Postfix) with SMTP id A6F4E17767 for athanasios.zygou...@gmail.com; Tue, 4 Dec 2012 13:39:19 -0800 (PST) Received: (qmail 12447 invoked by uid 514); 4 Dec 2012 21:34:54 - Mailing-List: contact beginners-h...@perl.org; run by ezmlm Precedence: bulk List-Post: mailto:beginners@perl.org List-Help: mailto:beginners-h...@perl.org List-Unsubscribe: mailto:beginners-unsubscr...@perl.org List-Subscribe: mailto:beginners-subscr...@perl.org List-Id: beginners.perl.org Delivered-To: mailing list beginners@perl.org Delivered-To: moderator for beginners@perl.org Received: (qmail 23393 invoked from network); 3 Dec 2012 20:39:15 - Delivered-To: beginners@perl.org X-Spam-Status: No, hits=-6.3 required=8.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,SINGLE_HEADER_1K,SPF_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: la.mx.develooper.com DKIM-Signature: v=1; a=rsa-sha256; d=fedex.com; s=wtc; c=relaxed/simple; q=dns/txt; i=@fedex.com; t=1354567140;
Re: my first useful program...any corrections/suggestions?
Thank you both for your suggestions. @Shlomi: It seems that i'm completely unable to implement dispatch tables here (but i now know what they are, hope to use them in the near future), so i used the given-when approach...it seemed better than endless if-elsif's. @Brandon: I'll stick with the m//, mostly because it reminds me that i can use any delimiter instead of the slashes. I hope to get more experience tho, and get rid of it. Also, i couldn't find any reference that \d in regex is different from [0-9] (or [:digit:]), but i'm interested for more information about it. @both: Thanks again for looking into my code. You helped me learn a lot more (and in less time) than try to figure them out myself. I tried to use most of your suggestions...hope I've done it well enough. So, here is the new code (i'm pretty happy with how it became): #!/usr/bin/perl use strict; use warnings FATAL = qw( uninitialized ); use v5.16; use X::Osd; use IPC::Cmd qw( can_run run ); # check if amixer exists and get its path my $amixer_path = can_run('amixer') or die 'amixer is not available'; # create osd bar (two output lines) my $osd = X::Osd-new(2); # osd bar properties $osd-set_font(-*-terminus-bold-*-*-*-18-*-*-*-*-*-*-*); $osd-set_shadow_offset(1); $osd-set_pos(XOSD_bottom); $osd-set_align(XOSD_center); $osd-set_horizontal_offset(0); $osd-set_vertical_offset(30); $osd-set_timeout(5); # locate (and if missing create) named pipe my $fifo_file = $ENV{OSD_VOLUME} // $ENV{HOME}/.osd-volume.fifo; unless (-p $fifo_file) { # if anyother filetype is there, just die if (-e $fifo_file) { die $fifo_file: not a named pipe; } else { # create the named pipe require POSIX; POSIX::mkfifo( $fifo_file, 0600 ) or die cannot mkfifo $fifo_file: $!; } } # open named pipe open( my $fifo_fh, +, $fifo_file ) or die cannot open $fifo_file: $!; my $amixer_vol; # constantly read from it FIFO_INPUT: while (chomp( my $fifo_input = $fifo_fh )) { given ($fifo_input) { when ('up') { $amixer_vol = '3%+'; } when ('down') { $amixer_vol = '3%-'; } when ('toggle') { $amixer_vol = 'toggle'; } when ('exit') { last FIFO_INPUT; } default { warn $fifo_input: invalid input; next FIFO_INPUT; } } # set new volume value and read the output my $amixer_cmd = $amixer_path sset Master,0 $amixer_vol; my $amixer; run( command = $amixer_cmd, verbose = 0, buffer = \$amixer, ); # red output color if sound mutes, blue otherwise my $colour = ( index($amixer, '[off]') != -1 ) ? '#DD' : '#1E90FF'; $osd-set_colour($colour); # get new volume value and print osd bar if (my ($volume) = $amixer =~ m/(\d{1,3})%/ ) { $osd-string(0, Master Volume:${volume}%); $osd-percentage(1, $volume); } } # close pipe before exit close($fifo_fh); exit(0); -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
my first useful program...any corrections/suggestions?
I made a small program to display a X::Osd bar displaying my volume percentage (on GNU/Linux box). It works, but I'd like to have any suggestions or corrections about it (i'm not confident about my skills i suppose). So, here is how it works: 1) Have a named pipe defined at $OSD_VOLUME environmental variable. 2) Run the program in the background. 3) When echoing 'up', 'down' or 'toggle' in the named pipe, it raises, lowers or toggles mute state using amixer program. I have the following questions: 1) Is the code OK? (I mean is there anything I should avoid or add?) 2) Is there a better solution to make a perl program and a shell script and/or window manager communicate? (I really didn't love that named pipe solution, but I didn't know of anything else) Enough words, here is the code: #!/usr/bin/perl use strict; use warnings; # extra modules use X::Osd; # create osd bar (two output lines) my $osd = X::Osd-new(2); # osd bar properties $osd-set_font(-*-terminus-bold-*-*-*-18-*-*-*-*-*-*-*); $osd-set_shadow_offset(1); $osd-set_pos(XOSD_bottom); $osd-set_align(XOSD_center); $osd-set_horizontal_offset(0); $osd-set_vertical_offset(30); $osd-set_timeout(5); # locate (and if missing create) named pipe my $fifo_file = (defined $ENV{OSD_VOLUME}) ? $ENV{OSD_VOLUME} : glob(~/.osd-volume.fifo); unless (-p $fifo_file) { # delete non-named pipe file (risky) unlink $fifo_file or die cannot remove $fifo_file: $!; # create the named pipe require POSIX; POSIX::mkfifo($fifo_file, 0600) or die cannot mkfifo $fifo_file: $!; } # open named pipe open(FIFO, +, $fifo_file) or die cannot open $fifo_file: $!; # constantly read from it my $vol; while (chomp(my $fifo_line = FIFO)) { if ($fifo_line eq 'up') { $vol = '3%+'; } elsif ($fifo_line eq 'down') { $vol = '3%-'; } elsif ($fifo_line eq 'toggle') { $vol = 'toggle'; } else { die invalid input: $fifo_line; } # set new volume value and read the output my $amixer = `amixer sset Master,0 $vol` or die error: $!; # get new volume value $vol = $1 if ($amixer =~ m/(\d{1,3})(?:%)/); # change output color if volume is muted if ($amixer =~ m/\[off\]/) { $osd-set_colour(#DD); } else { $osd-set_colour(#1E90FF); } # print volume bar $osd-string(0, 'Master Volume:'.$vol.'%'); $osd-percentage(1, $vol); } # close pipe and exit (with error) # (impossible to get here) close(FIFO); exit(0); -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/