App-Tel

 view release on metacpan or  search on metacpan

inc/Module/Install.pm  view on Meta::CPAN

	my $who  = $self->_caller;
	my $cwd  = Cwd::getcwd();
	my $sym  = "${who}::AUTOLOAD";
	$sym->{$cwd} = sub {
		my $pwd = Cwd::getcwd();
		if ( my $code = $sym->{$pwd} ) {
			# Delegate back to parent dirs
			goto &$code unless $cwd eq $pwd;
		}
		unless ($$sym =~ s/([^:]+)$//) {
			# XXX: it looks like we can't retrieve the missing function
			# via $$sym (usually $main::AUTOLOAD) in this case.
			# I'm still wondering if we should slurp Makefile.PL to
			# get some context or not ...
			my ($package, $file, $line) = caller;
			die <<"EOT";
Unknown function is found at $file line $line.
Execution of $file aborted due to runtime errors.

If you're a contributor to a project, you may need to install
some Module::Install extensions from CPAN (or other repository).

lib/App/Tel.pm  view on Meta::CPAN

}

=head2 hostname

   $hostname = $self->hostname("hostname");

Called to parse the hostname provided by the user when first making a
connection.  If the hostname has special attributes like a port designation,
it's parsed here.

This also looks up the profile for the hostname to see if it needs to be
translated because of an alias.  The final hostname is stored and returned.


=cut

sub hostname {
    my ($self, $hostname) = @_;

    if (!defined($hostname)) {
        return $self->{hostname};

lib/App/Tel/Color/Cisco.pm  view on Meta::CPAN

package App::Tel::Color::Cisco;
use parent 'App::Tel::Color::Base';
use Term::ANSIColor;
use Scalar::Util qw ( looks_like_number );
use strict;
use warnings;

=head1 NAME

App::Tel::Cisco - Colors for show interface and other commands

=head2 METHODS

=cut

sub _c {
    # if not a number then return the original text
    my $val = shift;
    return $val if (!looks_like_number($val));
    if ($val > 0) {
        return colored($val, 'red');
    }
    return colored($val, 'green');
}


# not kidding, this will be crazy.
# it simulates s/blah (\d+) blah/sprintf("blah %s blah", c($1))/e;
sub _crazy {

local/lib/perl5/Module/Build/API.pod  view on Meta::CPAN

If you generate a F<README> in this way, it's probably a good idea to
create a separate F<INSTALL> file if that information isn't in the
generated F<README>.

=item dist_abstract

[version 0.20]

This should be a short description of the distribution.  This is used when
generating metadata for F<META.yml> and PPD files.  If it is not given
then C<Module::Build> looks in the POD of the module from which it gets
the distribution's version.  If it finds a POD section marked "=head1
NAME", then it looks for the first line matching C<\s+-\s+(.+)>,
and uses the captured text as the abstract.

=item dist_author

[version 0.20]

This should be something like "John Doe <jdoe@example.com>", or if
there are multiple authors, an anonymous array of strings may be
specified.  This is used when generating metadata for F<META.yml> and
PPD files.  If this is not specified, then C<Module::Build> looks at
the module from which it gets the distribution's version.  If it finds
a POD section marked "=head1 AUTHOR", then it uses the contents of
this section.

=item dist_name

[version 0.11]

Specifies the name for this distribution.  Most authors won't need to
set this directly, they can use C<module_name> to set C<dist_name> to

local/lib/perl5/Module/Build/API.pod  view on Meta::CPAN


The arguments may be either a scalar or an array reference of file
names.

=item y_n($message, $default)

[version 0.12]

Asks the user a yes/no question using C<prompt()> and returns true or
false accordingly.  The user will be asked the question repeatedly
until they give an answer that looks like "yes" or "no".

The first argument specifies the message to display to the user (for
example, C<"Shall I invest your money for you?">), and the second
argument specifies the default answer (for example, C<"y">).

Note that the default is specified as a string like C<"y"> or C<"n">,
and the return value is a Perl boolean value like 1 or 0.  I thought
about this for a while and this seemed like the most useful way to do
it.

local/lib/perl5/Module/Build/Base.pm  view on Meta::CPAN

    return $status->{have} if $status->{have} and "$status->{have}" ne '<none>';
    return '0 but true';
  }

  $@ = $status->{message};
  return 0;
}

sub make_executable {
  # Perl's chmod() is mapped to useful things on various non-Unix
  # platforms, so we use it in the base class even though it looks
  # Unixish.

  my $self = shift;
  foreach (@_) {
    my $current_mode = (stat $_)[2];
    chmod $current_mode | oct(111), $_;
  }
}

sub is_executable {

local/lib/perl5/Module/Build/Base.pm  view on Meta::CPAN

  if ( grep $opt =~ /^no[-_]?$_$/, @bool_opts ) {
    $opt =~ s/^no-?//;
    return ($opt, 0);
  }

  # non-boolean option; return option unchanged along with its argument
  return ($opt, shift(@$argv)) unless grep $_ eq $opt, @bool_opts;

  # we're punting a bit here, if an option appears followed by a digit
  # we take the digit as the argument for the option. If there is
  # nothing that looks like a digit, we pretend the option is a flag
  # that is being set and has no argument.
  my $arg = 1;
  $arg = shift(@$argv) if @$argv && $argv->[0] =~ /^\d+$/;

  return ($opt, $arg);
}

sub read_args {
  my $self = shift;

local/lib/perl5/Module/Build/Bundling.pod  view on Meta::CPAN

into the distribution's C<inc/> directory.  This is the same approach
used by L<Module::Install>, a modern wrapper around ExtUtils::MakeMaker
for Makefile.PL based distributions.

The "trick" to making this work for Module::Build is making sure the
highest version Module::Build is used, whether this is in C<inc/> or
already installed on the user's system.  This ensures that all necessary
features are available as well as any new bug fixes.  This is done using
the experimental L<inc::latest> module, available on CPAN.

A "normal" Build.PL looks like this (with only the minimum required
fields):

  use Module::Build;

  Module::Build->new(
    module_name => 'Foo::Bar',
    license     => 'perl',
  )->create_build_script;

A "bundling" Build.PL replaces the initial "use" line with a nearly

local/lib/perl5/Module/Build/Bundling.pod  view on Meta::CPAN


  Module::Build->new(
    module_name => 'Foo::Bar',
    license => 'perl',
  )->create_build_script;

The C<inc::latest> module creates bundled directories based on the packlist
file of an installed distribution.  Even though C<inc::latest> takes module
name arguments, it is better to think of it as bundling and making
available entire I<distributions>.  When a module is loaded through
C<inc::latest>, it looks in all bundled distributions in C<inc/> for a
newer module than can be found in the existing C<@INC> array.

Thus, the module-name provided should usually be the "top-level" module
name of a distribution, though this is not strictly required.  For example,
L<Module::Build> has a number of heuristics to map module names to
packlists, allowing users to do things like this:

  use inc::latest 'Devel::AssertOS::Unix';

even though Devel::AssertOS::Unix is contained within the Devel-CheckOS

local/lib/perl5/Module/Build/Compat.pm  view on Meta::CPAN


sub makefile_to_build_args {
  my $class = shift;
  my @out;
  foreach my $arg (@_) {
    next if $arg eq '';

    my ($key, $val) = ($arg =~ /^(\w+)=(.+)/ ? ($1, $2) :
		       die "Malformed argument '$arg'");

    # Do tilde-expansion if it looks like a tilde prefixed path
    ( $val ) = Module::Build->_detildefy( $val ) if $val =~ /^~/;

    if (exists $makefile_to_build{$key}) {
      my $trans = $makefile_to_build{$key};
      push @out, $class->_argvify( ref($trans) ? $trans->($val) : ($trans => $val) );
    } elsif (exists $Config{lc($key)}) {
      push @out, $class->_argvify( config => lc($key) . "=$val" );
    } else {
      # Assume M::B can handle it in lowercase form
      push @out, $class->_argvify("\L$key" => $val);

local/lib/perl5/Module/Install.pm  view on Meta::CPAN

	my $who  = $self->_caller;
	my $cwd  = Cwd::getcwd();
	my $sym  = "${who}::AUTOLOAD";
	$sym->{$cwd} = sub {
		my $pwd = Cwd::getcwd();
		if ( my $code = $sym->{$pwd} ) {
			# Delegate back to parent dirs
			goto &$code unless $cwd eq $pwd;
		}
		unless ($$sym =~ s/([^:]+)$//) {
			# XXX: it looks like we can't retrieve the missing function
			# via $$sym (usually $main::AUTOLOAD) in this case.
			# I'm still wondering if we should slurp Makefile.PL to
			# get some context or not ...
			my ($package, $file, $line) = caller;
			die <<"EOT";
Unknown function is found at $file line $line.
Execution of $file aborted due to runtime errors.

If you're a contributor to a project, you may need to install
some Module::Install extensions from CPAN (or other repository).

local/lib/perl5/Module/Install/API.pod  view on Meta::CPAN


  name 'Foo-Bar';
  name_from 'lib/Foo/Bar.pm';

B<name> commmand takes a distribution name. It usually differs
slightly from a module name (a module name is separated by double
colons; a distribution name is separated by hyphens). Just replacing
all the double colons of your main module with hyphens would be
enough for you.

B<name_from> takes a module file path, and looks for the topmost
C<package> declaration to extract a module name, and then converts it
to a distribution name.

You may optionally set B<module_name> to specify a main module name
(if you choose other naming scheme for your distribution). This value
is directly passed to L<ExtUtils::MakeMaker> in the backend as a
C<NAME> attribute (Module::Install usually creates this from the
distribution name set by B<name> or B<name_from>).

=head2 abstract, abstract_from (L<Module::Install::Metadata>)

  abstract 'a short description of the distribution';
  abstract_from 'lib/Foo/Bar.pm';

B<abstract> command takes a string to describe what that
module/distribution is for. B<abstract_from> takes a module file path
and looks for a string that follows the module's name and a hyphen
to separate in the C<NAME> section of the pod.

The value set by B<abstract> or B<abstract_from> is passed to
L<ExtUtils::MakeMaker> as an C<ABSTRACT> attribute.

=head2 version, version_from (L<Module::Install::Metadata>)

  version '0.01';
  version_from 'lib/Foo/Bar.pm';

B<version> command takes a version string for the distribution.
B<version_from> takes a module file path, and looks for the
C<$VERSION> of the module.

The value set by B<version> or B<version_from> is passed to
L<ExtUtils::MakeMaker> as a C<VERSION> attribute. B<version_from>
(and B<all_from>) also sets a C<VERSION_FROM> attribute to check
version integrity of the distribution.

=head2 perl_version, perl_version_from (L<Module::Install::Metadata>)

  perl_version '5.008';
  perl_version_from 'lib/Foo/Bar.pm';

B<perl_version> command takes a minimum required perl version for the
distribution. B<perl_version_from> takes a module file path, and
looks for a C<< use <perl_version> >> (or C<< require <perl_version>
>>) statement (note that now L<Module::Install> only supports perl
5.005 and newer).

The value set by B<perl_version> or B<perl_version_from> is passed to
L<ExtUtils::MakeMaker> as a C<MIN_PERL_VERSION> attribute (if
applicable).

=head2 author, author_from (L<Module::Install::Metadata>)

  author 'John Doe <john.doe at cpan.org>';
  author_from 'lib/Foo/Bar.pm';

B<author> command takes a string to describe author(s). You can set
multiple authors with one B<author> command, or with multiple
B<author>s (you can also use B<authors> alias if you prefer).

B<author_from> takes a module file path, and looks for an C<AUTHOR>
(or C<AUTHORS>) section in the pod (and also license/copyright
sections if it can't find any author(s) section) to extract an
author.

The value set by B<author> or B<author_from> is concatenated and
passed to L<ExtUtils::MakeMaker> as an C<AUTHOR> attribute.

=head2 license, license_from (L<Module::Install::Metadata>)

  license 'perl';
  license_from 'lib/Foo/Bar.pm';

B<license> command takes an abbreviated license name including
C<perl>, C<artistic>, C<apache>, C<(l)gpl>, C<bsd>, C<mit>,
C<mozilla>, C<open_source>, and so on. If you don't (want to) specify
a particular license, it will be C<unknown>.

B<license_from> takes a module file path, and looks for a C<LICENSE>
(or C<LICENCE>) section in the pod (and also C<COPYRIGHT> section if
it can't find any) to extract a license.

The value set by B<license> or B<license_from> is passed to
L<ExtUtils::MakeMaker> as an C<LICENSE> attribute (if applicable).

You are also reminded that if the distribution is intended to be
uploaded to the CPAN, it B<must> be an OSI-approved open source
license. Commercial software is not permitted on the CPAN.

local/lib/perl5/Module/Install/API.pod  view on Meta::CPAN

may fall back to C<PREREQ_PM> if your L<ExtUtils::MakeMaker> is not
new enough.

=begin experimental

=head2 requires_from, test_requires_from (L<Module::Install::Metadata>)

  requires_from 'lib/Foo/Bar.pm';
  test_requires_from 't/00-compile.t';

B<requires_from> command takes a module file path, and looks for
C<use> statements with explicit module version (like C<< use Foo::Bar
 0.01 >>), and from which it sets C<requires> attributes.
B<test_requires_from> commands also takes a file path but of a test
file, and looks for the same C<use> statements to set
B<build_requires> attributes. Both are experimental and only work if
the statements have an explicit version number (which you rarely
append...).

This behavior may change in the future.

=end experimental

=head2 recommends (L<Module::Install::Metadata>)

local/lib/perl5/Module/Install/API.pod  view on Meta::CPAN

testing (with C<RELEASE_TESTING> environmental variable).

The value set by B<tests> is passed to L<ExtUtils::MakeMaker> as a
C<test> attribute.

=head2 tests_recurisve (L<Module::Install::Makefile>)

  tests_recursive;
  tests_recursive('t');

B<tests_recursive> command may take a directory, and looks for test
files under it recursively. As of this writing, you can't use this
command with other test related commands.

=head1 COMMANDS TO TWEAK DIRECTORIES TO INSTALL

=head2 installdirs (L<Module::Install::Metadata>)

  installdirs 'site';

B<installdirs> command takes a directory type, and changes a

local/lib/perl5/Module/Install/FAQ.pod  view on Meta::CPAN


If you don't like this behavior, use C<makemaker_args> to pass
an anonymous hash to C<PL_FILES>.

  makemaker_args(PL_FILES => {});

=begin todo

=head2 Some of the tests in bundled distributions fail which don't when you install them one by one. Why?

=head2 It looks like some of the bundled distribution are not installed. Why?

=head2 Included ExtUtils::MakeMaker doesn't work correctly. Why?

=end todo

=head1 AUTHOR

Kenichi Ishigaki E<lt>ishigaki@cpan.orgE<gt>

=head1 COPYRIGHT

local/lib/perl5/Module/ScanDeps.pm  view on Meta::CPAN

                  ? $name
                  : { file => $File::Find::name, name => $name };
            },
            $dir
        );
    }

    return @files;
}

# like _glob_in_inc, but looks only at the first level
# (i.e. the children of $subdir)
# NOTE: File::Find has no public notion of the depth of the traversal
# in its "wanted" callback, so it's not helpful 
sub _glob_in_inc_1 {
    my $subdir  = shift;
    my $pm_only = shift;
    my @files;

    $subdir =~ s/\$CurrentPackage/$CurrentPackage/;

local/lib/perl5/YAML/Tiny.pm  view on Meta::CPAN

    return $b_obj->FLAGS & B::SVf_POK();
}

sub _dump_scalar {
    my $string = $_[1];
    my $is_key = $_[2];
    # Check this before checking length or it winds up looking like a string!
    my $has_string_flag = _has_internal_string_value($string);
    return '~'  unless defined $string;
    return "''" unless length  $string;
    if (Scalar::Util::looks_like_number($string)) {
        # keys and values that have been used as strings get quoted
        if ( $is_key || $has_string_flag ) {
            return qq['$string'];
        }
        else {
            return $string;
        }
    }
    if ( $string =~ /[\x00-\x09\x0b-\x0d\x0e-\x1f\x7f-\x9f\'\n]/ ) {
        $string =~ s/\\/\\\\/g;



( run in 0.555 second using v1.01-cache-2.11-cpan-64827b87656 )