[13032] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 442 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 10 09:07:49 1999

Date: Tue, 10 Aug 1999 06:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 10 Aug 1999     Volume: 9 Number: 442

Today's topics:
    Re: ActivePerl PerlScript -- funny problems <Nick@ucecom.com>
        chop? Split? help? <webmaster@fatzero.com>
    Re: chop? Split? help? (Anno Siegel)
    Re: chop? Split? help? (Graham Ashton)
    Re: Chopping up a HUGE file (Michel Dalle)
        DBD Driver for Lotus Notes <dcaddell@talk21.com>
        Displaying form data before emailing... please help... <pelibrief@aol.com>
    Re: eval <cantrela@agcs.com>
    Re: finding array size (Bart Lateur)
    Re: help with dataconn methods (Anno Siegel)
    Re: HELP!!! DBI problems. (Michel Dalle)
    Re: How to count clicks to HTML link. <flavell@mail.cern.ch>
        ldap hang <dgayhart@walcoff.com>
    Re: Little Puzzle I can't solve . . . <cantrela@agcs.com>
    Re: Loading a web page alexander.zinniker@trivadis.com
    Re: Looking for a good Perl Book <elaine@chaos.wustl.edu>
    Re: memcpy problem (Anno Siegel)
    Re: Optimize Perl programs question (never mind) <mats.pettersson@falukuriren.se>
        Optimize Perl programs question <mats.pettersson@falukuriren.se>
    Re: Optimize Perl programs question (Bart Lateur)
    Re: Passing Parameters (Michael Rubenstein)
        perl prog: Top site thingy.. arpith@hotmail.com
    Re: perldoc and activeperl help (Michel Dalle)
    Re: perldoc and activeperl help (Eric Bohlman)
    Re: POST via Imagemap - How? (Michel Dalle)
    Re: pricing a perl job (Andreas Fehr)
    Re: pricing a perl job <tmornini@netcom9.netcom.com>
    Re: pricing a perl job <revjack@radix.net>
    Re: pricing a perl job <elaine@chaos.wustl.edu>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Tue, 10 Aug 1999 10:07:09 +0100
From: "Nick Liebmann" <Nick@ucecom.com>
Subject: Re: ActivePerl PerlScript -- funny problems
Message-Id: <7oor1q$b29$1@nclient9-gui.server.ntli.net>

You cannot embed perl script into HTML code. It's the other way round, the
HTML code can be embedde inot the perl and the code cxan then be called up.

You can't use Language= "Perlscript"...

Try rearranging the code so that all of the perl and html are separate and
then you can call up the subs in turn eg.

&foo;
&*Your-HTML-code;


sub foo  {
 ......


}

sub HTML {
return <<code;
 ......Your cose here.. $document....

code
}

I hope that helps






John M. Dlugosz <john@dlugosz.com> wrote in message
news:9AAE839D71B8FC6D.3AB3323DC4B76392.3902CF75BC3996F5@lp.airnews.net...
> Here is an illustration of the problem I mentioned earlier (see test.html
> file below).  If $main::document is assigned to, the Perl engine crashes.
> It doesn't even have to execute that statement -- just having it in the
> script is enough!  When the problem line is commented out, you will see a
> report on all the symbols in the main package.  'document' is not one of
> them.
>
> Can anybody shed some light on this, please?
>
> --John
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
> "http://www.w3.org/TR/REC-html40/strict.dtd">
>
> <html lang="en">
> <head>
>  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
>  <title>script testing</title>
>
>
>
> <SCRIPT LANGUAGE="PerlScript">
> sub foo
>  {
>  foreach $name (sort keys %main::) {
>     $window->document->write ("$name<BR>");
>     }
>  }
>
> sub bar
>  {
>  # this works.
>  $documentX= 5;
>  #this crashes Perl
> # $document= 5;     #un-comment this line to illustrate problem.
>  }
>
> </SCRIPT>
> </head>
>
> <body>
> <SCRIPT LANGUAGE="PerlScript">
> foo();
> # note that bar isn't called! The presence of $document= in the program is
> enough to cause problems.
> </SCRIPT>
> </body>
>
>
>
>
>




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

Date: Mon, 9 Aug 1999 15:54:27 -0700
From: "fatzero" <webmaster@fatzero.com>
Subject: chop? Split? help?
Message-Id: <37b011e4@news.gci.net>

I have got this to return a list of files in a directory but what I was
trying to figure out is how I can remove the .txt or whatever from the end
of each. I have tried to figure it out but I really am just shooting in the
dark and nothing seems to work. I wanted to end up putting it into a link
later on like http://www.blah.com/cgi-bin/@allfiles[0]
I tried split, chop, s/// ,but I hardly know what they do I'm learning every
thing from other peoples code and it is slow going.
if can point me in the right direction thank you!
peek@gci.net

this prints out the files.
opendir BUSDIR, "$basepath$pagedir" || die "Unable to open directory: $!";
@allfiles = readdir BUSDIR;
closedir BUSDIR;
######## had to shift it twice to get rid of . and .. don't know if this is
right but it worked? #####
shift @allfiles;
shift @allfiles;
print "@allfiles\n";





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

Date: 10 Aug 1999 12:24:23 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: chop? Split? help?
Message-Id: <7op5ln$n3k$1@lublin.zrz.tu-berlin.de>

fatzero <webmaster@fatzero.com> wrote in comp.lang.perl.misc:
>I have got this to return a list of files in a directory but what I was
>trying to figure out is how I can remove the .txt or whatever from the end
>of each. I have tried to figure it out but I really am just shooting in the
>dark and nothing seems to work. I wanted to end up putting it into a link
>later on like http://www.blah.com/cgi-bin/@allfiles[0]
>I tried split, chop, s/// ,but I hardly know what they do I'm learning every
>thing from other peoples code and it is slow going.
>if can point me in the right direction thank you!
>peek@gci.net
>
>this prints out the files.
>opendir BUSDIR, "$basepath$pagedir" || die "Unable to open directory: $!";
>@allfiles = readdir BUSDIR;
>closedir BUSDIR;
>######## had to shift it twice to get rid of . and .. don't know if this is
>right but it worked? #####
>shift @allfiles;
>shift @allfiles;
>print "@allfiles\n";

Your method assumes that . and .. are the first directories to come
out of readdir.  While this may usually be true, there is no guarantee.
Also, you are reading all of the directory into @allfiles.  This is
generally not necessary, though there are exceptions.

The standard idiom to remove a file extension ( the last dot and
everything that follows) is s/\.[^.]*$//.  Putting it all together
(untested):

#!/usr/bin/perl -w
use strict;

# do some stuff here

opendir BUSDIR, "$basepath$pagedir" || die "Unable to open directory: $!";
while ( $_ = readdir( BUSDIR) ) {
  next if m/^\.$/;      # skip .
  next if m/^\.\.$/;    # and ..
  s/\.[^.]*$//;         # remove any file extension
  # now do what must be done with $_
  # push it on @allfiles if you must
}
close BUSDIR;
__END__

Anno


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

Date: 10 Aug 1999 12:34:17 GMT
From: billynospam@mirror.bt.co.uk (Graham Ashton)
Subject: Re: chop? Split? help?
Message-Id: <slrn7r0726.2ua.billynospam@wing.mirror.bt.co.uk>

In article <37b011e4@news.gci.net>, fatzero wrote:

>I have got this to return a list of files in a directory but what I was
>trying to figure out is how I can remove the .txt or whatever from the end
>of each. 
>
>this prints out the files.
>opendir BUSDIR, "$basepath$pagedir" || die "Unable to open directory: $!";
>@allfiles = readdir BUSDIR;
>closedir BUSDIR;
>######## had to shift it twice to get rid of . and .. 

have a look at "perldoc -f grep", and then try this;

    #!/usr/bin/perl -w
    
    $mydir = $ENV{HOME} || $ENV{LOGDIR};
    opendir MYDIR, $mydir or die "$mydir: $!\n";
    @files = grep { !/^(\.|\.\.)$/ } readdir MYDIR;
    closedir MYDIR;
    
    foreach $file (@files) {
        print "$file\n";
    }

Do you see what grep is doing? It's passing through anything that
doesn't match the regular expression (the bit between the two slashes).
Normally it passes through things that do match, but the regex has got a
"!" infront of it.  The regex only matches a single or double dot (see
"perldoc perlre" for more).

