10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a fortran file with code declarations such as
Subroutine str_tnum_tu &
( &
s, dl, tu, pos &
)
!
Class (*), Intent (InOut) :: tu(:)
Character (Len=*), Intent (In) :: s, dl
Character (Len=*), Intent (In), Optional :: pos
...
or
... (11 Replies)
Discussion started by: kristinu
11 Replies
2. Programming
Hi everyone,
I have given up finally trying to find a way to do this.
I have a subroutine called LoginFirst where I am starting a new SSH session.
I have bunch of subroutines, each one of them uses a (or I have to create
a new SSH constructor everytime) ssh connection to get some value so ... (2 Replies)
Discussion started by: dummy_code
2 Replies
3. UNIX for Dummies Questions & Answers
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
4. Shell Programming and Scripting
So, I'm running a script with a couple of subroutines, one of which takes arguments using getopts. The first time i call the subroutine everything works as expected, the second time I call it none of the arguments change. Here's a small section of code that shows this behavior.
#!/bin/sh... (3 Replies)
Discussion started by: dhibbit
3 Replies
5. Shell Programming and Scripting
Hi All
I am new to perl so had one question.
I have one Subroutine which works as expected and below is just an example.
where I ran a command and check the output.
so my question is if I have more than one command then how to check the results, meaning I want to add more command and check... (2 Replies)
Discussion started by: tannu
2 Replies
6. Programming
Hi everyone,
I'm not new to C programming, but I'm having question regarding the memory allocation of a pointer variable which, for instance, will be declared in main(), but its memory will be allocated in subroutine.
To clearify my question, I provide a small working example:
#include... (1 Reply)
Discussion started by: MIB_Maik
1 Replies
7. Shell Programming and Scripting
Hello,
I am having problem calling a subroutine with arguments, can any help? is the approach I am using correct?
main()
{
# This is just a subset of the code
#$b & $lnum is already define in this section of the code
checkboard $b $lnum
}
checkboards()
{
ln=$lnum... (2 Replies)
Discussion started by: jermaine4ever
2 Replies
8. Shell Programming and Scripting
Hi,
I can't get this script ot work and I wa wondering if anyone could help?
I need to open a file and use a subroutine to search each line for a regular expression. If it matches then I need to return a match from the subroutine and print the result?
Any help would be greatly... (11 Replies)
Discussion started by: jmd2004
11 Replies
9. Programming
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
10. UNIX for Dummies Questions & Answers
I have something like
cp -p <dir>filename1.dat <dir2>filename1.dat
there are many other operations in it
I mean that filename1.dat will keep on changing
I need to write a subroutine so that i can pass filename1 or 2 or 3 .dat as parameter
Thanking you in advance
Any help wuld be appreciated (2 Replies)
Discussion started by: ssuresh1999
2 Replies
Test::MockModule(3pm) User Contributed Perl Documentation Test::MockModule(3pm)
NAME
Test::MockModule - Override subroutines in a module for unit testing
SYNOPSIS
use Module::Name;
use Test::MockModule;
{
my $module = new Test::MockModule('Module::Name');
$module->mock('subroutine', sub { ... });
Module::Name::subroutine(@args); # mocked
}
Module::Name::subroutine(@args); # original subroutine
DESCRIPTION
"Test::MockModule" lets you temporarily redefine subroutines in other packages for the purposes of unit testing.
A "Test::MockModule" object is set up to mock subroutines for a given module. The object remembers the original subroutine so it can be
easily restored. This happens automatically when all MockModule objects for the given module go out of scope, or when you "unmock()" the
subroutine.
METHODS
new($package[, %options])
Returns an object that will mock subroutines in the specified $package.
If there is no $VERSION defined in $package, the module will be automatically loaded. You can override this behaviour by setting the
"no_auto" option:
my $mock = new Test::MockModule('Module::Name', no_auto => 1);
get_package()
Returns the target package name for the mocked subroutines
is_mocked($subroutine)
Returns a boolean value indicating whether or not the subroutine is currently mocked
mock($subroutine => &coderef)
Temporarily replaces one or more subroutines in the mocked module. A subroutine can be mocked with a code reference or a scalar. A
scalar will be recast as a subroutine that returns the scalar.
The following statements are equivalent:
$module->mock(purge => 'purged');
$module->mock(purge => sub { return 'purged'});
$module->mock(updated => [localtime()]);
$module->mock(updated => sub { return [localtime()]});
However, "undef" is a special case. If you mock a subroutine with "undef" it will install an empty subroutine
$module->mock(purge => undef);
$module->mock(purge => sub { });
rather than a subroutine that returns "undef":
$module->mock(purge => sub { undef });
You can call "mock()" for the same subroutine many times, but when you call "unmock()", the original subroutine is restored (not the
last mocked instance).
original($subroutine)
Returns the original (unmocked) subroutine
unmock($subroutine [, ...])
Restores the original $subroutine. You can specify a list of subroutines to "unmock()" in one go.
unmock_all()
Restores all the subroutines in the package that were mocked. This is automatically called when all "Test::MockObject" objects for the
given package go out of scope.
SEE ALSO
Test::MockObject::Extends
Sub::Override
AUTHOR
Simon Flack <simonflk _AT_ cpan.org>
COPYRIGHT
Copyright 2004 Simon Flack <simonflk _AT_ cpan.org>. All rights reserved
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
perl v5.10.0 2005-03-24 Test::MockModule(3pm)