Sponsored Content
Top Forums Shell Programming and Scripting Calling a subroutine with arguments Post 302303716 by jermaine4ever on Friday 3rd of April 2009 10:20:18 AM
Old 04-03-2009
methyl,
Thank you very much, I will try and that and see if it works
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem in subroutine calling

Hi, we can call the subroutines using two ways .... 1) calling subroutine name preceeded by & symbol. 2)Another one is without &symbol.... what is the diff b/w these two.... ############################ #usr/bin/perl fun; sub fun { print "hi this is from perl\n"; }... (1 Reply)
Discussion started by: sarwan
1 Replies

2. AIX

Using the passwdpolicy() subroutine.

Okay, so in AIX, there are various subroutines that is built in to the OS. The subroutine is I want to use is passwdpolicy(). So I want to construct a C program that will be able to pass credentials into the program and thusly into the subroutine. I'm not asking for homework, or for someone to... (0 Replies)
Discussion started by: syndex
0 Replies

3. Programming

Subroutine Hung

Hi friends I am Administrator for a system works with uinx OS but, many times I get messages from server console inform me about Subroutine is Hanging so what can I do to reset this Subroutine? Note: always when I got that I restart the server but I think that is not professional solution. (3 Replies)
Discussion started by: bintaleb
3 Replies

4. Shell Programming and Scripting

calling perl subroutine from perl expect module

All, Is it possible to call a subroutine from the perl expect module after logging to a system that is within the same program. My situation is I need to run a logic inside a machine that I'm logging in using the expect module, the logic is also available in the same expect program. Thanks,... (5 Replies)
Discussion started by: arun_maffy
5 Replies

5. Programming

gfortran compiling problem,calling too many arguments

Hello, My problem is with compiling a program modelling shallow water. In it there is a subroutine called stat with 9 parameters. In the main program it is called with 9 parameters also I'm running Ubuntu 11.04 with gfortran version 4.5. Thanks. ---------- Post updated at 11:57 PM... (0 Replies)
Discussion started by: b_franz
0 Replies

6. UNIX for Dummies Questions & Answers

Help with Subroutine

Okay I have a 1TB drive that is almost completely full with vids. I am in the process of converting them to mp4. I have two scripts right now. One is a shell script to convert them with Handbrake. The other is a script to get a sort of progress report. To make things easier to understand, I will... (0 Replies)
Discussion started by: Dalton63841
0 Replies

7. Shell Programming and Scripting

Calling perl subroutine from shell script (sh)

Hi, ive a perl script, where it has a subroutine clear() in it, and i've one shell script which runs in background, from that shell script i wanted to call subroutine which is in perl script, that's perl script is not module, just simple script. Eg: perl script <test> #!... (4 Replies)
Discussion started by: asarunkumar
4 Replies

8. Shell Programming and Scripting

How to accept arguments in shell script when calling in perl

I have a shell script like this: #!/bin/sh $PYTHON MetarDecoder.py < ../data/mtrs/arg1/arg2 And I'm calling it with this in perl: my $output = `./metar_parse.sh --options`; It's successful when I put in actual values for arg1 and arg2 in the shell script, but I'd like to pass arguments... (1 Reply)
Discussion started by: civilsurfer
1 Replies

9. Shell Programming and Scripting

calling a perl script with arguments from a parent perl script

I am trying to run a perl script which needs input arguments from a parent perl script, but doesn't seem to work. Appreciate your help in this regard. From parent.pl $input1=123; $input2=abc; I tried calling it with system("/usr/bin/perl child.pl $input1 $input2"); and `perl... (1 Reply)
Discussion started by: grajp002
1 Replies

10. Shell Programming and Scripting

perl -Calling the Subroutine Only if the condition is met

Hello All, I am in the process of learning perl.I have a perl script and based on the arguments passed it would the appropriate subroutine that is defined in the script. Now, I need to check a value that is defined in the Environment variables and should call the subroutine only if the... (1 Reply)
Discussion started by: filter
1 Replies
Monkey::Patch(3pm)					User Contributed Perl Documentation					Monkey::Patch(3pm)

NAME
Monkey::Patch - Scoped monkeypatching (you can at least play nice) VERSION
version 0.03 SYNOPSIS
use Monkey::Patch qw(:all); sub some_subroutine { my $pkg = patch_class 'Some::Class' => 'something' => sub { my $original = shift; say "Whee!"; $original->(@_); }; Some::Class->something(); # says Whee! and does whatever undef $pkg; Some::Class->something(); # no longer says Whee! my $obj = Some::Class->new; my $obj2 = Some::Class->new; my $whoah = patch_object $obj, 'twiddle' => sub { my $original = shift; my $self = shift; say "Whoah!"; $self->$original(@_); }; $obj->twiddle(); # says Whoah! $obj2->twiddle(); # doesn't $obj->twiddle() # still does undef $whoah; $obj->twiddle(); # but not any more SUBROUTINES
The following subroutines are available (either individually or via :all) patch_package (package, subname, code) Wraps "package"'s subroutine named <subname> with your <code>. Your code recieves the original subroutine as its first argument, followed by any arguments the subroutine would have normally gotten. You can always call the subroutine ref your received; if there was no subroutine by that name, the coderef will simply do nothing. patch_class (class, methodname, code) Just like "patch_package", except that the @ISA chain is walked when you try to call the original subroutine if there wasn't any subroutine by that name in the package. patch_object (object, methodname, code) Just like "patch_class", except that your code will only get called on the object you pass, not the entire class. HANDLES
All the "patch" functions return a handle object. As soon as you lose the value of the handle (by calling in void context, assigning over the variable, undeffing the variable, letting it go out of scope, etc), the monkey patch is unwrapped. You can stack monkeypatches and let go of the handles in any order; they obey a stack discipline, and the most recent valid monkeypatch will always be called. Calling the "original" argument to your wrapper routine will always call the next-most-recent monkeypatched version (or, the original subroutine, of course). BUGS
This magic is only faintly black, but mucking around with the symbol table is not for the faint of heart. Help make this module better by reporting any strange behavior that you see! perl v5.10.1 2010-07-16 Monkey::Patch(3pm)
All times are GMT -4. The time now is 04:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy