Aspect::Advice::After(3pm) User Contributed Perl Documentation Aspect::Advice::After(3pm)NAME
Aspect::Advice::After - Execute code after a function is called
SYNOPSIS
use Aspect;
after {
# Trace all returning calls to your module
print STDERR "Called my function " . $_->sub_name . "
";
# Suppress exceptions AND alter the results to foo()
if ( $_->short_name eq 'foo' ) {
if ( $_->exception ) {
$_->return_value(1);
} else {
$_->return_value( $_->return_value + 1 );
}
}
} call qr/^ MyModule::w+ $/
DESCRIPTION
The "after" advice type is used to execute code after a function is called, regardless of whether or not the function returned normally or
threw an exception.
The "after" advice type should be used when you need to potentially make multiple different changes to the returned value or the thrown
exception.
If you only care about normally returned values you should use "returning" in the pointcut to exclude join points occuring due to
exceptions.
If you only care about handling exceptions you should use "throwing" in the pointcut to exclude join points occuring due to normal return.
AUTHORS
Adam Kennedy <adamk@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2010 Adam Kennedy.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-02-01 Aspect::Advice::After(3pm)
Check Out this Related Man Page
Aspect::Advice::Before(3pm) User Contributed Perl Documentation Aspect::Advice::Before(3pm)NAME
Aspect::Advice::Before - Execute code before a function is called
SYNOPSIS
use Aspect;
before {
# Trace all calls to your module
print STDERR "Called my function " . $_->sub_name . "
";
# Shortcut calls to foo() to always be true
if ( $_->short_name eq 'foo' ) {
return $_->return_value(1);
}
# Add an extra flag to bar() but call as normal
if ( $_->short_name eq 'bar' ) {
$_->args( $_->args, 'flag' );
}
} call qr/^ MyModule::w+ $/
DESCRIPTION
The "before" advice type is used to execute advice code prior to entry into a target function. It is implemented by Aspect::Advice::Before.
As well as creating side effects that run before the main code, the "before" advice type is particularly useful for changing parameters or
shortcutting calls to functions entirely and replacing the value they would normally return with a different value.
Please note that the "highest" pointcut (Aspect::Pointcut::Highest) is incompatible with "before". Creating a "before" advice with a
pointcut tree that contains a "highest" pointcut will result in an exception.
If speed is important to your program then "before" is particular interesting as the "before" implementation is the only one that can take
advantage of tail calls via Perl's "goto" function, where the rest of the advice types need the more costly Sub::Uplevel to keep caller()
returning correctly.
AUTHORS
Adam Kennedy <adamk@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2010 Adam Kennedy.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-02-01 Aspect::Advice::Before(3pm)
I needed some advice,
I've been a Microsoft Web Developer/Database guy for the last few years.
What do I need to do to get an entry-level Unix Administrator job??
Where should I start to learn Unix??
Do you agree that there still seems to be a great need for Unix Admin. people?
I... (2 Replies)
Dear All,
I have finished my MS in chemical engineering from US university and presetly on OPT work permit.
I do not have software background.
I have received call from consultant company.
They are offering me AIX UNIX training for four weeks and find me a job.
My question is how difficuilt... (5 Replies)
I would like some advice on how to logically put together a script to handle a daily task of data gathering for the following problem.
I have two files, file1 has 125,000 records that I cut and remove unwanted fields through scripts and cron. In file2, I have 25000 records that has the same... (4 Replies)
The Web-based contact form on my site has been under distributed spamming attacks for nearly a month already. Obviously, a spammer has tried to generate HTTP requests containing ads to male drugs and all sorts of similar stuff directly to the form mail processor script on my site using a robot, as... (5 Replies)
Hello, I am currently a second year university student studying amongst other subjects Unix.
I am interested in pursuing Unix into a future career, specifically as a network administrator.
I was wondering if you can provide information on how to pursue a career in Unix, i.e. what general paths... (17 Replies)
Hi all,
I need a career Advice.
About myself -- I have 2 years of work experience as a System Administrator (Linux and Solaris). I am Sun Certified System Administrator on Solaris 10.0 currently working in a MNC.
As for career growth, I am doing 3 year MBA course from distance learning,... (4 Replies)
Where to start... I am a system administrator who didn't think he would ever be one. My first work was on Window 2000 as a tech(hardware, installs, stuff like that). Then we got Macs (I work in photography and Videography). The I was sent to Mac cert school. Set up a Mac Xserve and about 100... (2 Replies)
Dear All
i am working on windows plattform and i am interested in Aix so i have done IBM Aix certification, can you please suggest Aix filed is good for my carrier,currently i am working as Desktop admin
edit by bakunin: please understand that the question you raised has nothing to do with the... (1 Reply)
Hello Folks
We have following software installed on our AIX box
X11.vfb - Virtual Frame Buffer Software
We also see its process running
root 528406 1 0 06:27:18 - 0:00 /usr/bin/X11/X -force -vfb -x abx -x dbe -x GLX :1
Following is the o/p of 'lslpp'
X11.vfb 5.3.0.50... (4 Replies)
Hello friends , this is not a thread i wanna your advice
I have good knownledge in c language and i can create test based applications
But now i wanna create Graphics application for Linux and windows
In linux , i know there is gtk programming for grahics
and in windows windows.h... (3 Replies)
Hello All,
I have one text file like below:-
================
USER_CONCURRENT_PROGRAM_NAME REQUEST_ID
----------------------------------- ----------
QFEQAP Payables Remittance Advice 29996305
How do I get only the number 29996305 from the above record.
Thanks-... (5 Replies)
We have a user where a process is behaving abnormally and crashing. It would be great if a core file was generated, but I don't see one.
user101671:/apps/ -$lscore -d
compression: on
path specification: on
corefile location: /opt/core
naming specification: off
There is no core file being... (3 Replies)
Hello Everyone,
Hope you all are doing great!
As you can see by the title on top, we are in the process of migrating alot of our servers from Power5 (physical) to Power8 (Virtual). Now it's turn for servers with HACMP Cluster on it. Let me lay out the environment like:
OLD ENVIRONMENT:
... (12 Replies)
Hi Folks -
I want to add error handling to a portion of a *.ksh, but I'm having difficulty doing so in an easily digestible way.
Essentially, I want to echo weather it was successful or unsuccessful after each command.
Here is the code I need to add error handling to:
perl... (2 Replies)