[19131] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1326 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 18 14:10:37 2001

Date: Wed, 18 Jul 2001 11:10:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <995479818-v10-i1326@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 18 Jul 2001     Volume: 10 Number: 1326

Today's topics:
        trace function calls (Gary Baker)
    Re: trace function calls (Rene Nyffenegger)
    Re: trace function calls (Anno Siegel)
    Re: Using a Perl module outside from Perl-dir? (Tad McClellan)
    Re: Using a Perl module outside from Perl-dir? <m.grimshaw@salford.ac.uk>
    Re: Using a Perl module outside from Perl-dir? (Tad McClellan)
    Re: Using a Perl module outside from Perl-dir? <m.grimshaw@salford.ac.uk>
    Re: Using a Perl module outside from Perl-dir? (Tad McClellan)
    Re: Using a Perl module outside from Perl-dir? (Anno Siegel)
    Re: Using a Perl module outside from Perl-dir? <m.grimshaw@salford.ac.uk>
        Very Simple Socket Question <noemail@noemail.com>
    Re: Very Simple Socket Question (Anno Siegel)
    Re: Very Simple Socket Question <noemail@noemail.com>
    Re: What is undump? <news@simonflack.com>
    Re: What is undump? <news@simonflack.com>
    Re: What is undump? <news@simonflack.com>
    Re: Why is var using same memory location <dersgniw@fuse.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 18 Jul 2001 06:09:31 -0700
From: bakerg@volpe.dot.gov (Gary Baker)
Subject: trace function calls
Message-Id: <3580d191.0107180509.6cf46760@posting.google.com>

I have a very large web application and would like to somehow create a list
( automatically of course ) of javascript functions with the functions they
are calling and functions that call them

something like this :

function firstFunc(x,y,z)
	calls :
		ninthFunc()
		eleventhFunc()
	called by :
		fifthFunc()
		seventhFunc()

function ninthFunc()
	calls:
		tenthFunc()
	called by :
		firstFunc()


Any ideas?

	Thanks,	Gary


------------------------------

Date: 18 Jul 2001 15:45:22 GMT
From: rene.nyffenegger@gmx.ch (Rene Nyffenegger)
Subject: Re: trace function calls
Message-Id: <Xns90E23CE4512C4gnuegischgnueg@130.133.1.4>

bakerg@volpe.dot.gov (Gary Baker) wrote in
<3580d191.0107180509.6cf46760@posting.google.com>: 

>I have a very large web application and would like to somehow create a
>list ( automatically of course ) of javascript functions with the
>functions they are calling and functions that call them
>
>something like this :
>
>function firstFunc(x,y,z)
>     calls :
>          ninthFunc()
>          eleventhFunc()
>     called by :
>          fifthFunc()
>          seventhFunc()
>
>function ninthFunc()
>     calls:
>          tenthFunc()
>     called by :
>          firstFunc()
>
>
>Any ideas?
>
>     Thanks,     Gary
>

there's a built in function to do that: 'caller'. Read about it:
perldoc -f caller

Here's a little programm to demonstrate it:


a();


sub a {
  printCallingHierarchy();
  b();
  d();
}


sub b {
  printCallingHierarchy();
  c();
}

sub c() {
  printCallingHierarchy();
  d();
}
  
sub d() {
  printCallingHierarchy();
}



sub printCallingHierarchy {
  $i=1;
  while (@S = caller($i++)) {
    print "$S[3]\n";
  }

  print "-----\n";
}

__END__


Hth

Rene


-- 
http://www.adp-gmbh.ch/
rene dot nyffenegger at adp-gmbh dot ch



------------------------------

Date: 18 Jul 2001 17:16:27 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: trace function calls
Message-Id: <9j4g9b$2go$3@mamenchi.zrz.TU-Berlin.DE>

According to Rene Nyffenegger <rene.nyffenegger@gmx.ch>:
> bakerg@volpe.dot.gov (Gary Baker) wrote in
> <3580d191.0107180509.6cf46760@posting.google.com>: 
> 
> >I have a very large web application and would like to somehow create a
> >list ( automatically of course ) of javascript functions with the
> >functions they are calling and functions that call them
> >
> >something like this :
> >
> >function firstFunc(x,y,z)
> >     calls :
> >          ninthFunc()
> >          eleventhFunc()
> >     called by :
> >          fifthFunc()
> >          seventhFunc()
> >
> >function ninthFunc()
> >     calls:
> >          tenthFunc()
> >     called by :
> >          firstFunc()
> >
> >
> >Any ideas?
> >
> >     Thanks,     Gary
> >
> 
> there's a built in function to do that: 'caller'. Read about it:
> perldoc -f caller

[snip]

Uh, he wants to parse javascript, not Perl.

Anno


------------------------------

Date: Wed, 18 Jul 2001 09:15:06 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Using a Perl module outside from Perl-dir?
Message-Id: <slrn9lb2uq.cs2.tadmc@tadmc26.august.net>

Mark Grimshaw <m.grimshaw@salford.ac.uk> wrote:
>"T.Hopkins" wrote:

>> how can I use a module (in my case: File::ReadBackwards.pm) from my
                   ^^^^^^
                   ^^^^^^
>> own 'cgi-bin' (or other) directory directly 


   perldoc -q module

      "How do I keep my own module/library directory?"

You are expected to check the Perl FAQ *before* posting to the
Perl newsgroup.



>> that is not installed on
>> the ISP's server?


It is not possible to use modules that are not installed.


>> Our ISP is an ugly face and lazy to install this module.


I recommend that you vote with your wallet.


>use lib '<directorypath>';
>use <Module>;
>
>I think.


Please do not post guesses. Just skip it if you do not _know_ the answer.

An OP is already confused or they wouldn't be asking a question.

A wrong answer increases confusion. We generally attempt to
_decrease_ confusion hereabouts.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Wed, 18 Jul 2001 15:24:47 +0100
From: Mark Grimshaw <m.grimshaw@salford.ac.uk>
Subject: Re: Using a Perl module outside from Perl-dir?
Message-Id: <3B559C2F.E54496D4@salford.ac.uk>


> 
> >use lib '<directorypath>';
> >use <Module>;
> >
> >I think.
> 
> Please do not post guesses. Just skip it if you do not _know_ the answer.
> 
> An OP is already confused or they wouldn't be asking a question.
> 
> A wrong answer increases confusion. We generally attempt to
> _decrease_ confusion hereabouts.
> 

Out of interest, at least tell me what's wrong with my 'guess'.  My
reading of the post was that the OP already has some modules in his/her
own directories but that are not part of the installed perl library
available system-wide (if I'm using the right terminology).  If _I_ have
that situation, then the solution I proposed works for me.

Now _I'm_ confused.


------------------------------

Date: Wed, 18 Jul 2001 10:22:19 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Using a Perl module outside from Perl-dir?
Message-Id: <slrn9lb6sr.d8s.tadmc@tadmc26.august.net>

Mark Grimshaw <m.grimshaw@salford.ac.uk> wrote:
>
>> 
>> >use lib '<directorypath>';
>> >use <Module>;
>> >
>> >I think.
>> 
>> Please do not post guesses. Just skip it if you do not _know_ the answer.

>Out of interest, at least tell me what's wrong with my 'guess'.  My
>reading of the post was that the OP already has some modules in his/her
>own directories 


I did not read it that way.

He said "not installed". They must be installed to be used.


>available system-wide (if I'm using the right terminology).  If _I_ have
>that situation, then the solution I proposed works for me.


Your solution will work if the module is already installed.

Your solution is, in fact, the second part of the answer given 
in the FAQ.

Pointing to the FAQ covers both installing and using.

Attempting to reanswer an already answered question is worse than
not answering at all.

Here we both are, spending time on each other, instead of on other
folks with questions, when the OP should have checked the FAQ
in the first place and never started this thread.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Wed, 18 Jul 2001 17:02:28 +0100
From: Mark Grimshaw <m.grimshaw@salford.ac.uk>
Subject: Re: Using a Perl module outside from Perl-dir?
Message-Id: <3B55B314.858D8A07@salford.ac.uk>



Tad McClellan wrote:

> 
> Here we both are, spending time on each other, instead of on other
> folks with questions, when the OP should have checked the FAQ
> in the first place and never started this thread.

Right but... :)
Maybe a waste of time but a newbie to this newsgroup (like me) has to
tiptoe around and be excessively polite to the perl gurus here who would
as soon dump you in their killfile as bat an eyelid at you. 
Incidentally, if I might wade into the shark-infested waters, I would
understand 'install' to be slightly different to 'having' a module in a
user directory.  Am I wrong?


------------------------------

Date: Wed, 18 Jul 2001 11:40:56 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Using a Perl module outside from Perl-dir?
Message-Id: <slrn9lbbg8.df0.tadmc@tadmc26.august.net>

Mark Grimshaw <m.grimshaw@salford.ac.uk> wrote:
>Tad McClellan wrote:
>
>> Here we both are, spending time on each other, instead of on other
>> folks with questions, when the OP should have checked the FAQ
>> in the first place and never started this thread.
>
>Right but... :)
>Maybe a waste of time but a newbie to this newsgroup (like me) has to
>tiptoe around and be excessively polite to the perl gurus here who would
>as soon dump you in their killfile as bat an eyelid at you. 


1) You don't have to tiptoe around. You only have to make a good
   faith effort in searching the standard documentation before posting.
   The OP did not do that. His post should have been skipped in
   favor of helping out someone else who _is_ considerate of his
   audience. He has stolen time away from his peers.

