Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dist Updates for PR Challenge #3

Merged
merged 4 commits into from
Feb 4, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ MYMETA.json
MYMETA.yml
cover_db/
*.log
*.bak
14 changes: 12 additions & 2 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
Revision history for Perl extension Device::Modem.

1.58
- Updated test suite a bit.
- Added the tests to the manifest.
- Got rid of indirect object syntax.
- Moved test.pl to the actual test suite.
- Updated $VERSION declarations according to:
http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/
- Added some extra tests (xt/author, xt/release).
- Fixed some spelling.


1.57 Sun Jan 26 11:36:11 CET 2014
- Added a "handshake" option to the connect() method.
Allowed values are "xoff", "rts" or "none" (default).
Expand Down Expand Up @@ -126,7 +137,7 @@ Revision history for Perl extension Device::Modem.

1.23 Wed Dec 4 00:34:52 CET 2002
- little documentation adjustments in main Modem.pm class;
- removed use of `warnings.pm'
- removed use of `warnings.pm'
- now File log class opens the log file once and writes
on already opened file handle, until final close().
- Thanks to Joerg Neuberger for spotting out a problem with
Expand Down Expand Up @@ -191,4 +202,3 @@ Revision history for Perl extension Device::Modem.
0.01 Tue Feb 26 22:15:22 CET 2002
- original version; created by h2xs 1.20 with options
-A -X -n Device::Modem -v 0.01

18 changes: 17 additions & 1 deletion MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,20 @@ Makefile.PL
MANIFEST
META.yml Module meta-data (added by MakeMaker)
README
test.pl
t/00-report-prereqs.dd
t/00-report-prereqs.t
t/01-load.t
t/02-coms.t
xt/author/00-compile.t
xt/author/addressbook.t
xt/author/echo.t
xt/author/offhook.t
xt/author/pod-coverage.t
xt/author/pod-spell.t
xt/author/pod-syntax.t
xt/author/registers.t
xt/author/status.t
xt/author/test-version.t
xt/author/usrobotics.t
xt/release/changes_has_content.t
xt/release/kwalitee.t
216 changes: 129 additions & 87 deletions Makefile.PL
Original file line number Diff line number Diff line change
@@ -1,46 +1,101 @@
# $Id: Makefile.PL,v 1.6 2005-04-30 21:45:47 cosimo Exp $
use strict;
use warnings;

use ExtUtils::MakeMaker;
use IO::Handle ();

my $is_windows = ($^O eq 'MSWin32')? 1: 0;

my %WriteMakefileArgs = (
'ABSTRACT_FROM' => 'lib/Device/Modem.pm',
'AUTHOR' => 'Cosimo Streppone <cosimo@cpan.org>',
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => 0
},
"DISTNAME" => "Mail-Sender",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure this is correct? Shouldn't it be Device-Modem?

"LICENSE" => "perl",
'META_MERGE' => {
resources => {
repository => 'git://github.com/cosimo/perl5-device-modem.git',
bugtracker => 'mailto:bug-device-modem@rt.cpan.org',
license => 'http://dev.perl.org/licenses/',
},
},
"MIN_PERL_VERSION" => "5.006",
"NAME" => "Device::Modem",
"PREREQ_PM" => {
"Carp" => 0,
"Exporter" => 0,
"File::Basename" => 0,
"File::Path" => 0,
"IO::Handle" => 0,
"Sys::Syslog" => 0,
"base" => 0,
"constant" => 0,
"overload" => 0,
"strict" => 0,
},
"TEST_REQUIRES" => {
"ExtUtils::MakeMaker" => 0,
"File::Spec" => 0,
"Test::More" => "0",
"warnings" => 0,
},
'VERSION_FROM' => 'lib/Device/Modem.pm',
"test" => {
"TESTS" => "t/*.t"
}
);