I didn't quite get the gist of why you wanted to remove .txt from the
end of each file name, but you could use another regular expression.

First, you could list just the *.txt files in the first place;

    @files = grep { /\.txt$/ } readdir MYDIR;

Or, after you've got your list of all files, you could remove .txt from
the ones that have .txt on the end;

    foreach $file (@files) {
        $file =~ s/\.txt$//;
    }

-- 
Graham

P.S. <billynospam@mirror.bt.co.uk> is a fully working address...


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

Date: Tue, 10 Aug 1999 09:34:48 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Chopping up a HUGE file
Message-Id: <7oorrj$8m6$1@news.mch.sbs.de>

In article <7ol849$h16$1@gxsn.com>, "Andy Chantrill" <andycha@globalnet.co.uk> wrote:
>Hey,
>
>I have a few HUGE files here that I use a script to parse ... my problem is
>however, that it is reading these files into arrays, which causes my
>computer to just run out of memory ...

So change the script.
You probably have something like this in your script :

@array = <FILE>;
foreach (@array) {
        # do something with each line
}

Replace it with this :

while (<FILE>) {
        # do something with each line
}

If you don't know anything about Perl, buy a book, or ask somebody
who knows a little bit more...

Michel.


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

Date: Tue, 10 Aug 1999 13:04:44 +0100
From: "Declan" <dcaddell@talk21.com>
Subject: DBD Driver for Lotus Notes
Message-Id: <37b0154d.0@nnrp1.news.uk.psi.net>

All,

Has anyone come across a DBD driver for Lotus Notes?

Thanks,
D.





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

Date: Tue, 10 Aug 1999 03:24:18 -0800
From: Pelican Brief <pelibrief@aol.com>
Subject: Displaying form data before emailing... please help...
Message-Id: <934284262.28723@www.remarq.com>

Hello everyone,

I'm stuck with a cgi script.

I'd like to display the data from a form before it is
emailed so it can be checked/verified. I can get the two
components of this idea to work (the displaying and the
mailing) but am stuck as to how to put the two together.

I'm guessing I need to know how to wait for an OK from the
visitor before the MAIL starts - but is this all part of
the one script?

See... I am confused...

Any help would be appreciated.

Thanks in advance.

Iain



* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!


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

Date: Tue, 10 Aug 1999 05:49:12 -0700
From: Andy Cantrell <cantrela@agcs.com>
To: renorum@my-deja.com
Subject: Re: eval
Message-Id: <37B01FC8.7F2BE536@agcs.com>


 Try the following - note differences in direct call v.s.
 calling through the 'eval' function.


  $func = "add" ;
  sub add {
    print "add function>@_<\n";
    return qq(print "return val\n";);
  };
  &{$func}('foo', 'bar') ;
  eval(&{$func}('bar', 'foo')) ;



renorum@my-deja.com wrote:
> 
> I am trying to use eval to call a certain subroutine depending on the
> value of a given variable:
> 
>           eval($action());
> 
> where $action could be either "add" or "delete" or "edit".  I have
> written the subroutines add(), delete() and edit().
> 
> Am I using this correctly? (because it doesn't seem to be working)  Is
> this not what eval is used for?  Is there some better way to effect
> this result (other than the obvious
>           if ($action eq "add") { add(); }
>           elsif ($action eq "delete") { delete(); }     ...etc, etc.)
> 
> Any help greatly appreciated.  Thanks.
> 
> Roger Norum
> 
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

-- 
Andy Cantrell  - cantrela@agcs.com
AG Communication Systems
Office (AZ) (623) 582-7495 (Voice mail)
Office (WI) (414) 249-0215
Modem  (WI) (414) 249-0239


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

Date: Tue, 10 Aug 1999 09:59:18 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: finding array size
Message-Id: <37aff747.7702407@news.skynet.be>

Margaret Escherich wrote:

>It's easy to find the size (in bytes) of a file with -s.
>
>How do you find the size of an array or a splice?  how could I, for example, take 400 bytes of an
>array?

Why?

A silly question, I know, but since Perl has dynamic memory allocation,
usually you don't have to worry one bit about how big a scalar or an
array item actually is.

If you really want to know, convert an array slice into a string, and
get the length() of the string.

	@slice = @ary[10..19];
	$stringified = join '', @slice;
	$bytes_used = length $stringified;

	Bart.


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

Date: 10 Aug 1999 11:56:35 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: help with dataconn methods
Message-Id: <7op41j$n1d$1@lublin.zrz.tu-berlin.de>

hojo  <i_tel@my-deja.com> wrote in comp.lang.perl.misc:
>To All,
>
>Net::FTP objects have the retr method that returns a reference to a
>dataconn object.  However, I am having a hard time figuring out how to
>use the dataconn reference.  Where is this beast documented (its methods
>and examples)?

Why, right in the Net::FTP perldoc.  Where have you been looking?

Anno


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

Date: Tue, 10 Aug 1999 09:49:10 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: HELP!!! DBI problems.
Message-Id: <7oosmh$a5k$1@news.mch.sbs.de>

In article <37ae9f76.1@spine.brain.net.pk>, "Sherry" <psychosherry@email.com> wrote:
>Sorry.I know this a PERL group, but I am desparate.
>I am having problems installing DBI modules for perl 5.005.
>I unzipped the DBI-1.13 module into my c:\perl\lib directory. And then I
>typed <perl Makefile.pl> at my MS-DOS prompt in c:\perl\lib\dbi-1.13\.
>And then when I type <make> nothing happens.
>
>When I run my script it gives the following error:
>Can't locate loadable object for module DBI in @INC (@INC contains
>c:\perl\lib   c:\perl\site\lib)
>Can't locate DBI.pm in @INC.
>BEGIN failed.......compilation aborted
>

Assuming you're using the ActiveState Perl distribution, you
can use the following sequence :

c:\perl> ppm
 ..
PPM> install DBI
 ..
PPM> install DBD-[whatever driver you need]
 ..
PPM> quit
c:\perl>

That's all. Let ppm do the work for you, instead of trying
to install it yourself :-)

Michel.


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

Date: Tue, 10 Aug 1999 11:54:01 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: How to count clicks to HTML link.
Message-Id: <Pine.HPP.3.95a.990810115122.4609B-100000@hpplus03.cern.ch>

On Tue, 10 Aug 1999, Damani Walton wrote:

> brian@pm.org (brian d foy) writes:
> 
> > that your server has to serve the page, which is not the number of
> > times that the page was viewd.  some people get that confused.  
> > whether or not your design is broken depends on what you are trying
> > to count.
> 
> What do you mean by "viewed"? 

One can see that you've grasped the problem.

Now re-read what the Subject line says.  I'm sure you'll agree that
there is an incompatibility.



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

Date: Tue, 10 Aug 1999 08:46:43 -0400
From: Dean Gayhart <dgayhart@walcoff.com>
Subject: ldap hang
Message-Id: <37B01F33.8C650E97@walcoff.com>

hi.  anyone know why an ldap script may be hanging even after it does
its task?
it completes its task from the command line but not when called from a
web page.
any ideas?



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

Date: Tue, 10 Aug 1999 05:41:26 -0700
From: Andy Cantrell <cantrela@agcs.com>
To: lenny@avv.com
Subject: Re: Little Puzzle I can't solve . . .
Message-Id: <37B01DF6.8B3415EF@agcs.com>


 Don't know if you received a reply for this yet, but
 here's one that might help.  Note that the value you
 have in your @vin contain non-digit characters.  When
 you use the   !=   comparison operator, perl is trying
 to look at your variable as a number, sees a zero, and
 says FALSE.

 I retried the basic code structure using the    eq
 comparison operator and it works as you'd hope it would.

Chris Lentz wrote:
> 
> Can't seem to figure out why this is happening.
> 
> Basic question: why doesn't the "if" statement evaluate to true
> when the variable begins with a zero?
> 
> Any answers would be greatly appreciated:
> 
> Here's the code:
> ---------------------------begin code-----------------------------------
> print "FIRST TRY WITH (0,17) as the string\n";
> local(@vin);
> $vin[0] = "0,17";
> print   "HERE'S THE VALUE OUTSIDE THE IF:(", $vin[0], ")\n";
> if ( $vin[0] != "") {
>         print   "HERE'S THE VALUE INSIDE IN IF 1:(", $vin[0], ")\n";
> }
> print "\n\n\nNOW TRY WITH (1,17) as the string\n";
> local(@vin);
> $vin[0] = "1,17";
> print   "HERE'S THE VALUE OUTSIDE THE IF:(", $vin[0], ")\n";
> if ( $vin[0] != "") {
>         print   "HERE'S THE VALUE INSIDE IN IF 2:(", $vin[0], ")\n";
> }
> print "WHY THE DIFFERENCE?\n";
> 
> print "\n\n\nNEXT TRY WITH (0,17) as the string and a variable instead of an arr
> ay\n";
> local($vin);
> $vin = "0,17";
> print   "HERE'S THE VALUE OUTSIDE THE IF:(", $vin, ")\n";
> if ( $vin != "") {
>         print   "HERE'S THE VALUE INSIDE IN IF 3:(", $vin, ")\n";
> }
> -----------------------------end code-----------------------------------
> 
> Here's the output:
> ----------------------------begin output--------------------------------
> FIRST TRY WITH (0,17) as the string
> HERE'S THE VALUE OUTSIDE THE IF:(0,17)
> 
> NOW TRY WITH (1,17) as the string
> HERE'S THE VALUE OUTSIDE THE IF:(1,17)
> HERE'S THE VALUE INSIDE IN IF 2:(1,17)
> WHY THE DIFFERENCE?
> 
> NEXT TRY WITH (0,17) as the string and a variable instead of an array
> HERE'S THE VALUE OUTSIDE THE IF:(0,17)
> ------------------------------end output--------------------------------
> 
> Thanks in advance.  Emails would be appreciated.
> --
> ************************
> * Christopher J. Lentz *
> * AVV Inc.             *
> * lenny@avv.com        *
> * 614-487-1436         *
> * 614-487-1955 (Fax)   *
> * http://www.avv.com/  *
> ************************

-- 
Andy Cantrell  - cantrela@agcs.com
AG Communication Systems
Office (AZ) (623) 582-7495 (Voice mail)
Office (WI) (414) 249-0215
Modem  (WI) (414) 249-0239


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

Date: Tue, 10 Aug 1999 07:57:41 GMT
From: alexander.zinniker@trivadis.com
Subject: Re: Loading a web page
Message-Id: <7oom1i$sv9$1@nnrp1.deja.com>

 ...
> But how do I get a Perl program to load a web page which
> already exists as an HTML file, without requiring the user

why want you to use a Perl script to display a Page that allready
exists?

> to click on anything?  (So printing out a <FORM action="myurl">
> and waiting for the user to click on "submit" is not acceptable.)

o.k. you could place this tag in your html code:

<a href=/cgi-bin/myscript.cgi?bla>Bla</a>

then you could use the follwing script to print your page:

Note: THIS IS DANGEROUS!!! with such a script everybody can display
every file on your machine the user with which the webserver is running
has access to (including /etc/passwd). So instead of passing the
filename you should pass a number or something else and then check in
your script which file should be displayed.

#!/usr/bin/perl

my $file = $ARGV[0];
open (IN, $file) || die 'couldnot open $file';
print "content-type: text/html\n\n";
while ($line=<IN>) {
   print $line;
}



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 10 Aug 1999 08:33:18 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: Looking for a good Perl Book
Message-Id: <37B01BBC.35D9DF38@chaos.wustl.edu>

[Courtesy copy sent to original author]

Michael Prendergast wrote:
> I'm looking for a good Perl book to learn from. I do have programming
> experience and I was wondering if any of you have a suggestion as to
> which is a good book to introduce me to the Perl language. I'm not
> *just* looking for an intro book though, I mean one with depth also, and
> some assignments/quizzes also.

http://www.amazon.com/exec/obidos/ts/browse-books/3986/002-0349356-3898241
Is a good place to start as this lists the oodles of Perl books out there.

If you already know C or C++, Nigel Chapman's "Perl Programmer's
Companion" is a really well done book. Tom Christiansen and Gnat
Torkington's "Perl Cookbook" is an essential and Joseph Hall's
"Effective Perl Programming" is great for more fun with Perl.

> Plus, does anyone know of a good online school to learn Perl/Unix?
> Preferably one with begginer and advanced Perl courses.

There are on-line docs and manuals though I am not certain of tutorials.
Have a go at http://www.perl.com/ see if it has any listings.

e.


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

Date: 10 Aug 1999 11:33:35 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: memcpy problem
Message-Id: <7op2mf$muk$1@lublin.zrz.tu-berlin.de>

Martien Verbruggen <mgjv@comdyn.com.au> wrote in comp.lang.perl.misc:
>In article <7onk4b$uta$1@poknews.pok.ibm.com>,
>	hjeeves@us.ibm.com (Helena Jeeves) writes:
>> Hello:
>> 
>> I have a problem with memcpy in Perl to C extensions.  The code reads:
>> 
>> memcpy(stringa, stringb, strlen(stringb) );
>> 
>> and it insists on putting more than just strlen(stringb) into stringa!
>
><OFFTOPIC>
>
>Not a perl problem. It's a C problem. To copy strings, you should be
>using the str* functions, that's what they're for. strcpy comes to
>mind. 
>
>If you insist on using memcpy, make sure that you take that
>terminating '\0' as well. The strlen won't be long enough. Oh.. If you
>use a malloc before this one, also make sure that you leave room for
>that '\0'.
>
></OFFTOPIC>

Another off-topic remark:

Don't use memcpy().  If you want it, use memmove().  It does the
same thing, but is safe for overlapping copies, at minimal cost.
I suppose, memcpy() is ancient legacy.  It shouldn't be there at
all.

Anno


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

Date: Tue, 10 Aug 1999 13:54:42 +0200
From: Mats Pettersson <mats.pettersson@falukuriren.se>
Subject: Re: Optimize Perl programs question (never mind)
Message-Id: <37B01302.81E9A1F6@falukuriren.se>

Sorry!

I don't know what i was thinking about. Ignore my former question.

Mats


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

Date: Tue, 10 Aug 1999 13:21:02 +0200
From: Mats Pettersson <mats.pettersson@falukuriren.se>
Subject: Optimize Perl programs question
Message-Id: <37B00B1E.F6652DBE@falukuriren.se>

Hi!

I usually begin my programs with various variable definitions/init's (a
habit from C programming) and then begin sanity checks and so on. But i
wonder if i could optimize my program by making variable
definitions/init's along the road as i need them or do Perl (at compile
time) parse the whole file anyway?

Mats


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

Date: Tue, 10 Aug 1999 11:36:58 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Optimize Perl programs question
Message-Id: <37b00db8.2421698@news.skynet.be>

Mats Pettersson wrote:

>I usually begin my programs with various variable definitions/init's (a
>habit from C programming) and then begin sanity checks and so on. But i
>wonder if i could optimize my program by making variable
>definitions/init's along the road as i need them or do Perl (at compile
>time) parse the whole file anyway?

The latter. Perl is NOT interpreted. It is compiled just before
execution, so the whole program is parsed before it is run.
Initializations, however, need only occur when thet statement is
encountered. Ex.

	{
		my $var = 'testing' x 3;
		print $var;
	}

The assignment line is compiled at startup, but the assignment, and
string calculation, is executed when this line is executed.

But, there's no need to bother. In general, the initializations will
probably only be a tiny fraction of the time spent running the program.

	Bart.


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

Date: Tue, 10 Aug 1999 11:19:59 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: Passing Parameters
Message-Id: <37b80a81.201852748@nntp.ix.netcom.com>

On Mon, 09 Aug 1999 16:01:59 GMT, amerar@ci.chi.il.us wrote:

>
>
>Hello,
>
>We are running Solaris 2.6 here.  I want to be able to pass command-line
>parameters to a Perl script.  How can I do this?

Look at @ARGV in perlvar.


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

Date: Tue, 10 Aug 1999 12:42:07 GMT
From: arpith@hotmail.com
Subject: perl prog: Top site thingy..
Message-Id: <7op6mt$7qp$1@nnrp1.deja.com>

Hi,

I'm a sorta newbie in perl. I just read a bit of a book on perl and I
want to actually make something for my site.

I was think of making a Top site ranking cgi-perl script with added
features such as no: ranking & adding comments etc (like in
cgi-resources.com). I haven't actually seen any examples, do you know
where I can find it ?

I was thinking of creating a writeable directory where the comments for
each site is stored in files-- one file for each account. Is this the
best approach, or should I have just one file for all sites ?

And a few more questions. How do I call another perl program from a perl
program itself ?

And:
CGI- related question :)

Supposing I, the user, was to run a cgi script. The cgi script starts,
gets the data from the form, processes it and is in the process of
storing the information into a file.

Supposing halfway through the saving, the user Presses the "Stop" button
on the browser, will the CGI script STOP execution midway ? or will it
continue till the end ? If it does stop, then the data file will get
corrupted right ?

Thanks for any help,

Arpith


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 10 Aug 1999 10:47:36 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: perldoc and activeperl help
Message-Id: <7op045$cvl$1@news.mch.sbs.de>

In article <7oogo2$ep8$0@216.39.133.87>, "Bart Simpson" <phony@nospam.com> wrote:
>I am running ActivePerl under Win98, and I download the perl docs so I could
>use "perldoc -f whatever" to look up commands, but it doesn't work so well
>under windows.

Oh yes, it does. See below.

>It works fine if its just a small amount of text returned, such as when I
>use "perldoc -f ucfirst", but when I try to look up 'substr' most of the
>info scrolls off the top of the screen.  Same as when I type "perldoc -h"
>
>Is there a switch to pause every screen?

* Sigh * Have you tried 'perldoc -f substr | more' ?

This is a standard way of showing the output of commands 'by page'.

>I tried redirecting to a file, like "perldoc -f substr>one.txt" that didn't
>work.

Probably a typo, because it's supposed to work too (and does here)...

>I do appreciate the answers I've been receiving, which tell me to look it up
>in perldoc, now I just need help with perldoc. Go figure. :)

As an alternative, you'll find a shortcut to the Online Documentation in
your Start Menu, under Programs/ActivePerl. That should keep you
busy for some time :-)

The perldoc -f stuff is located in the file 'perlfunc', under 'Core Perl 
Docs'.

Michel.


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

Date: 10 Aug 1999 12:03:48 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: perldoc and activeperl help
Message-Id: <7op4f4$esv@dfw-ixnews5.ix.netcom.com>

Michel Dalle (michel.dalle@usa.net) wrote:
: In article <7oogo2$ep8$0@216.39.133.87>, "Bart Simpson" <phony@nospam.com> wrote:
: >I am running ActivePerl under Win98, and I download the perl docs so I could
: >use "perldoc -f whatever" to look up commands, but it doesn't work so well
: >under windows.
: 
: Oh yes, it does. See below.
: 
: >It works fine if its just a small amount of text returned, such as when I
: >use "perldoc -f ucfirst", but when I try to look up 'substr' most of the
: >info scrolls off the top of the screen.  Same as when I type "perldoc -h"
: >
: >Is there a switch to pause every screen?
: 
: * Sigh * Have you tried 'perldoc -f substr | more' ?

It doesn't work under Win95.  The problem seems to be that perldoc is 
implemented as a batch file, and under some circumstances the STDOUT of 
a program called from a batch file doesn't get redirected or piped.  If I 
invoke it as 'perl \perl\5.00502\bin\perldoc.bat -f substr | more' it 
works properly.


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

Date: Tue, 10 Aug 1999 10:09:41 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: POST via Imagemap - How?
Message-Id: <7ootsv$a5k$2@news.mch.sbs.de>

In article <MPG.1218efae421960e0989e12@nntp.hpl.hp.com>, lr@hpl.hp.com (Larry Rosler) wrote:
>In article <37AF4472.71D55A1C@mail.cor.epa.gov> on Mon, 09 Aug 1999 
>14:13:22 -0700, David Cassell <cassell@mail.cor.epa.gov> says...
[snip]
>> Well *I* thought Abigail's intention was imminently clear.  But then,
>> I'm the sort of person who uses the word 'imminently' in conversation.
>
>When you should be using the word 'eminently'.  Ow!

Euh, you mean immanently ?

Michel.


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

Date: Tue, 10 Aug 1999 08:07:35 GMT
From: backwards.saerdna@srm.hc (Andreas Fehr)
Subject: Re: pricing a perl job
Message-Id: <37afdd2b.9734247@news.uniplus.ch>

On 10 Aug 1999 00:37:04 -0500, abigail@delanet.com (Abigail) wrote:

>[] 
>[] Would I have gotten a real response if I had posed as a client looking
>[] for a quote? Or has usenet simply ceased being a useful resource?
>
>
>Whiner.
>
>
>*ploink*
>