2) Your use of "but" seems to imply there is some mitigating
   factor, but I don't see how the above supports attempting
   to reanswer already-answered questions (FAQs). That is, I
   am missing your point altogether. What is your point above?


>Incidentally, if I might wade into the shark-infested waters, I would
>understand 'install' to be slightly different to 'having' a module in a
>user directory.  Am I wrong?


To me "install" means the Usual Four Commands, and I have no
idea what "having" might mean.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: 18 Jul 2001 16:42:58 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Using a Perl module outside from Perl-dir?
Message-Id: <9j4eai$2go$1@mamenchi.zrz.TU-Berlin.DE>

According to Mark Grimshaw  <m.grimshaw@salford.ac.uk>:
> 
> 
> Tad McClellan wrote:
> 
> > 
> > Here we both are, spending time on each other, instead of on other
> > folks with questions, when the OP should have checked the FAQ
> > in the first place and never started this thread.
> 
> Right but... :)
> Maybe a waste of time but a newbie to this newsgroup (like me) has to
> tiptoe around and be excessively polite to the perl gurus here who would
> as soon dump you in their killfile as bat an eyelid at you. 
> Incidentally, if I might wade into the shark-infested waters, I would
> understand 'install' to be slightly different to 'having' a module in a
> user directory.  Am I wrong?

