[19459] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1654 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 30 06:10:27 2001

Date: Thu, 30 Aug 2001 03:10:12 -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: <999166211-v10-i1654@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 30 Aug 2001     Volume: 10 Number: 1654

Today's topics:
        Network topology mapping (Adam)
        NT Query <e2e4@pacbell.net>
        NT question <e2e4@pacbell.net>
    Re: Performance : Shell X Perl (Abigail)
        perl cgi (unplug)
    Re: PerlFS again? <Brian.Wallis@ot.com.au>
    Re: Problems with with Perl, Cgi using the Dbi module <brentdax1@earthlink.net>
        recurssion Scandirectory subrutine <radiotito@yahoo.com>
    Re: REGEX <fredrik.andersson@esavionics.se>
        search.cpan.org <Rainer.Klier@erl.sbs.de>
    Re: search.cpan.org (Tim Hammerquist)
    Re: search.cpan.org <ilya@martynov.org>
    Re: search.cpan.org <ilya@martynov.org>
    Re: search.cpan.org (Tim Hammerquist)
    Re: search.cpan.org <ilya@martynov.org>
    Re: search.cpan.org <ilya@martynov.org>
    Re: simple foreach problem (2obvious)
    Re: SQL group by statement? <goldbb2@earthlink.net>
    Re: system call (Villy Kruse)
    Re: Unix perl directory conventions?? (Rafael Garcia-Suarez)
        use statement runs package's subs before they are calle (Laith Suheimat)
        Weird @INC if run from web (Batara Kesuma)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 29 Aug 2001 22:37:45 -0700
From: xenite9@my-dejanews.com (Adam)
Subject: Network topology mapping
Message-Id: <b67a511f.0108292137.63f7bac0@posting.google.com>

Hello,

How do I take the output of traceroute each time it is run, compare it
to a previous (array?) route, remove duplicates, and store new values
in an array?

I originally posted a question a couple days ago but I didn't say
precisely what I wanted.  Many offered good assistance on how I can
graphically display a network with GD or GraphViz.  Although I've
learned a lot about these modules, they are not needed at this time. 
My problem lies before GD/GrapViz can even be used.

I'm writing a script that takes the output of traceroute and makes a
graphical map (CGI, in a web browser) of a network topology.  It will
distinguish different subnets by the number of hops it takes to reach
a certain IP.  I would like the final output to look distantly similar
to this: http://www.qualys.com/demo/fo_2.9/map-result.html , but not
Java or with all that movement/fanciness.  See how different
subnets/nodes are differentiated?

My script takes a starting IP and ending IP (i.e., 192.168.0.1 to
192.168.1.254).  It then runs traceroute on the first IP, stores all
hops in an array (removing everything but the IP), goes to the next
IP, and does the same thing to each subsequent IP until it reaches the
last IP.

I need to take the output of traceroute each time it is run (already
captured in an array with the code directly below), compare it to a
previous (array?) route, remove duplicates, and store in an array.  Or
maybe I could store everything in a huge multidimensional array? 
Other techniques?  All I want to do is to graphically display a
network topology.  However that is done is fine by me.

my @ip_addrs = map /\(([^)]*)\)/, qx( /usr/sbin/traceroute $target);

HELP!
Adam.


#!/usr/bin/perl -w
use CGI qw(:standard);

print "Content-type: text/html\n\n";

$first = param("first");
$last = param("last");

&form_check;
&validated;

sub form_check {
   #Splits IP addresses (octets) on '.'
   @first = split(/\./,$first);
   @last = split(/\./,$last);
   #THIS IS WHERE $first AND $last ARE CHECKED TO SEE IF THEY ARE
   #IN PROPER FORM...I CUT THIS CODE OUT TO SHORTEN THIS POST
}