#print "\n\n", '-' x 60, "\n", ' ' x 20, 'Device::Modem setup', "\n", '-' x 60, "\n\n";
my %FallbackPrereqs = (
"Carp" => 0,
"Exporter" => 0,
"ExtUtils::MakeMaker" => 0,
"File::Basename" => 0,
"File::Path" => 0,
"IO::Handle" => 0,
"Sys::Syslog" => 0,
"Test::More" => "0.88",
"Tie::Handle" => 0,
"base" => 0,
"constant" => 0,
"strict" => 0,
"overload" => 0,
"warnings" => 0
);

my $is_windoze = index($^O, 'Win') >= 0;

#
# my %config = configure();
#

WriteMakefile(
'AUTHOR' => 'Cosimo Streppone <cosimo@cpan.org>',
'ABSTRACT_FROM' => 'lib/Device/Modem.pm',
'NAME' => 'Device::Modem',
'VERSION_FROM' => 'lib/Device/Modem.pm',
'PREREQ_PM' => $is_windoze
? { 'Win32::SerialPort' => 0 }
: { 'Device::SerialPort' => 0 },
'META_MERGE' => {
resources => {
repository => 'git://github.com/cosimo/perl5-device-modem.git',
bugtracker => 'mailto:bug-device-modem@rt.cpan.org',
license => 'http://dev.perl.org/licenses/',
},
},
'MIN_PERL_VERSION' => '5.00503',
);
unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
delete $WriteMakefileArgs{TEST_REQUIRES};
delete $WriteMakefileArgs{BUILD_REQUIRES};
$WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
}

sub configure {
delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };

my $default;
if ( $is_windows ) {
$WriteMakefileArgs{PREREQ_PM}{'Win32::SerialPort'} = '0';
}
else {
$WriteMakefileArgs{PREREQ_PM}{'Device::SerialPort'} = '0';
}

#
# Modem setup
#
WriteMakefile(%WriteMakefileArgs);

my $port;
$default = 'n'; # default = no modem
#print "\n\n", '-' x 60, "\n", ' ' x 20, 'Device::Modem setup', "\n", '-' x 60, "\n\n";
#
# my %config = configure();
#
sub configure {
# Modem setup
my $default = 'n'; # default = no modem
my $port;
my %conf;

do {
do {

print <<HELP;
print <<HELP;

* Modem configuration

Expand All @@ -50,49 +105,45 @@ sub configure {
n) no modem. Tests will not access serial port *DEFAULT*
HELP

if( ! $is_windoze ) {
print " 0) (zero). Modem is connected to [/dev/ttyS0]\n";
}
print " 0) (zero). Modem is connected to [/dev/ttyS0]\n" unless ($is_windows);

for( 1 .. 4 ) {
print " $_) Modem is connected to ", $is_windoze ? 'COM' : '/dev/ttyS', $_, "\n";
}
for( 1 .. 4 ) {
print " $_) Modem is connected to ", $is_windows ? 'COM' : '/dev/ttyS', $_, "\n";
}

if( ! $is_windoze ) {
print " m) Modem is connected to [/dev/modem]\n";
}
print " m) Modem is connected to [/dev/modem]\n" unless ($is_windows);

print "\n? ";
print "\n? ";

$port = <STDIN>;
chomp $port;
$port = lc substr $port, 0, 1;
$port = <STDIN>;
chomp $port;
$port = lc substr $port, 0, 1;

$port = $default unless defined $port;
$port = $default unless defined $port;

} until( index( '01234nm', $port ) != -1 );
} until( index( '01234nm', $port ) != -1 );

if( $port eq 'n' ) {
$conf{'port'} = 'NONE';
} elsif( $port eq 'm' ) {
$conf{'port'} = '/dev/modem';
} else {
$conf{'port'} = $is_windoze ? 'COM%d' : '/dev/ttyS%d';
$conf{'port'} = sprintf $conf{'port'}, $port;
}
if( $port eq 'n' ) {
$conf{'port'} = 'NONE';
} elsif( $port eq 'm' ) {
$conf{'port'} = '/dev/modem';
} else {
$conf{'port'} = $is_windows ? 'COM%d' : '/dev/ttyS%d';
$conf{'port'} = sprintf $conf{'port'}, $port;
}

$conf{'port'} = 'COM1' if $conf{'port'} eq 'COM0';
$conf{'port'} = 'COM1' if $conf{'port'} eq 'COM0';

#
# Baud rate configuration
#
#
# Baud rate configuration
#

my $baud;
$default = 4; # default = 19200
my $baud;
$default = 4; # default = 19200

do {
do {

print <<HELP;
print <<HELP;

* Serial link speed

Expand All @@ -106,33 +157,24 @@ HELP

HELP

print "? ";
$baud = <STDIN>; chomp $baud; $baud =~ s/\D//g;
$baud ||= $default;

} until( $baud >= 1 and $baud <= 5 );
print "? ";
$baud = <STDIN>; chomp $baud; $baud =~ s/\D//g;
$baud ||= $default;

$conf{'baudrate'} = 2400 << ($baud - 1);
} until( $baud >= 1 and $baud <= 5 );

print "\n- Selected $conf{'baudrate'} speed\n";
$conf{'baudrate'} = 2400 << ($baud - 1);

print "\n- Selected $conf{'baudrate'} speed\n";

# Write configuration file
if( open CONF, '>.config.pm' ) {

print CONF "# Device::Modem setup parameters\n# \$Id: Makefile.PL,v 1.6 2005-04-30 21:45:47 cosimo Exp $\n\n";

foreach( sort keys %conf ) {
print CONF "\$Device::Modem::$_ = '$conf{$_}';\n";
}

print CONF "\n1;\n\n";
close CONF;

}

return %conf;
# Write configuration file
open my $cnf, '>', '.config.pm' or return %conf;

print {$cnf} "# Device::Modem setup parameters\n# \$Id: Makefile.PL,v 1.6 2005-04-30 21:45:47 cosimo Exp $\n\n";
for my $key (sort keys %conf) {
print {$cnf} "\$Device::Modem::$_ = '$conf{$_}';\n";
}
print {$cnf} "\n1;\n\n";
return %conf;
}


