Perl + falhou ao instalar o módulo Pogo no RedHat 5.4

0

Por favor, conselhos sobre como instalar o módulo Pessoa "use Person"; na minha máquina linux O script perl use - obj oriented

por que recebo o seguinte:

 [root@linux /tmp/Pogo-0.10]# perl Makefile.PL
 Note (probably harmless): No library found for -lg++
 Note (probably harmless): No library found for -lgcc
 Note (probably harmless): No library found for -lclient
 Writing Makefile for Pogo


[root@linux /tmp/Pogo-0.10]# make


g++ -c  -I/usr/local/goods/inc -fno-strict-aliasing -pipe -Wdeclaration-after-statement -    
I/usr/local/include -D_LARGEFILE_SOURCE -Dc
/bin/sh: g++: command not found
make: *** [Pogo.o] Error 127

meu script perl:

#!/usr/bin/perl


use strict;
use warnings;
use Person;

 my $p = Person->new();

 $p->varName('Anna');

 $p->varAge(30);

 print $p->varName." is ".$p->varAge." years old.\n";
    
por yael 09.02.2011 / 10:03

1 resposta

1

Perl Orientado a Objetos

Se seu foco for aprender o Perl Orientado a Objetos, e não aprender Pogo, sugiro que você siga apenas um dos tutoriais internos do perl, executando o comando: perldoc perltoot . Isso levaria você rapidamente para a seguinte solução:

arquivo Person.pm

package Person;
use strict;

sub new {
  my $self = {};
  $self->{NAME} = undef;
  $self->{AGE}  = undef;
  bless $self;
  return $self;
}

sub varName {
  my $self = shift;
  if (@_) { $self->{NAME} = shift; }
  return $self->{NAME}
}

sub varAge {
  my $self = shift;
  if (@_) { $self->{AGE} = shift; }
  return $self->{AGE}
}

1;

arquivo person.pl

#!/usr/bin/perl
use strict;
use warnings;
use Person;

my $p = Person->new();
$p->varName('Anna');
$p->varAge(30);
print $p->varName." is ".$p->varAge." years old.\n";

Executando:

 $ perl person.pl
 Anna is 30 years old.

Módulos Perl

Você perguntou

how to install the Person module

Você parece estar instalando um módulo chamado Pogo não um chamado "Pessoa".

why I get the following: ... /bin/sh: g++: command not found

Parece que você não tem um kit de desenvolvimento completo instalado. Você já verificou a documentação da sua distribuição Linux? Cada distribuição diferente tem seu próprio gerenciador de pacotes que você pode usar para instalar um kit de desenvolvimento.

Você pode tentar usar o comando cpan , mas espero que você tenha o mesmo problema.

Ferramentas de desenvolvimento do RHEL

Para instalar módulos perl que não sejam "pure perl", você precisará de um compilador C ou C ++ e algumas outras ferramentas e bibliotecas. O que se segue é extraído de um artigo do Slicehost que eu acredito que se aplica para RHEL 5.4 genericamente (eu uso o CentOS, então não tenho experiência direta na instalação de pacotes RHEL)

Package repositories

RHEL comes with a basic set of repositories.

Have a look at the enabled repositories by running:

sudo yum repolist enabled

Each repository listed should include a brief description and the number of packages available from that source.

If you'd like to have a look at the configuration files that point to each repository, they're stored in this directory:

/etc/yum.repos.d

If you look through one of the files there, you will see each repository has a set of definitions including which mirror to use and what gpg key to use (and actually whether to check the package signature at all).

You can, of course, add more repositories whenever you want to but I would just give a word of caution: Some of the available repositories are not officially supported and may not receive any security updates should a flaw be discovered.

Update

Now we can update the package list that yum uses.

The following command will also offer to install any updated packages. As with all installs have a careful look at the list and, once happy, press 'y' to continue:

sudo yum update

Once any updates have been installed, we can move on to installing some essential packages.

Development Tools

RHEL has some handy meta-packages that include sets of pre-defined programs required for a single purpose.

So instead of installing a dozen different package names, you can install just one meta- package. One such package is called 'Development Tools'. Issue the command:

sudo yum groupinstall 'Development Tools'

Notice the programs that are to be installed include gcc, make, patch and so on. All these are needed for many other programs to install properly. A neat system indeed.

Enter 'y' and install them.

Now we have the necessary packages should we want to build an application from source.

Done

CentOS

Se você não pagou por uma assinatura RHEL e a registrou, suspeito que você não tenha acesso aos repositórios de pacotes RedHat. Portanto, você não poderá instalar pacotes, como as ferramentas de desenvolvimento. Existem maneiras de contornar isso, mas o curso de ação sensato é instalar o CentOS - é quase exatamente como RedHat (omitindo marcas registradas RedHat e imagens protegidas por direitos autorais, etc.), mas possui repositórios que podem ser usados sem pagar uma taxa de assinatura. p>     

por 09.02.2011 / 10:59