Hehehehe

I guess you don't save much diskspace killing all the people.
Your killfile grows faster than the messages arrive. :)

Andreas


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

Date: 10 Aug 1999 09:26:31 GMT
From: Tom Mornini <tmornini@netcom9.netcom.com>
Subject: Re: pricing a perl job
Message-Id: <7oor87$kta@dfw-ixnews8.ix.netcom.com>

brian d foy <brian@pm.org> wrote:

:    * i'm a lot better and faster than you are, so the time it takes
:    *me* to do the job is of no relevance to the amount *you* should
:    charge

:    * i cost a lot more than you do.

These statements are incredibly arrogant since they are likely not based on
fact, regardless of how true they might be.

If, Brian D. Foy, (correct capitalization and punctuation not accidental),
you know these statements to be true because you have worked with him AND
know what he charges, then I retract the above statement and humbly apologize.

If, on the other hand, they are based merely on what you think you know
from this person's posting, they are worthless statements regardless of
their correctness or probability of correctness and can only point to an
individual with a monstrously enlarged ego.

:> "How much would you charge for such a script?"

: to do that my starting price is $5,000.  from there it's $2000/day.
: i don't work on projects smaller than that.

Is that all that you charge? I've seen much higher.

And, telling him what you might charge, even in this vague way, probably
didn't hurt you one little bit.

: there is no way that
: you'll be able to get those rates.

Oh my! I'm sure no one else makes as much money as YOU do, hey Brian?

After spending a huge amount of time telling him how to charge, and
making it very clear to him that he can charge anything that he wants
and can get his client to agree to, why would you now suggest that he
couldn't POSSIBLY get some fixed amount? Perhaps his time is worth
$5000/hr. for reason's that you can't guess? Perhaps he won the lottery
recently for $60 million, and absolutely hates working with the person
that he did the work for.

Have you enjoyed talking down? I have. :-)

That said, I agree 100% with the advice you gave. Each contractor MUST
decide what they need to charge in precisely the way that you described,
which doesn't mean that there is no value in asking the question that
he asked, however.

-- Tom Mornini
-- InfoMania Printing & Prepress


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

Date: 10 Aug 1999 12:22:12 GMT
From: revjack <revjack@radix.net>
Subject: Re: pricing a perl job
Message-Id: <7op5hk$2fn$3@news1.Radix.Net>
Keywords: Hexapodia as the key insight

Tom Mornini explains it all:

:If, Brian D. Foy, (correct capitalization and punctuation not accidental),

But not correct. :)


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

Date: Tue, 10 Aug 1999 08:46:38 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: pricing a perl job
Message-Id: <37B01EDB.6ABA8704@chaos.wustl.edu>

Tom Mornini wrote: 
> If, Brian D. Foy, (correct capitalization and punctuation not accidental),

One of these days, I really must do a paper on the psychology of
capitalisation and lack thereof. So few shift keys, so many bunched
panties. Brian D. Foy is not the same person as brian d foy. 

> individual with a monstrously enlarged ego.

hubris as virtue. Welcome to Perl.

> Is that all that you charge? I've seen much higher.

In the economics of technology, currently we charge what the market will
bear. In the future this will not be the case so you may as well cash in
now while you can, if you can. :)

> couldn't POSSIBLY get some fixed amount? Perhaps his time is worth
> $5000/hr. for reason's that you can't guess? Perhaps he won the lottery
> recently for $60 million, and absolutely hates working with the person
> that he did the work for.

If I won the lottery, I'd be on my own personal caribbean isle with a
few towel boys and a supply of books from amazon.com shipped in weekly.
Maybe I would take a sojourn to Monaco for a month or two, but I doubt
that hanging out on clpm would be an attractive activity with so many
other possibilities at hand. 

> That said, I agree 100% with the advice you gave. Each contractor MUST
> decide what they need to charge in precisely the way that you described,
> which doesn't mean that there is no value in asking the question that
> he asked, however.

Everyone has their own thing and he made a few very good points about
getting it in writing, etc. Don't be such an insipid dork.

e.


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. Due to their sizes, neither the Meta-FAQ nor
the FAQ are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq" from
almanac@ruby.oce.orst.edu. 

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 V9 Issue 442
*************************************


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