Sponsored Content
Full Discussion: False positive grep?
Top Forums Shell Programming and Scripting False positive grep? Post 303045953 by sea on Sunday 19th of April 2020 09:37:04 AM
Old 04-19-2020
Thank you very much!
This works perfectly! Smilie
 

8 More Discussions You Might Find Interesting

1. Linux

bin\false

We have requirments to not allow a userid login abilities but allow users to 'su' to it. In solaris I normally set the shell in /etc/passwd to bin/false. THis does not work on Linux, any suggestions would help. (1 Reply)
Discussion started by: bryanthomas
1 Replies

2. Shell Programming and Scripting

false use of sed???

i want to delete every newline and every line which starts with "RECORD......." in a file. FILE: Record 61391 in base BROCKHAUS (Timestamp: 2008-04-09 11:38:38) UNTERTITEL : Gräfin (seit 1707 Reichsgräfin) von, * Schwerin 4. 2. 1686, + Berlin 21. 10. 1744; wurde Record 61392 in base BROCKHAUS... (4 Replies)
Discussion started by: trek
4 Replies

3. Shell Programming and Scripting

Why is it always false?

Hi, I'm new to UNIX and am trying to learn shell scripting in order to work on an interface that I inherited when a co-worker left. I need to be able to check to see whether a file exists to determine whether the FTP has taken place, but in testing, the if statement always evaluates as false,... (3 Replies)
Discussion started by: JeffR
3 Replies

4. Shell Programming and Scripting

False Condition

Hi All, I am using the below Script to enter a line in the File: #!/bin/ksh # To delete the last line if it contains the pattern Redirect permanent / Virgin Atlantic Airways - Popup echo "Enter the URL that should point to the particular microsite" read url # To delete the last line if it... (0 Replies)
Discussion started by: Shazin
0 Replies

5. IP Networking

false tcp connection

Why this happens? How to solve this? $netstat -na |grep 9325 tcp 0 0 127.0.0.1:9325 127.0.0.1:9325 ESTABLISHED When a client socket repeatedly tries to connect to an inactive(no server socket is listening on this port) local port,connect succeeds. ... (1 Reply)
Discussion started by: johnbach
1 Replies

6. AIX

Gid=0 and 7 + admin=FALSE

Checking configuration access files for an AIX server, left me wondering about this :confused:: If a user is added to system group, it gets gid=0 with some security risks because it gets some root kind of file access level. Is this insecure condition kept if the user has admin variable... (0 Replies)
Discussion started by: bkiddo
0 Replies

7. UNIX for Dummies Questions & Answers

Tail with positive offset

I have read the below from the book bash cookbook.Tail +1 filenames is similar to cat filename I have tried the same in Ubuntu 11.10 with bash. 4.0 . I have received error for the Same. May I know in which system that will work fine ? Thanks (1 Reply)
Discussion started by: pandeesh
1 Replies

8. Shell Programming and Scripting

False alerts

Hi I have written a script to send email alerts when load of my linux server reaches max point I keep getting false emails thought the load is normal , looks like same email is generated again and again - called from cron tab checked if the tempfile is present , no it is not , cleaned... (22 Replies)
Discussion started by: anil529
22 Replies
Moose::Manual::Delegation(3pm)				User Contributed Perl Documentation			    Moose::Manual::Delegation(3pm)

NAME
Moose::Manual::Delegation - Attribute delegation VERSION
version 2.0603 WHAT IS DELEGATION
? Delegation is a feature that lets you create "proxy" methods that do nothing more than call some other method on an attribute. This lets you simplify a complex set of "has-a" relationships and present a single unified API from one class. With delegation, consumers of a class don't need to know about all the objects it contains, reducing the amount of API they need to learn. Delegations are defined as a mapping between one or more methods provided by the "real" class (the delegatee), and a set of corresponding methods in the delegating class. The delegating class can re-use the method names provided by the delegatee or provide its own names. Delegation is also a great way to wrap an existing class, especially a non-Moose class or one that is somehow hard (or impossible) to subclass. DEFINING A MAPPING
Moose offers a number of options for defining a delegation's mapping, ranging from simple to complex. The simplest form is to simply specify a list of methods: package Website; use Moose; has 'uri' => ( is => 'ro', isa => 'URI', handles => [qw( host path )], ); With this definition, we can call "$website->host" and it "just works". Under the hood, Moose will call "$website->uri->host" for you. Note that $website is not automatically passed to the "host" method; the invocant is "$website->uri". We can also define a mapping as a hash reference. This allows you to rename methods as part of the mapping: package Website; use Moose; has 'uri' => ( is => 'ro', isa => 'URI', handles => { hostname => 'host', path => 'path', }, ); In this example, we've created a "$website->hostname" method, rather than using "URI.pm"'s name, "host". These two mapping forms are the ones you will use most often. The remaining methods are a bit more complex. has 'uri' => ( is => 'ro', isa => 'URI', handles => qr/^(?:host|path|query.*)/, ); This is similar to the array version, except it uses the regex to match against all the methods provided by the delegatee. In order for this to work, you must provide an "isa" parameter for the attribute, and it must be a class. Moose uses this to introspect the delegatee class and determine what methods it provides. You can use a role name as the value of "handles": has 'uri' => ( is => 'ro', isa => 'URI', handles => 'HasURI', ); Moose will introspect the role to determine what methods it provides and create a mapping for each of those methods. Finally, you can also provide a sub reference to generate a mapping. You probably won't need this version often (if ever). See the Moose docs for more details on exactly how this works. NATIVE DELEGATION
Native delegations allow you to delegate to standard Perl data structures as if they were objects. has 'queue' => ( traits => ['Array'], isa => 'ArrayRef[Item]', default => sub { [ ] }, handles => { add_item => 'push', next_item => 'shift', }, ) The "Array" trait in the "traits" parameter tells Moose that you would like to use the set of Array helpers. Moose will then create "add_item" and "next_item" methods that "just work". Behind the scenes "add_item" is something like sub add_item { my ($self, @items) = @_; for my $item (@items) { $Item_TC->validate($item); } push @{ $self->queue }, @items; } Moose includes the following traits for native delegation: o Array o Bool o Code o Counter o Hash o Number o String CURRYING
Currying allows you to create a method with some pre-set parameters. You can create a curried delegation method: package Spider; use Moose; has request => ( is => 'ro' isa => 'HTTP::Request', handles => { set_user_agent => [ header => 'UserAgent' ], }, ) With this definition, calling "$spider->set_user_agent('MyClient')" will call "$spider->request->header('UserAgent', 'MyClient')" behind the scenes. Note that with currying, the currying always starts with the first parameter to a method ($_[0]). Any arguments you pass to the delegation come after the curried arguments. MISSING ATTRIBUTES
It is perfectly valid to delegate methods to an attribute which is not required or can be undefined. When a delegated method is called, Moose will throw a runtime error if the attribute does not contain an object. AUTHOR
Moose is maintained by the Moose Cabal, along with the help of many contributors. See "CABAL" in Moose and "CONTRIBUTORS" in Moose for details. COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Infinity Interactive, Inc.. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-06-28 Moose::Manual::Delegation(3pm)
All times are GMT -4. The time now is 11:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy