Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

Tracing the source of an imported subroutine

Inserting use Devel::Peek qw( ); BEGIN { Devel::Peek::Dump(&foo); } before the line that gives the warning will tell you which package (COMP_STASH) and file name (FILE).

A solution that also gets you the line number is possible. The function's opcode tree could be walked until a nextstate is found (which is probably the very first op of the tree). The file name and line number can be extracted from the op. nextstate ops set the file and line number issued by runtime warnings.


  • #line directives affect both solutions.

  • If a module exports an imported sub, both solution would give the original package and file of origin, not of the intermediary.

Categories : Perl

Related to : Tracing the source of an imported subroutine
Perl: Returning hashref from subroutine
You are returning the value to which a foreach evaluates (by virtue of being the last statement of the sub). It's not surprising that's not a reference. &get_starting_point($$config{$key}{dependencies}); should be my $rv = get_starting_point($config->{$key}{dependencies}); return $rv if $rv; And add return undef; at the end rather than relying on foreach to return something false. su

Categories : Perl
TASM extra characters when calling subroutine
call only takes a single operand, the address of the subroutine. You need to pass arguments by hand, according to whatever convention tasm uses if you declare a proc like you did. Assuming it uses the usual stack based convention, you will need something like: push offset msg_description call print_msg add sp, 2 ; remove argument if called proc doesn't end with `ret 2`

Categories : Assembly
How can I create a Perl subroutine that accepts more than one block?
works for me... sub example2 { my $code_ref = shift; my $code_ref2 = shift; $code_ref->(); $code_ref2->(); } example2 ( sub { print "One " }, sub { print "Hello " }); Just for the purposes of TMTOWTDI here is a method that works in somewhat the way that the OP requested First, make a source filter package poop; use Filter::Util::Call; sub import { my ($type) = @_;

Categories : Perl
Perl: How to pass a 2-dimensional array to a subroutine?
You did a shallow copy of @empty_profile, but as every element of it is array reference, make copy of them as well, so original values don't get altered, my @p = map [ @$_ ], @{$_[1]};

Categories : Arrays
Linux sends a packet from a source IP of one interface but a source MAC of another
This isn't what you asked for, but if you just set up a cron job on the box that did ping -c 1 -I eth1 <address of eth1's default gateway> every minute, then you would have at least one packet per minute leaving eth1 with eth1's MAC address on it. -I tells ping to bind to a specific interface, so it won't use eth0 even if that's the preferred route.

Categories : Linux
Recently Add
unable to connect selenium webDriver through perl bindings
SSL error calling Perl web service via https using LWP
SOAP::Lite always faults in debug mode
perl referencing a hash outside of the scope that populated it (histogram)
Perl script to print out all the lines containing a keyword and the line below it
PERL Unicode Escape string pass from command line argument wrong output
Perl process crashes after handling signal
Marpa: Can I explicitly disallow keywords as identifiers?
Perl: Import text, containing ÅÄÖ, from file
error using perl - Proc::ProcessTable. works in cmd line, not in .pl file
DBIx::Class chaining resultsets with same table in prefetch
Time as input, print timetable in Perl
compare values of different tables perl
Automatically increasing ID generation using PERL
Syntax Error, first line after dostuff
Delete files in a folder using Perl
Perl '-d' operator is not detecting a directory
Perl appending text to new line
write_timeout in IO::Socket::Timeout
Using ForkManager and Perl properly?
Is a cyclic dependency solved with require?
Posting metric to google analytics from perl script
How can I check if a user enters my page the first time?
Sorting arrays of intervals in perl?
Perl: How to get the link target of a soundcloud feed mp3
Uninitialized value in concatenation
Perl code - pipe "|" in `open()` statement
perl command line backticks with matrix
Perl OO - Creating a list of objects
extract gene-id + function annotation from .gff
© Copyright 2017 Publishing Limited. All rights reserved.