Not really wrong, though in the simple case of a Perl-only module,
"installation" means nothing but placing the module where Perl
can find it.  (An install via "make install" will also add some
lines to perllocal.pod, but that's not installation proper).

In general, after downloading and unpacking, an installation is
done in three steps: "make && make test && make install".  The
"make" step is the work-horse in complex installations but may
reduce to a no-op in simple cases.  After testing, "make install"
does little more than distribute files according to local and
global rites.

Anno


------------------------------

Date: Wed, 18 Jul 2001 18:30:22 +0100
From: Mark Grimshaw <m.grimshaw@salford.ac.uk>
Subject: Re: Using a Perl module outside from Perl-dir?
Message-Id: <3B55C7AE.E6E7CA69@salford.ac.uk>



Anno Siegel wrote:
> 
> According to Mark Grimshaw  <m.grimshaw@salford.ac.uk>:
> >
> >
> > Tad McClellan wrote:
> >
> > >
> > > Here we both are, spending time on each other, instead of on other
> > > folks with questions, when the OP should have checked the FAQ
> > > in the first place and never started this thread.
> >
> > Right but... :)
> > Maybe a waste of time but a newbie to this newsgroup (like me) has to
> > tiptoe around and be excessively polite to the perl gurus here who would
> > as soon dump you in their killfile as bat an eyelid at you.
> > Incidentally, if I might wade into the shark-infested waters, I would
> > understand 'install' to be slightly different to 'having' a module in a
> > user directory.  Am I wrong?
> 
> Not really wrong, though in the simple case of a Perl-only module,
> "installation" means nothing but placing the module where Perl
> can find it.  (An install via "make install" will also add some
> lines to perllocal.pod, but that's not installation proper).
> 
> In general, after downloading and unpacking, an installation is
> done in three steps: "make && make test && make install".  The
> "make" step is the work-horse in complex installations but may
> reduce to a no-op in simple cases.  After testing, "make install"
> does little more than distribute files according to local and
> global rites.
> 

Thanks.

Tad: As for 'having', I simply meant placing the .pm file in a user
directory (which you the user can then use with 'use lib etc') as
opposed to the install steps above meaning 'placing the module where
Perl can find it'.


------------------------------

Date: Wed, 18 Jul 2001 15:11:29 GMT
From: "Thing" <noemail@noemail.com>
Subject: Very Simple Socket Question
Message-Id: <BGh57.1220$Po6.94334@newsread2.prod.itd.earthlink.net>

Im writing a simple program to open a socket, and send some information
across it.
I just want to send the word hello across the connection.  I know what i
have is wrong, but i dont know how to extract the sent text.

Here is the receiver:
use IO::Socket;
my $sock = new IO::Socket::INET ( LocalHost => 'thing', LocalPort => '7070',
Proto => 'tcp',
                                 Listen => 1,
                                 Reuse => 1,
                                );
die "Could not create socket: $!\n" unless $sock;
my $new_sock = $sock->accept();
while(defined(<$new_sock>))
  {
  print $new_sock;
  }
close($sock);

and here is the sender :
use IO::Socket;
my $sock = new IO::Socket::INET (
                                 PeerAddr => 'thing',
                                 PeerPort => '7070',
                                 Proto => 'tcp',
                                );
die "Could not create socket: $!\n" unless $sock;
print $sock "Hello!\n";
#close($sock);




------------------------------

Date: 18 Jul 2001 17:11:09 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Very Simple Socket Question
Message-Id: <9j4fvd$2go$2@mamenchi.zrz.TU-Berlin.DE>

According to Thing <noemail@noemail.com>:
> Im writing a simple program to open a socket, and send some information
> across it.
> I just want to send the word hello across the connection.  I know what i
> have is wrong, but i dont know how to extract the sent text.
> 
> Here is the receiver:
> use IO::Socket;
> my $sock = new IO::Socket::INET ( LocalHost => 'thing', LocalPort => '7070',
> Proto => 'tcp',
>                                  Listen => 1,
>                                  Reuse => 1,
>                                 );
> die "Could not create socket: $!\n" unless $sock;
> my $new_sock = $sock->accept();
> while(defined(<$new_sock>))

That reads a line from the socket, tests it for defined-ness, and
throws it away.  It should be

    while ( <$new_sock> )

A defined() test is implicit in this form of "while", and the line
it has read is now in $_.  "while" is only magical this way when the
only content of the condition is a <>-operator.  Otherwise you have
to be explicit.

>   {
>   print $new_sock;

You don't want to print $new_sock.  It contains whatever "new
IO::Socket::INET" put there and printing it doesn't make much sense.
With the correction above, you now want to

    print; # prints $_

>   }
> close($sock);

[snip sender code (which is okay)]

A useful debugging technique for text-oriented sockets is to use
telnet as an ersatz client/server.  That way you have a functional
partner while you debug each half of the program.

Anno


------------------------------

Date: Wed, 18 Jul 2001 17:47:27 GMT
From: "Thing" <noemail@noemail.com>
Subject: Re: Very Simple Socket Question
Message-Id: <PYj57.1524$Po6.126915@newsread2.prod.itd.earthlink.net>

great, it works, just one note, what does the "print; # prints $_" do ?




------------------------------

Date: Wed, 18 Jul 2001 17:10:29 +0100
From: "Simon Flack" <news@simonflack.com>
Subject: Re: What is undump?
Message-Id: <9j4ccb$kpq2q$1@ID-83895.news.dfncis.de>

> +
>   What is undump?
>
>     See the next question on ``How can I make my Perl program run
faster?''
>
> -

Lol!

For anyone that can't wait for the next installment, you can find the answer
here:
http://www.perldoc.com/perl5.6/pod/perlfaq3.html#How%20can%20I%20make%20my%2
0Perl%20program%20run%20faster%3f

or type "perldoc -q faster"




------------------------------

Date: Wed, 18 Jul 2001 17:10:29 +0100
From: "Simon Flack" <news@simonflack.com>
Subject: Re: What is undump?
Message-Id: <9j4cem$m117k$1@ID-83895.news.dfncis.de>

> +
>   What is undump?
>
>     See the next question on ``How can I make my Perl program run
faster?''
>
> -

Lol!

For anyone that can't wait for the next installment, you can find the answer
here:
http://www.perldoc.com/perl5.6/pod/perlfaq3.html#How%20can%20I%20make%20my%2
0Perl%20program%20run%20faster%3f

or type "perldoc -q faster"




------------------------------

Date: Wed, 18 Jul 2001 17:11:45 +0100
From: "Simon Flack" <news@simonflack.com>
Subject: Re: What is undump?
Message-Id: <9j4cj5$m117k$2@ID-83895.news.dfncis.de>

> +
>   What is undump?
>
>     See the next question on ``How can I make my Perl program run
faster?''
>
> -

Lol!

For anyone that can't wait for the next installment, you can find the answer
here:
http://www.perldoc.com/perl5.6/pod/perlfaq3.html#How%20can%20I%20make%20my%2
0Perl%20program%20run%20faster%3f

or type "perldoc -q faster"






------------------------------

Date: Wed, 18 Jul 2001 10:30:20 -0400
From: "Brian" <dersgniw@fuse.net>
Subject: Re: Why is var using same memory location
Message-Id: <tlb7n4b40loj40@corp.supernews.com>


"Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
news:3B54F5BB.6D123EBA@earthlink.net...
> This has nothing to do with your problem, but is a suggestion for an
> improvement:
> [snip]
> It's not perlish to use an index unless you *really* need it, for
> example because you want to print out the index.  You would be better
> off writing the above code as follows:
>
> @tuxconfig = map {
>         local $ENV{TUXCONFIG} = $_;
>         [`tmunloadcf`];
>     } @TFs;
> Or:
> foreach( @TFs ) {
>     local $ENV{TUXCONFIG} = $_;
>     push @tuxconfig, [`tmunloadcf`];
> }
>

Thanks for the suggestion.  I might try the latter.. because I can't figure
out the map function.





------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 1326
***************************************


home help back first fref pref prev next nref lref last post