sub validated {
   #Calls trace for first IP (only used once)
   $run_once == 0;
   while($run_once == 0) {
     &trace;
     $run_once++;
   }
#While 3rd octet of $first is less than or equal to 3rd octet of
$last,
#and 4th octet of $first is less than or equal to 4th octet of $last
   while($first[2] <= $last[2] && $first[3] < $last[3]){
     #While 4th octet of $first is less than 4th octet of $last
     while($first[3] < $last[3]){
       $first[3]++; #Adds 1 to 4th octet, calls sub trace
       &trace;
       }
     #Is the 3rd octet of $first less than the 3rd of $last?
     #i.e, 192.168.0.1 and 192.168.1.254
     while($first[2] < $last[2]) {
      $first[3] = 1;  #Resets 4th octet to 1
       $first[2]++;   #Adds 1 to 3rd octet of $first
       }
   }
}

sub trace {
  print "<h1>Tracing route, one moment...</h1>";
  
  #Rejoin octets into $target for tracerouting...
  $target = join('.', $first[0],$first[1],$first[2],$first[3]);

#Run traceroute on $target, only capture IP address to array @ip_addrs
my @ip_addrs = map /\(([^)]*)\)/, qx( /usr/sbin/traceroute $target);

#Cycle through @ip_addrs, print compy.gif for each hop
   foreach $element (@ip_addrs) {
print "<center><img src=\"compy.gif\"><\/a><br>$element<br><br><\/center>";
      $|++;
   }
   #Re-splits $target for octet analysis
   @first = split(/\./,$target);
}


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

Date: Wed, 29 Aug 2001 22:45:21 -0700
From: <e2e4@pacbell.net>
Subject: NT Query
Message-Id: <dqkj7.3109$8V5.94150@news.pacbell.net>

I'm trying to connnect to a server on our network remotely, and get a list
of all the active users for use in a perl script (for the boss).  I can look
at the server using PerfMon, but don't see how to get the list of users into
a script.  Anyone know?




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

Date: Thu, 30 Aug 2001 03:01:05 -0700
From: <e2e4@pacbell.net>
Subject: NT question
Message-Id: <U9oj7.4491$8V5.177885@news.pacbell.net>

How can I get a list of active users off of a NT server from a remote
location?  I can see the list I need using perf mon, but how do I get it
into a script that will run every 10 minutes?




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

Date: 30 Aug 2001 06:40:07 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Performance : Shell X Perl
Message-Id: <slrn9ornu8.u7l.abigail@alexandra.xs4all.nl>

Knob (andrew.savige@ir.com) wrote on MMCMXX September MCMXCIII in
<URL:news:R%ej7.5$7W4.1083@news0.optus.net.au>:
}} "Abigail" <abigail@foad.org> wrote in message
}} news:slrn9oq4j6.t86.abigail@alexandra.xs4all.nl...
}} >
}} > Why don't you just say "Prerequisite: perl 5.X.Y". Just as you might have
}} > a requirement of a minimum amount of diskspace or physical memory. You
}} > don't ship disks or RAM with your product either, do you?
}} >
}} > Abigail
}} 
}} I could try that, but I would certainly be overruled by Product Management.

Ah, Product Management. They have their own twisted ideas, and there's no
reason to come up with technical arguments to justify their demands.

}} Hopefully in a year or two when all our platforms come with Perl 5
}} pre-installed.
}} Those that currently dont include AIX prior to AIX433 and HP-UX
}} (comes with Perl 4 pre-installed!!). If anyone from HP is listening, please
}} note that upgrading to Perl 5 would be appreciated by the Perl community.
}} 
}} There is a strong business case for "out of the box installs".
}} After all, most customers don't care if the product is written in Perl or C
}} or whatever; they just want it to work with minimum effort on their part.
}} Asking a non-technical person to download and install Perl does not
}} look good, especially in a pre-sales situation, where you are trying to
}} emphasize how easy it is to install and use your product.

Asking a non-technical person to install *anything*, be it Perl or be it
your product doesn't not only look "not good", it looks plain stupid.
It's like asking your secretary to do a root canal. Maintainance of a
machine should be done by qualified people.

}} We face a similar dilemma in the Windows market. Do you create a MSI
}} file and ask the customer to first download Windows Installer before
}} installing
}} your product, or do you go for "out of the box" installs via InstallShield?

Neither. I wouldn't produce for the Windows market to start with. ;-)



Abigail
-- 
perl -we '$_ = q ;4a75737420616e6f74686572205065726c204861636b65720as;;
          for (s;s;s;s;s;s;s;s;s;s;s;s)
              {s;(..)s?;qq qprint chr 0x$1 and \161 ssq;excess;}'


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

Date: 30 Aug 2001 02:44:31 -0700
From: unplug@poboxes.com (unplug)
Subject: perl cgi
Message-Id: <90f52794.0108300144.14527375@posting.google.com>

Hi all,

  I have the following question.
I have set the apache will appropriate setting that can run CGI.  Then
I use write a CGI with perl as follow.

#!/usr/bin/perl

print "Content-type: text/html\n\n";

print "<html><head></head>\n";
print "<h2>abc</h2>\n";
print "</html>\n";

I put the above script under my home directory (say $HOME/public_html)
and access it from
http://localhost/~user/index.cgi
without problem.

Then I put the above script under a path of my home directory (say
$HOME/public_html/patha) and
access it from
http://localhost/~user/patha/index.cgi
But the browser shows me the "Internal Server Error" and I found the
apache error log as follow.
Premature end of script headers:
/home/user/public_html/patha/index.cgi

I doubt why it only works under home directory.  How do I specify all
the directories under public_html can work with CGI??

Rgds,
unplug


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

Date: 30 Aug 2001 16:40:18 +1000
From: Brian Wallis <Brian.Wallis@ot.com.au>
Subject: Re: PerlFS again?
Message-Id: <stkzo8iuk31.fsf@ganesh2.mel.ot>

abigail@foad.org (Abigail) writes:
> PerlFS was a nice idea, but it wasn't patented. Applesoft saw
> the potential and quickly filed for a patent. After they got it,
> they succesfully sued the original developers and closed down the
> website. Which also explains the looping mail.

How come I cannot find any other references to this travesty? Are you
sure the patent didn't pre-date the perlfs implementation. I didn't
thnik you could get a patent on something that is already in the
public domain (such as an open source implementation)

Seems very odd that you can get a patent on something someone else has
already published.

-- 
brian wallis...		  Open Telecommunications, Melbourne
<brian.wallis@ot.com.au>  Phone: +61 3 98434891
http://www.ot.com.au/     Fax:   +61 3 98991890
		Carpe Aptenodytes!


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

Date: Thu, 30 Aug 2001 07:59:30 GMT
From: "Brent Dax" <brentdax1@earthlink.net>
Subject: Re: Problems with with Perl, Cgi using the Dbi module
Message-Id: <Cnmj7.5870$aC1.535081@newsread1.prod.itd.earthlink.net>

"John Joseph Trammell" <trammell@bayazid.hypersloth.invalid> wrote in
message news:slrn9mdem9.2r5.trammell@bayazid.hypersloth.net...
> On 31 Jul 2001 02:15:05 -0700, Karen Mindermann <KMindermann@gmx.de>
wrote:
> > "Can't call method "prepare" on an undefined value at
> > .../cgi-bin/kmindermann/FernleiheResult.pl line 235. "
> >
> >   $dbh = DBI->connect("DBI:$driver:$database:$host", $user,
> > $password,{PrintError => 0, RaiseError => 0 });
>    unless ($dbh) { die "unable to connect to database"; }

Or, more idiomatically (and informatively):

    # the linebreaks are a little funny to avoid my newsreader doing
    #  something even funnier with them
    $dbh=DBI->connect(
        "DBI:$driver:$database:$host", $user, $password,
        {PrintError => 0, RaiseError => 0}
    ) or die "$0: unable to connect to $database:$host";

--
Brent Dax
brentdax@cpan.org

"...and if the answers are inadequate, the pumpqueen will be overthrown in a
bloody coup by programmers flinging dead Java programs over the walls with a
trebuchet."




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

Date: Thu, 30 Aug 2001 11:02:34 +0200
From: Valentin 30IR976 <radiotito@yahoo.com>
Subject: recurssion Scandirectory subrutine
Message-Id: <3B8E012A.D5F7066C@yahoo.com>

I lost a subrutine that recursively deleted a file on all directories
from a certain directory. It was named ScanDirectory.
Could someone tell me the code?
Thanks in advance...

--
73 de Valentin 30IR976 (161 DXCC) ICQ # 86220598 Firetalk # 1626864

web 30IR976:  http://www.geocities.com/titoradio
IR Members: Promote your IR-related-Website at:
http://www.topsitelists.com/bestsites/topir976list/topsites.html
web personal: http://get.to/zamora
SEMANA SANTA ZAMORA http://www.geocities.com/semanasantazamora




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

Date: Thu, 30 Aug 2001 08:51:41 +0200
From: Fredrik Andersson <fredrik.andersson@esavionics.se>
Subject: Re: REGEX
Message-Id: <3B8DE27D.71F9C063@esavionics.se>

Dear Miss Godzilla!
I'm gratful for the help with my problem from you and from the 
other kind people how have help me.
The Newsgroups are for the people how needs help and for thouse
kind people how have the will to help these people.
You are allowed to call me rude as much as you like (I'm not going
to call you that) but one might think that one might hurt a person
with this words if one is a Homo Sapiens. 

My deepest regrets for my poor definition of my problem (can happen 
again :-) ), 
Mr Fredrik Andersson


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

Date: Thu, 30 Aug 2001 09:24:41 -0100
From: Rainer Klier <Rainer.Klier@erl.sbs.de>
Subject: search.cpan.org
Message-Id: <3B8E1469.88F49EE1@erl.sbs.de>

Hi,

since some days I experience performance problems
accessin search.cpan.org. Am I the only one?

Regards, Rainer


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

Date: Thu, 30 Aug 2001 09:24:13 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: search.cpan.org
Message-Id: <slrn9os28b.3el.tim@vegeta.ath.cx>

Me parece que Rainer Klier <Rainer.Klier@erl.sbs.de> dijo:
> Hi,
> 
> since some days I experience performance problems
> accessin search.cpan.org. Am I the only one?

No. I've been having problems with search.cpan.org lately as well.
Netscape takes forever, and Opera croaks entirely.

The mirrors seem to work fine, though.

> Regards, Rainer


-- 
I would feel infinitely more comfortable in your presence if you would agree
to treat Gravity as a Law, rather than one of a number suggested options.
    -- Barnabas, The Sandman


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

Date: 30 Aug 2001 13:25:28 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: search.cpan.org
Message-Id: <878zg1hpbr.fsf@abra.ru>

>>>>> On Thu, 30 Aug 2001 09:24:41 -0100, Rainer Klier <Rainer.Klier@erl.sbs.de> said:

RK> Hi,
RK> since some days I experience performance problems
RK> accessin search.cpan.org. Am I the only one?

I see these problems too. Funny, I was intended to post same question
here.

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

Date: 30 Aug 2001 13:29:30 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: search.cpan.org
Message-Id: <874rqphp51.fsf@abra.ru>

>>>>> On Thu, 30 Aug 2001 09:24:13 GMT, tim@vegeta.ath.cx (Tim Hammerquist) said:

TH> The mirrors seem to work fine, though.

Mirrors? Is there any mirrors for search.cpan.org? I never heard about
them.

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

Date: Thu, 30 Aug 2001 09:40:19 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: search.cpan.org
Message-Id: <slrn9os36h.3el.tim@vegeta.ath.cx>

Me parece que Ilya Martynov <ilya@martynov.org> dijo:
> >>>>> On Thu, 30 Aug 2001 09:24:13 GMT, tim@vegeta.ath.cx (Tim Hammerquist) said:
> 
> TH> The mirrors seem to work fine, though.
> 
> Mirrors? Is there any mirrors for search.cpan.org? I never heard about
> them.

Uh, no. The regular old CPAN mirrors. Yes, I know they're not at tightly
linked as some might think. (eg, search.cpan.org describes modules that
haven't existed on the ["regular old CPAN"] mirrors for some time.)

Your sarcasm is noted, however.

-- 
Your question doesn't make any sense. You might as well ask whether
it is possible to grow vegetables from a painting, without becoming
Wednesday first.
    -- Abigail, comp.lang.perl.misc


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

Date: 30 Aug 2001 13:46:15 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: search.cpan.org
Message-Id: <87wv3lg9so.fsf@abra.ru>

>>>>> On Thu, 30 Aug 2001 09:40:19 GMT, tim@vegeta.ath.cx (Tim Hammerquist) said:

TH> Uh, no. The regular old CPAN mirrors. Yes, I know they're not at tightly
TH> linked as some might think. (eg, search.cpan.org describes modules that
TH> haven't existed on the ["regular old CPAN"] mirrors for some time.)

TH> Your sarcasm is noted, however.

It wasn't sarcasm. I really would like to know if there exists any
alternative website. I use search.cpan.org often to read perldoc's of
modules without downloading them and recent problems with
search.cpan.org are very annoying.

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

Date: 30 Aug 2001 14:00:47 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: search.cpan.org
Message-Id: <87sne9g94g.fsf@abra.ru>

>>>>> On 30 Aug 2001 13:46:15 +0400, Ilya Martynov <ilya@martynov.org> said:

IM> It wasn't sarcasm. I really would like to know if there exists any
IM> alternative website. I use search.cpan.org often to read perldoc's of
IM> modules without downloading them and recent problems with
IM> search.cpan.org are very annoying.

I've just found good alternative to search.cpan.org:

    http://theoryx5.uwinnipeg.ca/CPAN/cpan-search.html

At first look it seems to be even more powerfull CPAN search engine
than search.cpan.org.

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

Date: 29 Aug 2001 22:21:04 -0700
From: vadivasbro@hotmail.com (2obvious)
Subject: Re: simple foreach problem
Message-Id: <6e537be.0108292121.6ea61d79@posting.google.com>

Thanks, Eric; your fix worked. (Thank you also, Malcolm and Martien.)

So you're saying this is a bug with Windows, and NOT ActiveState Perl?
 But isn't ActiveState a port of perl made especially for the Windows
OS?

Do you know if this bug's been reported to ActiveState?

> It's a bug in the Windows console output routine that causes it, under 
> certain circumstances, to overwrite the first line output after reading 
> input from the console.  Try putting a
> 
> print "\n";
> 
> before your loop; that should keep your first real output line from 
> getting swallowed.


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

Date: Thu, 30 Aug 2001 05:20:58 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: SQL group by statement?
Message-Id: <3B8E057A.AF8DB746@earthlink.net>

Yew wrote:
> 
> Is there a SQL group by statement and count functions using regex in
> perl?  Forgive me if this is a newbie question but I'm mucking around
> looking for answers to this.
> 
> AAH2-6-pw-100     PPKBSBAO     6     2.8 M          PIPE
> AAH2-6-pw-100     EAKBSBAO     6     2                 FITTINGS
> 
> This is a sample raw data that I have. I would like to do a perl
> equivalent of a select statement and then
> - group them by the second column
> - sum the third column value
> - and sort (but this is not as essential)

open( RAW, "<rawdata.txt ) or die ...;
my %grouped;
while( <RAW> ) {
	my @fields = split;
	push @{$grouped{$fields[1]}, \@fields;
}
foreach my $key ( sort keys %grouped ) {
	my $sum; $sum += $_->[2] for @{$grouped{$key}};
	print "For items labeled $key, the sum is $sum\n";
	print "Here are the items within the group:\n";
	foreach( @{$grouped{$key}} ) {
		printf "formated", @$_;
	}
}


> Problem I'm facing is that this output file from the program dumps the
> data not in tab,comma delimited format, but just fills them up
> accordingly with whitespaces (space) only. I tried looking at some
> common cgi scripts but have come up short.

This can be a problem if some of your columns have embeded whitespace --
in my example, it parses "2.8" and "M" as seperate columns.  If this is
not the way you want it, then that's a problem.

-- 
"I think not," said Descartes, and promptly disappeared.


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

Date: 30 Aug 2001 07:13:37 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: system call
Message-Id: <slrn9orpt0.rq6.vek@pharmnl.ohout.pharmapartners.nl>

On Wed, 29 Aug 2001 11:25:51 -0500,
    Dale Bohl <dbohl@sgi.com> wrote:


>How do I get the following to work with a system call
>from Perl?
>
>$command = "ls -la /etc/passwd | awk '{print $5}'";
>
>After this I do a system ("rsh $host $command");
>
>I can't figure out how to get the | awk '{print $5}'
>part working.
>

Do

print ("rsh $host $command");

and the explanation would usualy be pretty obvious.

$command = q{ls -la /etc/passwd | awk '{print $5}'};

is just one of the many ways to fix this.



Villy


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

Date: 30 Aug 2001 07:05:16 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Unix perl directory conventions??
Message-Id: <slrn9orpo4.bs8.rgarciasuarez@rafael.kazibao.net>

Ed Kulis wrote in comp.lang.perl.misc:
} Hi all,
} 
} Does any one know if there's a custom or convention for the placement of
} perl on a unix system?
} 
} We've currently referencing perl it and links to it as
}     /bin/perl
}     /usr/bin/perl
}     /usr/local/bin/perl

There is no universal convention.

For hints, read the INSTALL file from the source distribution, and also
the README for your system (if there is one). For example, on Solaris 8,
the vendor-supplied perl is in /usr/perl5/bin/perl, with /usr/bin/perl
pointing on it, but you're free to install another version in another
place, or to override /usr/bin/perl.

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: 30 Aug 2001 02:34:23 -0700
From: l.suheimat@mdx.ac.uk (Laith Suheimat)
Subject: use statement runs package's subs before they are called
Message-Id: <69f8a22d.0108300134.18382bc9@posting.google.com>

i have a package ('PKG') that has a number of subroutines that i call
from another script, eg:

use PKG;
$foo = PKG::pkg_sub1();
$bar = PKG::pkg_sub2();

because i now want to run the package as a script, calling it directly
from the command line, i added calls to the package's subroutines into
the package script:

$foo = pkg_sub1();
$bar = pkg_sub2();

sub pkg_sub1 {
 ...
}

sub pkg_sub2 {
 ...
}

the problem is that the use statement in the calling script now
executes pkg_sub1 and pkg_sub2 (ie. the subs called in the package's
main::) before they are explicitly called (in fact, as soon as the
calling script is run).

i thought that 'use <pkg>' simply parses the package, so why is it
running it? maybe i need to do something with EXPORTER or BEGIN?

my current workaround is to remove the calls to the subs in PKG's
main:: and have a wrapper script called pkg (that i run from the
command line) that calls the PKG subs.

laith


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

Date: 30 Aug 2001 03:00:53 -0700
From: bkesuma@yahoo.com (Batara Kesuma)
Subject: Weird @INC if run from web
Message-Id: <8a89aec5.0108300200.209ec718@posting.google.com>

Hi,

I tried using require 'something.pl' so I could run the subroutine
inside that file from my main file. If I run it from the terminal, it
is ok. But when I try to run it from the web, it gives me 500 error.
Please help.

Here it is:
[bk@batara mixed]$ perl --version
This is perl, v5.6.1 built for i386-linux
 ...

[bk@batara mixed]$ ls
apply.cgi           cookie.pl
 ...

[bk@batara mixed]$ cat apply.cgi
#!/usr/bin/perl
require "cookie.pl";
 ...

[bk@batara mixed]$ ./apply.cgi
 ... 
Some HTML code
 ...

But if I go to: http://localhost/mixed/apply.cgi, 500 server error
comes out, and the error log in my apache error log is:

Can't locate cookie.pl in @INC (@INC contains: /var/www/html/mixed
/usr/lib/perl5/5.6.1/i386-linux /usr/lib/perl5/5.6.1
/usr/lib/perl5/site_perl/5.6.1/i386-linux
/usr/lib/perl5/site_perl/5.6.1
/usr/lib/perl5/site_perl/5.6.0/i386-linux
/usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl .) at
/var/www/html/mixed/apply.cgi line 5.
[Thu Aug 30 18:57:09 2001] [error] [client 192.168.0.77] Premature end
of script headers: /var/www/html/mixed/apply.cgi

What happened? Please help. Thank you very much.


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

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 1654
***************************************


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