Sponsored Content
Full Discussion: Grades exercise
Homework and Emergencies Homework & Coursework Questions Grades exercise Post 303015895 by RudiC on Monday 16th of April 2018 03:20:10 AM
Old 04-16-2018
Any idea on how to proceed with the (more elegant?) case method?
 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

[question] trouble with an 'exercise'

Hello guys.. well, im kinda newbie with unix because i started to learn it like 2 weeks ago. then i started to make some exercises, but i got stucked on this one : so, i need to know how many different 'names' has the 5th field and how many times each name appears. i was trying with a... (6 Replies)
Discussion started by: EnioMarques
6 Replies

2. UNIX for Dummies Questions & Answers

[question] hard exercise, help needed

Hello guys. Well, on this exercise i need the average "chargeAmount" per hour (for each hour). with this code : cat getusagesummarywrongmatch | grep -iv MOU2GRTObject | cut -d'|' -f4,14 | grep -i chargeamount | cut -d' ' -f2 http://img227.imageshack.us/img227/5889/65969235do0.jpg i got... (2 Replies)
Discussion started by: EnioMarques
2 Replies

3. Shell Programming and Scripting

Reading 5 Students names and grades using while loop????

How do I write a shell script file to read 5 student names (First and Last name) and their grades using a While Loop? Find the Average, Maximum, and Minimum of grades using the same While Loop. Prompt the user using tput to enter the information (first name, last name, grade). Save the data in a... (1 Reply)
Discussion started by: dlbomber1
1 Replies

4. Shell Programming and Scripting

Trouble with part of an exercise

Hi, 'm trying to do an exercicise, and one part is: ls -l $1 | awk ' BEGIN { max = $5; } { if ($5 > max){ max = $5; } } END { print "Tamanio mayor fichero = " max; }' # Imprimimos ahora el menor tamaņo de fichero ls -l $1 | awk '... (4 Replies)
Discussion started by: Phass
4 Replies

5. Homework & Coursework Questions

Help with this exercise

you are to write a program which will read in a tax rate (as a percentage) and the prices of 5 items. the program is to calculate the total price, before tax, of the items and then the tax payable on those items, and then the total amount due. the tax payable is computed by appliying the tax rate... (1 Reply)
Discussion started by: bunkercrazy
1 Replies

6. Shell Programming and Scripting

A very tough exercise

hello everyone!:) I have an exercise which I think is difficult for beginner like me. Here is the exercise Create a shell script, which takes a directory as command line argument. Script displays ten first lines from every text file in that directory. After displaying the lines from the... (1 Reply)
Discussion started by: googlevn
1 Replies

7. UNIX for Dummies Questions & Answers

UNIX Exercise

Hi, I am learning unix. I want to practice few small excercises. Please suggest me some goor URL to practice. Thanks in advance. (1 Reply)
Discussion started by: stew
1 Replies
SUPER(3pm)						User Contributed Perl Documentation						SUPER(3pm)

NAME
SUPER - control superclass method dispatch SYNOPSIS
Find the parent method that would run if this weren't here: sub my_method { my $self = shift; my $super = $self->super('my_method'); # Who's your daddy? if ($want_to_deal_with_this) { # ... } else { $super->($self, @_) } } Or Ruby-style: sub my_method { my $self = shift; if ($want_to_deal_with_this) { # ... } else { super; } } Or call the super method manually, with respect to inheritance, and passing different arguments: sub my_method { my $self = shift; # parent handles args backwardly $self->SUPER( reverse @_ ); } DESCRIPTION
When subclassing a class, you occasionally want to dispatch control to the superclass -- at least conditionally and temporarily. The Perl syntax for calling your superclass is ugly and unwieldy: $self->SUPER::method(@_); especially when compared to its Ruby equivalent: super; It's even worse in that the normal Perl redispatch mechanism only dispatches to the parent of the class containing the method at compile time. That doesn't work very well for mixins and roles. This module provides nicer equivalents, along with the universal method "super" to determine a class' own superclass. This allows you to do things such as: goto &{$_[0]->super('my_method')}; if you don't like wasting precious stack frames. (Because "super" returns a coderef, much like "can" in UNIVERSAL, this doesn't break "use strict 'refs'".) If you are using roles or mixins or otherwise pulling in methods from other packages that need to dispatch to their super methods, or if you want to pass different arguments to the super method, use the "SUPER()" method: $self->SUPER( qw( other arguments here ) ); FUNCTIONS and METHODS This module provides the following functions and methods: "super()" This function calls the super method of the currently-executing method, no matter where the super method is in the hierarchy. This takes no arguments; it passes the same arguments passed to the currently-executing method. The module exports this function by default. Note: you must have the appropriate "package" declaration in place for this to work. That is, you must have compiled the method in which you use this function in the package from which you want to use it. Them's the breaks with Perl 5. "find_parent( $class, $method, $prune, $invocant )" Attempts to find a parent implementation of $method starting with $class. If you pass $prune, it will not ignore the method found in that package, if it exists there. Pass $invocant if the object itself might have a different idea of its parents. The module does not export this function by default. Call it directly. "get_all_parents( $invocant, $class )" Returns all of the parents for the $invocant, if it supports the "__get_parents()" method or the contents of @ISA for $class. You probably oughtn't call this on your own. "SUPER()" Calls the super method of the currently-executing method. You can pass arguments. This is a method. NOTES
Beware: if you do weird things with code generation, be sure to name your anonymous subroutines. See Perl Hacks #57. Using "super" doesn't let you pass alternate arguments to your superclass's method. If you want to pass different arguments, use "SUPER" instead. D'oh. This module does a small amount of Deep Magic to find the arguments of method calling "super()" itself. This may confuse tools such as "Devel::Cover". In your own code, if you do complicated things with proxy objects and the like, define "__get_parents()" to return a list of all parents of the object to which you really want to dispatch. AUTHOR
Created by Simon Cozens, "simon@cpan.org". Copyright (c) 2003 Simon Cozens. Maintained by chromatic, <chromatic at wgz dot org> after version 1.01. Copyright (c) 2004-2009 chromatic. Thanks to Joshua ben Jore for bug reports and suggestions. LICENSE
You may use and distribute this silly little module under the same terms as Perl itself. perl v5.10.0 2009-09-13 SUPER(3pm)
All times are GMT -4. The time now is 06:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy