Search Results

Search found 5 results on 1 pages for 'alex8657'.

Page 1/1 | 1 

  • Puppet : How to override / redefine outside child class (usecase and example detailled)

    - by alex8657
    The use case i try to illustrate is when to declare some item (eq mysqld service) with a default configuration that could be included on every node (class stripdown in the example, for basenode), and still be able to override this same item in some specific class (eg mysql::server), to be included by specific nodes (eg myserver.local) I illustrated this use case with the example below, where i want to disable mysql service on all nodes, but activate it on a specific node. But of course, Puppet parsing fails because the Service[mysql] is included twice. And of course, class mysql::server bears no relation to be a child of class stripdown Is there a way to override the Service["mysql"], or mark it as the main one, or whatever ? I was thinking about the virtual items and the realize function, but it only permits apply an item multiple times, not to redefine or override. # In stripdown.pp : class stripdown { service {"mysql": enable => "false", ensure => "stopped" } } # In mysql.pp : class mysql::server { service { mysqld: enable => true, ensure => running, hasrestart => true, hasstatus => true, path => "/etc/init.d/mysql", require => Package["mysql-server"], } } # Then nodes in nodes.pp : node basenode { include stripdown } node myserver.local inherits basenode { include mysql::server` # BOOM, fails here because of Service["mysql"] redefinition }

    Read the article

  • negative regexp in Squirm (for Squid). Possible ?

    - by alex8657
    Did someone achieve to do negative regexp (or part of) with Squirm ? I tried negative lookahead things and ifthenelse regexps, but Squirm 1.26 fails to understand them. What i want to do is simply: * If the url begins by 'http://' and contains 'account', then rewrite/redirect to 301:https:// * It the url begins by 'https://' and does NOT contains 'account, then rewrite/redirect to 301:http:// So far, i do that using 2 lines of perl, but squirm redirectors would take less memory

    Read the article

  • How to have Moose return a child class instance instead of its own class, for polymorphism

    - by alex8657
    I want to create a generic class, whose builder would not return an instance of this generic class, but an instance of a dedicated children class. As Moose does automatic object building, i do not get to understand if this something possible, and how to create a Moose class with Moose syntax and having this behaviour Eg: The user asks: $file = Repository-new(uri='sftp://blabla') .... and is returned an Repository::_Sftp instance User would use $file as if it is a Repository instance, without the need to know the real subclass (polymorphism)

    Read the article

  • Perl Moose::Util::TypeConstraints bug ? what is this error about the name has invalid chars ?

    - by alex8657
    That has been hours i am tracking a Moose::Util::TypeConstraints exceptions, i don't understand where it gets to check a type and tells me that the name is incorrect. I tracked the error to a reduced example to try to locate the problem, and it just shows me that i do not get it. Did i get to a Moose::Util::TypeConstraints bug ? aoffice:new alex$ perl -c ../codesnippets/typeconstrainterror.pl ../codesnippets/typeconstrainterror.pl syntax OK aoffice:new alex$ perl -d ../codesnippets/typeconstrainterror.pl (...) DB<1> r Something::File::LocalFile=HASH(0x100d1bfa8) contains invalid characters for a type name. Names can contain alphanumeric character, ":", and "." at /opt/local/lib/perl5/vendor_perl/5.10.1/darwin-multi-2level/Moose/Util/TypeConstraints.pm line 508 Moose::Util::TypeConstraints::_create_type_constraint('Something::File::LocalFile=HASH(0x100d1bfa8)', undef, undef, undef, undef) called at /opt/local/lib/perl5/vendor_perl/5.10.1/darwin-multi-2level/Moose/Util/TypeConstraints.pm line 285 Moose::Util::TypeConstraints::type('Something::File::LocalFile=HASH(0x100d1bfa8)') called at ../codesnippets/typeconstrainterror.pl line 7 Something::File::is_slink('Something::File::LocalFile=HASH(0x100d1bfa8)') called at ../codesnippets/typeconstrainterror.pl line 33 Debugged program terminated. Use q to quit or R to restart, use o inhibit_exit to avoid stopping after program termination, h q, h R or h o to get additional info. Below, the code that crashes: package Something::File; use Moose; has 'type' =>(is=>'ro', isa=>'Str', writer=>'_set_type' ); sub is_slink { my $self = shift; return ( $self->type eq 'slink' ); } no Moose; __PACKAGE__->meta->make_immutable; 1; package Something::File::LocalFile; use Moose; use Moose::Util::TypeConstraints; extends 'Something::File'; subtype 'PositiveInt' => as 'Int' => where { $_ >0 } => message { 'Only positive greater than zero integers accepted' }; no Moose; __PACKAGE__->meta->make_immutable; 1; my $a = Something::File::LocalFile->new; # $a->_set_type('slink'); print $a->is_slink ." end\n";

    Read the article

  • What is the magic behind perl read() function and buffer which is not a ref ?

    - by alex8657
    I do not get to understand how the Perl read($buf) function is able to modify the content of the $buf variable. $buf is not a reference, so the parameter is given by copy (from my c/c++ knowledge). So how come the $buf variable is modified in the caller ? Is it a tie variable or something ? The C documentation about setbuf is also quite elusive and unclear to me # Example 1 $buf=''; # It is a scalar, not a ref $bytes = $fh->read($buf); print $buf; # $buf was modified, what is the magic ? # Example 2 sub read_it { my $buf = shift; return $fh->read($buf); } my $buf; $bytes = read_it($buf); print $buf; # As expected, this scope $buf was not modified

    Read the article

1