Hi All,
How do i know the full name of a variable from its reference??.
Say i have a routine defined like this:
package Bar;
sub foo {};
And then i say:
my $x = \&foo;
Now from this coderef ($x) i want to know its fully qualified name which would be
somthing like Bar::Foo.
Is there a way to
6:23 PM
> To: Gupta, Sharad
> Cc: [EMAIL PROTECTED]
> Subject: Re: FQN from references
>
>
> Gupta, Sharad wrote:
> > Hi All,
> >
> > How do i know the full name of a variable from its reference??.
> >
> > Say i have a routine defined like this:
>
ns d'Anconia
> Cc: Gupta, Sharad; [EMAIL PROTECTED]
> Subject: Re: FQN from references
>
>
> On Wed, Oct 22, 2003 at 08:22:47PM -0500, Wiggins d'Anconia wrote:
> > Gupta, Sharad wrote:
> >> Now from this coderef ($x) i want to know its fully qualified name
&
it somehow, why to make it mandatory in the interface.
-Sharad
> -Original Message-
> From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, October 22, 2003 8:53 PM
> To: Gupta, Sharad
> Cc: [EMAIL PROTECTED]
> Subject: Re: FQN from references
&
I guess by extension you mean that you are trying to subclass a module. In that case
you would need to inherit from that parent class with something like:
our @ISA = qw(ParentClass)
or
use base qw(ParentClass)
Then you can call the methods of the parent class on the instances of this subclass
Maybe OT. But just curious. What do the experts say about exporting function from OO
modules??.
Everytime i need something like this, i end up making those functions as Class methods.
-Sharad
> -Original Message-
> From: Dan Muey [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, October 29, 2
While running this:
my $new = "/newtests/new ";
$new .= "\'$fields{public}\' \'$fields{sev}\' \'$fields{pri}\' ";
$new .= "\'$fields{cc}\' \'$fields{bug_rel}\' \'$fields{type}\' ";
$new .= "\'$fields{title}\' \'$fields{description}\' \'$fields
Rather i should say:
It died in the below qx with this error:
Illegal seek at ././job.pl line 316
-Sharad
-Original Message-
From: Gupta, Sharad
Sent: Friday, June 06, 2003 11:52 AM
To: [EMAIL PROTECTED]
Subject: RE: Illegal seek
While running this:
my $new
Hi All,
I was looking for a pointer on the web to understand them, something like a tutorial.
Any help is appreciated.
Thanx,
-Sharad
R. Joseph Newton [mailto:[EMAIL PROTECTED]
Sent: Friday, June 06, 2003 10:42 PM
To: Gupta, Sharad
Cc: [EMAIL PROTECTED]
Subject: Re: Illegal seek
"Gupta, Sharad" wrote:
> While running this:
>
> my $new = "/newtests/new ";
> $new .= &q
One way:
To find out elements which are in test2 and not in test1:
#!-*-perl-*-
use strict;
my @test1 = qw(1 2 3 4);
my @test2 = qw(1 2 5 6 7 8);
foreach my $element(@test2) {
print $element if([EMAIL PROTECTED]);
}
-Sharad
-Original Message-
From: Boon Chong Ang [mailto:[EM
t what u are trying to do with every
element of @modify??
Thanx,
-Sharad
-Original Message-
From: Boon Chong Ang [mailto:[EMAIL PROTECTED]
Sent: Saturday, June 14, 2003 1:38 AM
To: Gupta, Sharad; [EMAIL PROTECTED]
Subject: RE: compare, checking and listing
Hi,
This is the scrip
just yesterday i used:
pod2html.
Seems to work good.
-Sharad
-Original Message-
From: Jeff Westman [mailto:[EMAIL PROTECTED]
Sent: Friday, June 20, 2003 11:34 AM
To: beginners
Subject: perldoc - html format ?
Hi,
Is it possible to reformat a perldoc in HTML format?
I don't see this a
> my $random_key = ( keys %tips )[ rand keys %tips ];
> Can anyone parse this line for me?
Picking up a random key from the keys of a hash.
see perldoc -f rand
>>One more thing - I don't seem to have perldoc installed, I simply look up
>>the functions in the info node `perlfunc'. Am I missing
Somewhere in the "perldoc -f exists" i read:
Although the deepest nested array or hash will not
spring into existence just because its existence was
tested, any intervening ones will. Thus
Something like this worked for me in the past:
use strict;
use IO::Socket::INET;
my $sock = IO::Socket::INET();
while(1) {
my $output;
my $n = sysread($sock,$output,1000);
last if(!defined($n));
print STDOUT $output;
}
And using syswrite() for writing.
perldo
try doing this:
sub {
while ...
}
Look for the removed "()" around the declaration for sub, and u won't tell the sub
that it takes no arguments.
-Sharad
-Original Message-
From: Jeff Westman [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 24, 2003 3:23 PM
To: beginners
Subject: R
Sorry for the mistake. It should look like:
sub parse {
while ..
}
-Sharad
-Original Message-
From: Gupta, Sharad
Sent: Tuesday, June 24, 2003 5:58 PM
To: Jeff Westman; beginners
Subject: RE: Reading from STDIN from a pipe
try doing this:
sub {
while ...
}
Look for
quot;.
-Sharad
-----Original Message-
From: Gupta, Sharad
Sent: Monday, June 23, 2003 3:36 PM
To: 'McMahon, Christopher x66156'; [EMAIL PROTECTED]
Subject: RE: basic question: handling input to TCP/IP server
Something like this worked for me in the past:
use strict;
use IO::S
Did open ever succeeded??
Check with:
open(FILE,">>$logfile") or die "$!";
-sharad
-Original Message-
From: Scott, Joshua [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 24, 2003 11:13 PM
To: [EMAIL PROTECTED]
Subject: File Handles in subroutines
What do I need to do in order t
My first guess is that '.' being a metacharacter u would need to escape it somehow.
something like this:
foreach my $filter_key(@FFW) {
$filter_key = quotemeta($filter_key);
}
-Sharad
-Original Message-
From: LI NGOK LAM [mailto:[EMAIL PROTECTED]
Sent: Sunday, June
>From ur example i assume that:
my @order is an array collecting all of the objects with each order.
So, instead of
my @order = new miva_order;
we mean to say:
my @orders;
my $obj = new miva_order;
$obj->order_number(get_order_num_via_regex());
push @orders,$obj;
for (my $w=0;$w<=$#orders;$w
Instead of:
print "obj:$obj->order_number($order_num)\n";
Try:
print "obj: " . $obj->order_number($order_num) . "\n";
If u use a reference as a string it would give its reference type, the package and the
location.
-sharad
-Original Message-
From: Trevor Morrison [mailto:[EMAIL PROT
If i get it right, ur structure looks like:
my $ref = {
key1 => [qw(v1 v2...)],
key2 => ...
};
one can do.
foreach my $key(keys %$ref) {
print "$key: @{$ref->{$key}}\n";
}
-sharad
-Original Message-
From: Gene Mat [mailto:[EMAIL P
I think u would need the "grep" function here instead of "map".
Map returns the results of the evaluation of expression which is '1' in ur case
because u matched.
Grep returns the actual elements of the list for which the expression was true.
try:
my @ptrRecords = grep{/.*\s+PTR\s+.*/[EMAIL PRO
$! is the oserror.
$@ contains the exceptions thrown by eval.
Eg:
use strict;
my $out = get_list();
if($@) {
print "Could not get the list: $@";
}
sub get_list {
# If we die return the error set in [EMAIL PROTECTED]
eval {
# If we are unabl
perldoc -q "How can i convert my shell script to perl"
-Sharad
-Original Message-
From: thyagarajan k [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 09, 2003 6:00 AM
To: [EMAIL PROTECTED]
Subject: convertion bash script to perl
Hello friends,
i am quite new to perl and currently i hav
Hi Friends,
I have a hash whose values can be either array, hash etc.
say i have:
my $self = {
'hello how' => {
'r u' => 'I am',
Aha! Thanx to all for help.
I did'nt realized i can do it like this yesterday. So i created a small routine and
passed the keys through it at the time of creation itself.
I'll try it.
Thanx,
-Sharad
-Original Message-
From: Rob Dixon [mailto:[EMAIL PROTECTED]
Sent: Friday, July 11, 200
Hello Friends,
I have always been on Unix and perl. Now i wanted to port some of my scripts to
Windows.
Any pointers to web/books for understanding the implications is appreciated??
TIA,
-Sharad
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Ok, Let me try to put it the other way.
Any good books on how to learn perl on windows??.
Thanx,
-Sharad
-Original Message-
From: Gupta, Sharad
Sent: Wednesday, July 16, 2003 12:41 PM
To: [EMAIL PROTECTED]
Subject: Porting perl scripts on windows
Hello Friends,
I have always been
Hi,
I have a path which may look like:
UNIX:
-
PATH=/usr/local/share:/usr/local:...
Where each path is seperated by ":".
Windows:
--
PATH=E:\foo:D:\bar
Again the path seperated by ":". ( I cannot change the seperator )
How can i split the path on ":" which gives m
PROTECTED]
Sent: Saturday, August 02, 2003 3:12 PM
To: Gupta, Sharad
Cc: [EMAIL PROTECTED]
Subject: Re: Splitting a path
It was Saturday, August 02, 2003 when Gupta, Sharad took the soap box, saying:
:
: Hi,
:
: I have a path which may look like:
use Env [EMAIL PROTECTED];
print "$_\
s it would print the whole Foo instead of printing 2 elements C:\foo\bar and
D:\foo\bar, because the $Config::Config(path_sep) is not ":" on windows.
-Sharad
> -Original Message-
> From: Steve Grazzini [mailto:[EMAIL PROTECTED]
> Sent: Saturday, August 02, 2003 4
Yep, the "require" doc says that clearly. I should have read it first before posting.
Just got things working ;)
-Sharad
-Original Message-
From: Bob Showalter [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 06, 2003 6:00 PM
To: Gupta, Sharad; [EMAIL PROTECTED]
Subject
Hi All,
I have a path like:
$s = "http::/foo/bar:http::/foo1/bar1:http/foo1/bar1";
I am trying to get all the http paths which are seperated by ":" like this:
@x = ($s =~ /(http::.*?):(?=http::.*?)/g)
The problem is i get all the elements in @x except the last one.
Where is that??.
-Sharad
ect itself. (Note that you must fully qualify the
sub's name, as it is always forced into package main.)
Thanx,
-Sharad
-Original Message-
From: Steve Grazzini [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 09, 2003 1:51 PM
To: Gupta, Sharad
Cc: [EMAIL PROTECTED]
Subject: Re: Ok
.
-Sharad
-Original Message-
From: Ramprasad [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 09, 2003 12:41 AM
To: Gupta, Sharad
Cc: [EMAIL PROTECTED]
Subject: Re: Tracing Subs
Sharad Gupta wrote:
> Hi All,
>
> I have a bunch of scripts which calls a sub from a module, and that
Hi All,
I have a bunch of scripts which calls a sub from a module, and that module in turn
would call another sub from someone else and so on. Skimming through them is driving
me crazy.
Is there a way i can trace the calling of the routines till N levels.
TIA,
-Sharad
In the @x i am expecting to get all the http paths just like u showed in ur example.
This should work fine.
Thanx,
-Sharad
-Original Message-
From: Todd W. [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 06, 2003 9:32 PM
To: [EMAIL PROTECTED]
Subject: Re: Look Ahead
"Sharad Gupta
Hi All,
I am really tired now:
--
package Foo;
use strict;
use LWP::UserAgent;
sub new {
return bless {},shift;
}
sub Foo::INC {
my ($self,$filename) = @_;
my @paths = "http:/me.com";
my @urls = map{$_ . "/" . [EMAIL PROTECT
And now my script looks like:
-
#!/usr/local/bin/perl
use Foo;
use Bar;
---
And it works!! -:).
Please let me know for if u have better ideas.
Thanx,
-Sharad
-----Original Message-
From: Gupta, Sharad
Sent: Friday, August 08, 2003 10:50 PM
To: [E
Ur examples are cool. I never knew i can do that.
But my problem was:
I was trying to port some of my scripts to Windows.
I know i can get all of the modules which my already written scripts would be
using via http. And i did'nt wanted to map the drive on *all* the windows mach
Ok all I/O works with this filehandle, but seems like require don't like it.
Any ideas why??.
-Sharad
-Original Message-
From: Gupta, Sharad
Sent: Sunday, August 10, 2003 12:59 PM
To: Steve Grazzini
Cc: [EMAIL PROTECTED]
Subject: RE: Ok I am tired
>> IO::Stringy (non-core
7;t find the module.
-Sharad
-Original Message-
From: Steve Grazzini [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 09, 2003 10:32 PM
To: Gupta, Sharad
Cc: [EMAIL PROTECTED]
Subject: Re: Ok I am tired
On Sat, Aug 09, 2003 at 08:57:54PM -0700, Gupta, Sharad wrote:
>> You're s
Hi All,
Can i have something like "http:://Somepath"
in @INC.
-Sharad
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hi All,
I have a small script like this:
---
use strict;
use Net::Telnet;
my $host = "Wilma";
my $username = "Foo";
my $pass = "Bar";
my $s = Net::Telnet->new( Host=>$host,
input_log => "input_log",
I am sure somebody would have a magical touch for me.
-Sharad
-Original Message-
From: Gupta, Sharad
Sent: Saturday, August 16, 2003 9:03 PM
To: [EMAIL PROTECTED]
Subject: Net::Telnet
Hi All,
I have a small script like this
Thanx a lot for replying.
I am telnetting from a windows machine to a unix machine.
Comparing the installations seems to be an idea. I'll also try from the XP machine.
Thanx again,
-Sharad
>-Original Message-
>From: Rob Dixon [mailto:[EMAIL PROTECTED]
>Sent: Sunday, August 24, 2003
Hi all,
Any ideas on how do i send an interrupt signal to the connection made via Net::Telnet.
Thanx,
-Sharad
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hi Friends,
Any suggestions on how one can map usernames between unix/windows machines.
Eg:
Administrator->root
Any modules/thoughts??.
-Sharad
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hi All,
I remember i read somewhere about some limitations of Net::SSH::Perl on
windows systems particularly something about 5.8
but can't find the link now.
Can anybody point me to it without much effort.??
Thanx,
-Sharad
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional command
Hi ALL,
I know i am missing something somewhere:
perl -e '
package Foo;
use overload q("") => sub {return shift->{bar}};
$s = bless{bar=>"hello"}, Foo;
print "$s\n"
'
prints "hello".
Whereas:
perl -e '
Thank you.
-Sharad
-Original Message-
From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]
Sent: Monday, September 22, 2003 10:20 PM
To: Gupta, Sharad
Cc: [EMAIL PROTECTED]
Subject: Re: Silly question
On Sep 22, Gupta, Sharad said:
> package Foo;
>
Hi All,
Say i give one of my application to a customer. The customer runs it and finds a bug
in there.
I don't want to give a fixed application again to the customer and ask him to go
through the pain of installing it again.
Instead i create a patch and tell customer to install that patch.
Hi All,
I am sure people must be doing that regularly.
How do i package my Application to give to the customer??.
Like creating packages for different platforms linux, debian, sun, windows etc.
Any pointers would be greatly appreciated.
Thanx,
-Sharad
--
To unsubscribe, e-mail: [EMAIL PROTE
56 matches
Mail list logo