2 changes: 1 addition & 1 deletion examples/active.pl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
# BEGIN OF TESTS
# -----------------------------------------------------

my $modem = new Device::Modem( port => $port );
my $modem = Device::Modem->new( port => $port );

if( $modem->connect( baudrate => $config{'baud'} || 19200 ) ) {
print "ok 2\n";
Expand Down
3 changes: 1 addition & 2 deletions examples/caller-id.pl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Init modem
my $port = '/dev/ttyS0';
my $baud = 9600;
my $modem = new Device::Modem ( port => $port );
my $modem = Device::Modem->new( port => $port );

die "Can't connect to port $port!\n" unless $modem->connect( baudrate => $baud );
print "Connected to $port.\n\n";
Expand Down Expand Up @@ -53,4 +53,3 @@
}

$modem->disconnect();

6 changes: 3 additions & 3 deletions examples/dial.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# This script tries to dial a number taken from STDIN
# or as first argument.
#
#
# Example:
# perl dial.pl 012,3456789
#
Expand All @@ -29,7 +29,7 @@

} else {

$config{'tty'} = $Device::Modem::DEFAULT_PORT;
$config{'tty'} = $Device::Modem::DEFAULT_PORT;

print "What is your serial port? [$config{'tty'}] ";
chomp( $port = <STDIN> );
Expand All @@ -42,7 +42,7 @@

}

my $modem = new Device::Modem( port => $port );
my $modem = Device::Modem->new( port => $port );

if( $modem->connect( baudrate => $config{'baud'} || 19200 ) ) {
print "ok connected.\n";
Expand Down
3 changes: 1 addition & 2 deletions examples/shell.pl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

$baud ||= 19200;

my $modem = new Device::Modem ( port => $port );
my $modem = Device::Modem->new( port => $port );
my $stop;

die "Could not connect to $port!\n" unless $modem->connect( baudrate => $baud );
Expand All @@ -55,4 +55,3 @@
}

print "Done.\n";

Loading