This will receive the argument passed when the object creation and associate this to that class, when you bless.
Code:
$cup = new Cocoa(1,2,3); # you can even pass the data from main program and that will be updated in doInitialization().
Just FYI.
We can even create object with the below syntax.
$cup = Cocoa->new(1,2,3);
'my' variables are not accessible unless you blessed to your object or make that variable to 'our'. But 'our' variables exist through out the program and occupy some memory space.
So, If you want you program to be more optimized, you should return the objects(variables/hash/array) from you function to the main program and use from there.
All
Please help me to call url in Perl. Ex:
http://www.test.com/dynf?urn=123
Assume it will return success if 123 is in urn or it will return " failed".
I want store this return type in a variable.
Please help me to call the URL through PERL.
Thanx in advance
Regards
Deepak (1 Reply)
Hi all,
Not sure if this is the right forum to post query regarding perl script.
I have a perl script which internally calls a shell script. My problem is that the shell script should be passed command line arguments.
I call a shell script from perl using:
system("sript.sh");
How do... (3 Replies)
Hi,
I would like to invoke "Winzip" utility from a perl script, input the name of zip file and provide output path for unzipped files. Any pointers will be appreciated.
Thanks (5 Replies)
Hi,
I am trying to execute a perl script from c program.
I tried using system command.
system("perl test.pl filename") ;
This perl program takes filename as input and prints a number
to screen.
I need to get that returned number in C program.
system command is... (3 Replies)
Hi ,
Here is my piece of code--
main();
sub main
{
$result = GetOptions ("LogDir=s" => \$LogDir,
"Summary" => \$Summary,
"Indiviual=s" => \$Individual ,
"Diagnostics=s" => \$Diagnostics,
... (1 Reply)
On bash I run precompiled c Program as follows:
./create_cust 1 10000 US S > us_cust.csv
create_cust is a c program and requires 4 parameters.
I am redirecting the output of this program to csv file
I need to run this same program in perl
I am aware of exec command though not... (7 Replies)
hi all,
I have 3 perl scripts a.pl,b.pl and c.pl
each of these work when i pass a date for eg: perl c.pl 2010-05-27
now i want to write a perl script that would call the 3 scripts and make it run all the 3 scripts (a.pl,b.pl,c.pl) parallelly rather than 1 after the other.......
pls... (2 Replies)
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)
Can anyone break down the different methods of using SSH in perl? I'm currently using Net::SSH::Expect, which allows me to login to a machine and execute multiple commands without having to ssh again. This feature of holding the session works well for me, but it's slow. If I set timeouts to 4... (3 Replies)
Note: Not a programmer by profession but occasionally have to program.
I am looking for general methods and freely/readily available tools employed to debug problems during development of perl scripts. Anything that has really helped you out with problems you just couldn't find.
A couple of... (5 Replies)
Discussion started by: Vi-Curious
5 Replies
LEARN ABOUT DEBIAN
data::dump::filtered
Data::Dump::Filtered(3pm) User Contributed Perl Documentation Data::Dump::Filtered(3pm)NAME
Data::Dump::Filtered - Pretty printing with filtering
DESCRIPTION
The following functions are provided:
add_dump_filter( &filter )
This registers a filter function to be used by the regular Data::Dump::dump() function. By default no filters are active.
Since registering filters has a global effect is might be more appropriate to use the dump_filtered() function instead.
remove_dump_filter( &filter )
Unregister the given callback function as filter callback. This undoes the effect of add_filter.
dump_filtered(..., &filter )
Works like Data::Dump::dump(), but the last argument should be a filter callback function. As objects are visited the filter callback
is invoked at it might influence how objects are dumped.
Any filters registered with add_filter() are ignored when this interface is invoked. Actually, passing "undef" as &filter is allowed
and "dump_filtered(..., undef)" is the official way to force unfiltered dumps.
Filter callback
A filter callback is a function that will be invoked with 2 arguments; a context object and reference to the object currently visited. The
return value should either be a hash reference or "undef".
sub filter_callback {
my($ctx, $object_ref) = @_;
...
return { ... }
}
If the filter callback returns "undef" (or nothing) then normal processing and formatting of the visited object happens. If the filter
callback returns a hash it might replace or annotate the representation of the current object.
Filter context
The context object provide methods that can be used to determine what kind of object is currently visited and where it's located. The
context object has the following interface:
$ctx->object_ref
Alternative way to obtain a reference to the current object
$ctx->class
If the object is blessed this return the class. Returns "" for objects not blessed.
$ctx->reftype
Returns what kind of object this is. It's a string like "SCALAR", "ARRAY", "HASH", "CODE",...
$ctx->is_ref
Returns true if a reference was provided.
$ctx->is_blessed
Returns true if the object is blessed. Actually, this is just an alias for "$ctx->class".
$ctx->is_array
Returns true if the object is an array
$ctx->is_hash
Returns true if the object is a hash
$ctx->is_scalar
Returns true if the object is a scalar (a string or a number)
$ctx->is_code
Returns true if the object is a function (aka subroutine)
$ctx->container_class
Returns the class of the innermost container that contains this object. Returns "" if there is no blessed container.
$ctx->container_self
Returns an textual expression relative to the container object that names this object. The variable $self in this expression is the
container itself.
$ctx->object_isa( $class )
Returns TRUE if the current object is of the given class or is of a subclass.
$ctx->container_isa( $class )
Returns TRUE if the innermost container is of the given class or is of a subclass.
$ctx->depth
Returns how many levels deep have we recursed into the structure (from the original dump_filtered() arguments).
Filter return hash
The following elements has significance in the returned hash:
dump => $string
incorporate the given string as the representation for the current value
object => $value
dump the given value instead of the one visited and passed in as $object. Basically the same as specifying "dump =>
Data::Dump::dump($value)".
comment => $comment
prefix the value with the given comment string
bless => $class
make it look as if the current object is of the given $class instead of the class it really has (if any). The internals of the object
is dumped in the regular way. The $class can be the empty string to make Data::Dump pretend the object wasn't blessed at all.
hide_keys => ['key1', 'key2',...]
hide_keys => &code
If the $object is a hash dump is as normal but pretend that the listed keys did not exist. If the argument is a function then the
function is called to determine if the given key should be hidden.
SEE ALSO
Data::Dump
perl v5.12.4 2011-09-28 Data::Dump::Filtered(3pm)