[8618] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2235 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 2 15:17:45 1998

Date: Thu, 2 Apr 98 12:00:28 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 2 Apr 1998     Volume: 8 Number: 2235

Today's topics:
    Re: A problem for Perlxs or Perlxstut (Ken Fox)
    Re: Anon Scalar Expression (was: Evaluate expression in (Jason Gloudon)
    Re: Anon Scalar Expression (was: Evaluate expression in (Kevin Reid)
        Conversion of Excel file to Text file <shakeel@ti.com>
    Re: current week <jhi@alpha.hut.fi>
    Re: eval with text files (Andrew M. Langmead)
    Re: eval with text files (Andre L.)
    Re: how to count a list of comma sep. items (Jason Gloudon)
    Re: how to count a list of comma sep. items <ajohnson@gpu.srv.ualberta.ca>
    Re: Is there a "Newsgroup" for Newbies to Perl? smitty77@pacbell.net
    Re: majordomo <jmscott@ainet.com>
    Re: Multidimensional Arrays (Kevin Reid)
    Re: Multidimensional Arrays (Jason Gloudon)
    Re: Multidimensional hashes (Kevin Reid)
    Re: Multidimensional hashes webmaster@dataplusnet.com
    Re: newbie question:how to embed perl in html <karld@feklore.demon.co.uk>
    Re: password input (Jason Gloudon)
    Re: Position in Toronto & Question (Andre L.)
    Re: Problems with using 'glob' under IIS and NT (Kevin B Cohen)
    Re: readdir/grep/map (Kevin B Cohen)
    Re: Record size of DBM Hashes (Jason Gloudon)
        Starting long (background) jobs from CGI. Please help! <frishman@mips.biochem.mpg.de>
    Re: Textarea Problems <karld@feklore.demon.co.uk>
    Re: unpack vs. substr (was Re: Data Structure for Input <Clinton.Bodine@mci.com>
        Why does $# cause loss of newline? <jalukas@lucent.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 2 Apr 1998 18:04:53 GMT
From: kfox@pt0204.pto.ford.com (Ken Fox)
Subject: Re: A problem for Perlxs or Perlxstut
Message-Id: <6g0k05$d2a4@eccws1.dearborn.ford.com>

tye@fohnix.metronet.com (Tye McQueen) writes:
> And [xsubpp, typemaps, etc.] is very good at doing that for very
> simple cases.  It sucks at doing it for complex cases.  All I'm
> saying is do the simple stuff in XS and do the complex stuff in
> Perl code that calls the XS interfaces.  Note that I'm _not_ saying
> that the module writer should only do the simple stuff, just that
> the module writer should know which parts of the module to write
> in C and which parts to write in Perl.
> 
> And my strongly held opinion is that the "right stuff" to do in
> C is almost always >>>as little as possible<<<.

Ok.  I understand your view.  I thought you were recommending using pack()
and unpack() as the user interface to your module.  If you have a layer on
top of your XSUBs which hides the use of pack() and unpack(), then I agree
that's reasonable.  You can still do all the things I recommended, e.g.
create objects or tied arrays to simplify the user interface.

In my experience, writing C code as the interface between C and Perl is
pretty easy and has excellent performance.  I'd prefer that to using
pack() and unpack() -- even though writing Perl code is generally easier
than writing C code.  I think we can both agree that xsubpp and the
typemaps should be expanded to make more things simple.

I think the only time your approach breaks down is when the memory layout
of the C structures isn't known.  For example, if the structures are
opaque or if your code is using C++ classes (for which there aren't any
memory layout standards).  For simple arrays of doubles, pack() away. ;)

- Ken

-- 
Ken Fox (kfox@ford.com)                  | My opinions or statements do
                                         | not represent those of, nor are
Ford Motor Company, Powertrain           | endorsed by, Ford Motor Company.
Analytical Powertrain Methods Department |
Software Development Section             | "Is this some sort of trick
                                         |  question or what?" -- Calvin


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

Date: Thu, 02 Apr 1998 18:53:33 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: Anon Scalar Expression (was: Evaluate expression inside print "")
Message-Id: <slrn6i7ngd.4dn.jgloudon@manitoba.bbn.com>

Bart Lateur <bart.mediamind@tornado.be> wrote:
>David A. Black wrote:
>
>>Hmmmm....  somewhere in all this, though not very lucidly, I think I'm
>>beginning to understand why it makes sense for \($x,$y,$z) to evaluate
>>to a list of refs....
>
>I've tried this:
>
>	$b = \(10,20,30);
>
>and printing $b show it's a ref to a SCALAR. I check the value, and it's
>30.

Bart, if you were looking for a list of references, perhaps you should have 
assigned it to an array ?

tabasco:stats>perl
print \(10,20,30);
SCALAR(0x109164)SCALAR(0x109170)SCALAR(0x10917c)

According to perlref:

         Note that taking a reference to an enumerated list is
         not the same as using square brackets--instead it's the
         same as creating a list of references!

             @list = (\$a, \@b, \%c);
             @list = \($a, @b, %c);      # same thing!


-- 
Jason Gloudon


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

Date: Thu, 2 Apr 1998 14:29:43 -0500
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Anon Scalar Expression (was: Evaluate expression inside print "")
Message-Id: <1d6v1iz.21uzz9n7y30iN@slip166-72-108-96.ny.us.ibm.net>

Bart Lateur <bart.mediamind@tornado.be> wrote:

> David A. Black wrote:
> 
> >Hmmmm....  somewhere in all this, though not very lucidly, I think I'm
> >beginning to understand why it makes sense for \($x,$y,$z) to evaluate
> >to a list of refs....
> 
> I've tried this:
> 
>       $b = \(10,20,30);
> 
> and printing $b show it's a ref to a SCALAR. I check the value, and it's
> 30.
> 
> Same result when I repalce the numbers with variables.
> 
> What do you mean, \($x,$y,$z) evaluates to a list of refs? Or do you
> mean that that is what you think it ought to do?

\($x,$y,$z) is equivalent to (\$x,\$y,\$z).

-- 
  Kevin Reid.      |         Macintosh.
   "I'm me."       |      Think different.


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

Date: Thu, 02 Apr 1998 13:25:44 -0600
From: M Shakeel Qureshi <shakeel@ti.com>
Subject: Conversion of Excel file to Text file
Message-Id: <3523E638.3C5F82AF@ti.com>

Hello guys,

If it is possible to convert excel file to plain text file using perl.
If yes then How ?


Regards,
*Shakeel


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

Date: 02 Apr 1998 21:41:30 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: current week
Message-Id: <oeewwd812xx.fsf@alpha.hut.fi>


> FRANCOIS> method I can use to calculate the current
> FRANCOIS> weeknumber (1 - 52) ?  Can I use the localtime

Nitpick: 1-5.

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


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

Date: Thu, 2 Apr 1998 18:47:23 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: eval with text files
Message-Id: <Eqsuv2.CxE@world.std.com>

Soccerweb <soccerweb@iotp.demon.co.uk> writes:

>I want
>to be able to convert the variables in the text file and then attach the
>headers etc. to the e-mail and post. But, I can't manage to change
>$country to Spain when $country eq "Spain". 

Have you seen the FAQ entry "How can I expand variables in text
strings?" <URL:http://www.perl.com/CPAN/doc/manual/html/pod/
perlfaq4/How_can_I_expand_variables_in_te.html>

But one thing to notice, is that the varialbes in the text file aren't
really variables, they are just tokens to signifiy where the parts to
interpolate are. Its just a coincidence that they look like the tokens
that perl uses. You could use any character sequence you would like,
and you could grab the replacement varialbes from anywhere you would
like. A replacement token that is less likely to be used in regular
text may be desired, and limiting the replacement text to a single
hash may be prefered)


%replace = (country => 'USA');
$text = 'as a researcher for %%country%%';

$text =~ s/%%(\w+)%%/$replace{$1}/g;
print "$text\n";

Or to check to ensure that you have a machine replacement for
everything:

while(s/%%(\w+)%%/$replace{$1}/g) {
   die "No replacement for $1\n" unless exists $replace{$1};
}

You also might want to take a look at the Text::Template module:
<URL:http://reference.perl.com/module.cgi?Text::Template>

-- 
Andrew Langmead


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

Date: Thu, 02 Apr 1998 14:42:21 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: eval with text files
Message-Id: <alecler-0204981442210001@dialup-647.hip.cam.org>

In article <wb7opEAIZ8I1EwKx@iotp.demon.co.uk>, Soccerweb
<soccerweb@iotp.demon.co.uk> wrote:

> Hello, I'm writing a Perl CGI script that enables the webmaster to
> automatically send various e-mails for administration purposes. All the
> e-mail content are stored as text files, however the e-mail content
> states thing like "as researcher for $country" or "Hello $name,". I want
> to be able to convert the variables in the text file and then attach the
> headers etc. to the e-mail and post. But, I can't manage to change
> $country to Spain when $country eq "Spain". So the posted e-mail's still
> state "as researcher for $country", I've tried eval but it doesn't work,
> any suggestions?

Sure.

Use these on the file's text:

s/\$country/$country/ge;
s/\$name/$name/ge;

Those will evaluate $country and $name to their current values.

HTH,

A.L.


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

Date: Thu, 02 Apr 1998 18:48:51 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: how to count a list of comma sep. items
Message-Id: <slrn6i7n7j.4dn.jgloudon@manitoba.bbn.com>

Greg Bacon <gbacon@cs.uah.edu> wrote:
>: A list in scalar context yields the number of elements
>: in the list, so....
>
>Yes, I realize the absence of the GENERAL RULE, but I meant list as
>in
>
>    print "I have ", scalar (1, 2, 3), " things.\n";

I'm not sure what you were trying to show, but you chose a bad example
regardless.

print "I don't have ", scalar ('apples', 'oranges', 'bananas'), " things.\n";
print "I don't have ", scalar (3, 2, 1), " things.\n";

-- 
Jason Gloudon


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

Date: Thu, 02 Apr 1998 12:57:40 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: how to count a list of comma sep. items
Message-Id: <3523DFA4.5FD51036@gpu.srv.ualberta.ca>

Greg Bacon wrote:
> 
> Sorry to followup to my own article, but...
> 
> In article <6g0fl7$l7u$4@info.uah.edu>,
>         gbacon@cs.uah.edu (Greg Bacon) writes:
> : A list in scalar context yields the number of elements
> : in the list, so....
> 
> Yes, I realize the absence of the GENERAL RULE, but I meant list as
> in
> 
>     print "I have ", scalar (1, 2, 3), " things.\n";

that only gives a correct count by coincidence:

print "I have ", scalar (2, 4, 6), " things.\n";

gives(with -w):
Useless use of a constant in void context at - line 1.
Useless use of a constant in void context at - line 1.
I have 6 things.

regards
andrew


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

Date: 2 Apr 1998 09:47:23 -0800
From: smitty77@pacbell.net
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <6g0ivc$daq@co-op.newsguy.com>

In article <news-0204980900530001@buzz.alink.net>, news@russo.org says...
>
>In article <6fu9op$43l@co-op.newsguy.com>, smitty77 wrote:
>
>>I've hardly 'broadsided' you, Randal.  I simply pointed out an observation.  I
>>will explain myself, but isn't it ironic that you get so defensive right off
>>the bat - somewhat like an inexperienced perl programmer who has been flamed
>>in this newsgroup by someone who 'broadsides' them.
>
>You're a very small man, basking in the limelight of your attempt to "take
>down" a celebrity.

A celebrity?  You don't get out much, do you Chris.  In what way am I attempting
to take down Randal Schwartz?  Is the guy perfect?  Have you ever met him?   If
you have something interesting to say, then say it, Chris.  Don't be so closed
minded that you can't in your wildest dreams fathom that your hero might not be
perfect.  It's a brutal world out there, Chris.  Check it out sometime.

Dave

>Chris Russo
>
>-- 
>Chris Russo                          A-Link Network Services, Inc.
>news@russo.org                       Bolo me
>http://www.alink.net/~crusso


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

Date: Thu, 02 Apr 1998 11:09:26 -0800
From: "Joseph M. Scott" <jmscott@ainet.com>
Subject: Re: majordomo
Message-Id: <3523E266.64E2@ainet.com>

Well, thinking about this, you should be able to use something like
blat to mimic sendmail features.  I'm sure all of the path ref's would
have to be changed ( aka c:\path\to\what\ever instead of /usr/what/ever
).  
	I personally wouldn't be to excited about trying to make that work,
since I'm admittingly biased towards FreeBSD, but I suppose with a fair
amount of work it could actually be done.
	You may want to look at some of the SMTP/POP solutions for 95/NT that
support mailing list features, time wise at least that should would be
faster :-)

Joseph Scott
jmscott@ainet.com


John Goerzen wrote:
> 
> I doubt that this will be possible since Majordomo requires the
> services of a Unix Mail Transfer Agent (MTA) such as sendmail.  These
> things just simply aren't available for Windows 95.
> 
> You can, however, run Perl in general under Windows 95 -- there are
> details at www.perl.com.
> 
> John
> 
> "jim" <jim@fairford.co.uk> writes:
> 
> > Hi,
> > I'm new to Perl. What I want is to run majordomo (or another mailing list
> > program)
> > on a win95 machine.
> > any pointers would be gratefully received.
> >
> >       <jim@fairford.co.uk>
> 
> --
> John Goerzen                              Southwind Internet Access, Inc.


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

Date: Thu, 2 Apr 1998 14:29:45 -0500
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Multidimensional Arrays
Message-Id: <1d6v1md.1xjv0np1semszkN@slip166-72-108-96.ny.us.ibm.net>

Konstantin Kalaitzidis <kkalaitz@cisco.com> wrote:

> Hello,
> How can I create a multidimensional array?
> I wrote the very short script shown below, but I get errors:
> 
> "multidim.pl" [Read only] 5 lines, 148 characters
>      1  #!/usr/bin/perl
>      2  $multidim = [['1.1', '1.2', '1.3] , ['2.1', '2.2','2.3']];
You forgot a quote right here: -----------^

>      3  print  "$multidim->[0][2]\n";
>      4  print  "$multidim->[1][1]\n";
> ~
> 
> When I run the above script, I get:
> parse error in file ./multidim.pl at line 2, next 2 tokens "= ["
> EOF in string at ./multidim.pl line 2.


-- 
  Kevin Reid.      |         Macintosh.
   "I'm me."       |      Think different.


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

Date: Thu, 02 Apr 1998 19:30:22 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: Multidimensional Arrays
Message-Id: <slrn6i7ple.4dn.jgloudon@manitoba.bbn.com>

Konstantin Kalaitzidis <kkalaitz@cisco.com> wrote:
>Hello,
>How can I create a multidimensional array?
>I wrote the very short script shown below, but I get errors:
>
>"multidim.pl" [Read only] 5 lines, 148 characters
>     1  #!/usr/bin/perl
>     2  $multidim = [['1.1', '1.2', '1.3] , ['2.1', '2.2','2.3']];
                                         ^ you are missing a '

You can avoid using quotes by using the qq quoting mechanism. 

$multidim = [ [ qw(1.1 1.2 1.3) ] 
              [ qw(2.1 2.2 2.3) ]
            ];

-- 
Jason Gloudon


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

Date: Thu, 2 Apr 1998 14:29:49 -0500
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Multidimensional hashes
Message-Id: <1d6v1zq.oxovu61sy82h5N@slip166-72-108-96.ny.us.ibm.net>

<webmaster@dataplusnet.com> wrote:

> I'm using perl5.002 and need to know how to handle a multidimensional
> associative array.
> I'm using:
> $hash{$foo}{$bar} = $answer;
> and the error occurs:
> syntax error in file ./stats.cgi at line 253, next 2 tokens "}{"
> Can anyone tell me what I'm doing wrong?

There is nothing wrong with this code, perhaps you could show us the
code that creates the hash?

-- 
  Kevin Reid.      |         Macintosh.
   "I'm me."       |      Think different.


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

Date: Thu, 02 Apr 1998 13:45:03 -0600
From: webmaster@dataplusnet.com
Subject: Re: Multidimensional hashes
Message-Id: <3523EABE.DAA2C5C3@dataplusnet.com>

Both of these lines of code generate the error. These are the exact lines
from the script.
Remarking these lines allows the program to operate normally.

$multi_d_lastcode{"$line_1"}{"$i"} = $code_count;
$recent_last = $multi_d_lastcode{$pm_block}{$pm_c};

Kevin Reid wrote:

> <webmaster@dataplusnet.com> wrote:
>
> > I'm using perl5.002 and need to know how to handle a multidimensional
> > associative array.
> > I'm using:
> > $hash{$foo}{$bar} = $answer;
> > and the error occurs:
> > syntax error in file ./stats.cgi at line 253, next 2 tokens "}{"
> > Can anyone tell me what I'm doing wrong?
>
> There is nothing wrong with this code, perhaps you could show us the
> code that creates the hash?
>
> --
>   Kevin Reid.      |         Macintosh.
>    "I'm me."       |      Think different.





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

Date: Thu, 2 Apr 1998 20:10:40 +0100
From: Karl Dyson <karld@feklore.demon.co.uk>
Subject: Re: newbie question:how to embed perl in html
Message-Id: <nc5OzGAwK+I1EwI4@feklore.demon.co.uk>


>> >Ever heard of CGI?
>> Well let me see... Of course I've heard of CGI. And my response to the
>> posters question was based around getting the server to paste in the
>> output of a CGI proggy.
>> If that's not what he wanted then I appologise. But the wording was
>> "embed" CGI in the HTML and a SSI is probably what he wanted.
>People often say "embed" when they don't realize that that's not
>what they want.  
Sorry - I didn't realise you had to be pyschic to contribute to this
newsgroup.

>Besides, the poster (Bart van Praag, aka "M1") 
>only used the word "embed" in the subject line.  The text of his 
>message was this:
>
>> I have a perl script for a discussion group that outputs html.
>> if I type: perl script.pl it gives the desired html output in 
>> my shell account.
>> Question: How do i call this script from a html page?
>
>This tells me that whatever is printing to his tty when he runs
>the program at the command line, is what he wants to go to the
>client via http.  That clearly does not call for any embedding.
>CGI fits the bill nicely.  
I agree that what you've suggested is lovely - and I ask one question...

Why are we arguing? If I had interpreted the question as you had - I
would've given the same answer that you did.

>On the other hand, that is not to say
>that embedding wouldn't work; I'm sure it would.  In any case,
>he'll have to check/modify the header lines his program prints.
I'm not saying my suggestion was better. We've just answered slightly
different problems and now the poster has the answer he requires. Which
ever one it is. :)

I suppose the moral of this story is: be more specific in your posts for
help. :)

Karl
-- 
Karl Dyson <karld@feklore.demon.co.uk>
"A look can be deceiving; a touch can be lethal."


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

Date: Thu, 02 Apr 1998 19:14:01 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: password input
Message-Id: <slrn6i7omp.4dn.jgloudon@manitoba.bbn.com>

Mike Wescott <wescott@cygnus.ColumbiaSC.NCR.COM> wrote:
>Moreover, echoing * is not really a good idea (from a security point
>of view). A third party can easily see the number of characters in the
>password. This is information that can be used to reduce the search for
>the password. While there are other important considerations about password
>security, there is no point in an application gratuitously giving away
>the password's length.

I thought about saying that, but then i thought: if the person is close enough
to see the *'s then it doesn't take much more to see the person's keyboard,
or count the keystrokes one hears. It's all depends on the level of paranoia,
that is deemed appropriate, and the degree to which the environment is trusted.

-- 
Jason Gloudon


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

Date: Thu, 02 Apr 1998 13:46:53 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: Position in Toronto & Question
Message-Id: <alecler-0204981346530001@dialup-647.hip.cam.org>

Version 1 of Perl was introduced in January 1988 (Perl FAQ 1).

So, let's see...

@the_time = localtime(time);
$max_perl_exper = $the_time[5] - 88;
print "The most experience a person can have is $max_perl_exper years.\n";

# 'The most experience a person can have is 10 years.'

This being said, who wants to go work in Toronto?

Andre in Montreal 8-)

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

In article <01bd5e4d$cae770e0$e3845ad1@toronto-2>, "nwilson"
<nwilson@globalserve.net> wrote:

> My question is how long has Perl been around? What is the most experience
> in years a person can have?
> 
> 
> Web developer position available in Toronto Ontario Canada.
> 
> Perl is the most important skill the major bank is looking for in this full
> time position. It will be used in a NT UNIX environment.
> If Perl is your strong skill, please send your resume to


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

Date: 2 Apr 1998 14:14:44 -0500
From: kcohen@julius.ling.ohio-state.edu (Kevin B Cohen)
Subject: Re: Problems with using 'glob' under IIS and NT
Message-Id: <6g0o34$n3m@julius.ling.ohio-state.edu>

In article <3523827C.4DB65164@rmg.net>, manne  <manne@rmg.net> wrote:
>I'm trying to run a CGI application at an NT server running MS IIS 3.0,
>but it seems that the server prevents me from using Perl's glob command.

hi,

many people have reported a similar problem.  the problem is neither
with perl nor NT, but with trying to communicate with NT through other
apps.  for instance, i've had the same problem with trying to use glob
in a perl script that runs with a visual basic app.

the solution that seems to work for everyone is to use the
opendir/readdir combination, instead of glob.  see., e.g., paul
hoffman's "perl5 for dummies", p. 214, for more on opendir and
readdir.

opendir(DIR, $my_directory) || die "sorry---$!\n":
@AllFiles = readdir(DIR);

@AllFiles now contains the contents of $my_directory, and you can go
thru them and find whatever you were globbing.

kevin




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

Date: 2 Apr 1998 14:22:28 -0500
From: kcohen@julius.ling.ohio-state.edu (Kevin B Cohen)
Subject: Re: readdir/grep/map
Message-Id: <6g0ohk$n9l@julius.ling.ohio-state.edu>

In article <35215A57.6F5992E1@coam.usm.edu>,
Peter Sakalaukus  <sakalauk@coam.usm.edu> wrote:
>Using the readdir examples in the "Camel Book", I've tried to
>read in the contents of a directory (skipping . .. and the file
>region.area) and then map the pwd directory onto each array element.
>
>I can only seem to either skip the unwanted files OR map the pwd
>but not both. I'm sure it can be done, but I'll be darned if I
>know.

i don't think this qualifies as "insight," but: why restrict yourself
to map?

@AllFiles = readdir(DIR);

foreach $file (@AllFiles) {
	if (-d $file) {
		next; # gets rid of . and ..
	}
	if ($file =~ /$something_i_don't_like/) {
		next;
	}
	if ($file =~ /$something_i_like)/) {
		push (@KosherFiles, $file);
	}
}

 ...or words to that effect.

kevin


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

Date: Thu, 02 Apr 1998 19:01:10 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: Record size of DBM Hashes
Message-Id: <slrn6i7num.4dn.jgloudon@manitoba.bbn.com>

Jamie Hoglund <jhoglund@mirage.skypoint.net> wrote:
 .
 .
>There is a comparison of DBM's in the perl lib somewhere. (the filename
>escapes me) 

The Comparision table is in AnyDBM_File.pm.

-- 
Jason Gloudon


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

Date: Thu, 02 Apr 1998 20:48:07 +0200
From: Dmitrij Frishman <frishman@mips.biochem.mpg.de>
Subject: Starting long (background) jobs from CGI. Please help!
Message-Id: <3523DD67.41C6@mips.biochem.mpg.de>

I am trying to start a long job from a CGI script without waiting for
the output (the results are returned via e-mail). I though the way to do
it would be to set  $| = 1 and then:

system("long_job &");

and then print the "thank you for submitting your request" message to my
HTML page, but the script still waits for the background job to finish
before it prints out the message. I tried:

exec "long_job";

but it did not help either. 

What can I do? 

Another question: how to start my backround job under csh? In the perl
doc I found a pointer to eg/nih programs, but I could not find any
further info, and I could not find these programs in my perl
directories.

Your help would be greatly appreciated.

Dmitrij Frishman


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

Date: Thu, 2 Apr 1998 20:51:24 +0100
From: Karl Dyson <karld@feklore.demon.co.uk>
Subject: Re: Textarea Problems
Message-Id: <ecqADKA8w+I1EwPZ@feklore.demon.co.uk>


Hi All,

I got the initial problems sorted but one thing still isn't working
right. The textarea isn't inserting the CR/LF commands when it wraps.

Using wrap="virtual" isn't working - and it's no good if users with
Internet Explorer can't operate the CGI proggy properly.

I'm writing what is best described as um.. a message board type thing.
The textarea is limited to 60 characters on the form. If they rely on
the textarea wrap then the final message sprawls across the screen in
one huge line when it's stored in an HTML file. 

But later in the app. I need to split the text into seperate lines and
add a ">" symbol to the output before each line. And then put it back in
a 60 column Textarea. Obviously, if the lines go beyong 60 characters
then the Textarea wraps them - so some lines don't have a ">" before
them.

Um... I've tried to explain that as best I could. I hope you follow. 

Someone mentioned a module Text::Wrap(?) but I can't find it on my
system or in the documentation - would this help me out? If not, can
anyone suggest what will? 

I'm relunctant to use a new module for reading input from the forms
since I've got pretty the much the whole application written apart from
this little problem.

Karl

(I must get around to buying a better Perl book. For god's sake - nobody
buy "Teach Yourself CGI Programming with Perl 5 in 5 Days". It's shit!)


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

Date: Thu, 02 Apr 1998 19:05:13 GMT
From: Clinton Bodine <Clinton.Bodine@mci.com>
To: jgloudon@bbn.com
Subject: Re: unpack vs. substr (was Re: Data Structure for Input File)
Message-Id: <3523E140.52039BE3@mci.com>

You were right, it wasn't fair.... but it did emphasize an important point
in my program.  If I use substr, I can pick and choose which fields I want
very easily.  If I use unpack, I'm going to have to read the entire record
and then pick and choose.

Anyway, I've modified my program....


print "Substr:  ";timethis(10000000, '$detail = substr($m, 0, 10)');
print "Unpack:  ";timethis(10000000, '@arr = unpack("a10", $m)');
print "Unpack2: ";timethis(10000000, '($arr) = unpack("a10", $m)');
---------------------------------------------------------------------
Substr:  timethis 10000000: 22 secs (22.03 usr  0.00 sys = 22.03 cpu)
Unpack:  timethis 10000000: 78 secs (79.12 usr  0.00 sys = 79.12 cpu)
Unpack2: timethis 10000000: 60 secs (60.12 usr  0.02 sys = 60.13 cpu)

Or  454,545 substrs/sec vs.  126,582 unpacks/sec. 
vs. 166,666 unpacks-to-a-scalar/sec.

Jason Gloudon wrote:

> You didn't ask unpack and substr to do the same amount of work, so why should it
> take the same amount of time?
> 
> You asked unpack to extract the entire record, and copy it into an array.
> You asked substr to copy the first ten bytes from one scalar to another.
> Hardly a fair comparison, Try unpack ("a10", $m).
> 
> --
> Jason Gloudon

-- 
Clinton Bodine
Email: Clinton.Bodine@mci.com


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

Date: Thu, 02 Apr 1998 13:52:48 -0600
From: John Lukas <jalukas@lucent.com>
Subject: Why does $# cause loss of newline?
Message-Id: <3523EC90.473C@lucent.com>

I expected the program:

	chmop (my $today = qx/date '+%y%m%d'/);
	print "$today\n";

to print:

	980402

What I got was correct, except that the newline was lost; e.g.:

	980402my-prompt:

I traced it down to the fact that the program of which this is a
fragment contains (via a require):

	$# = "%.6g";

Now, I know that use of $# is deprecated, except that some of the
programs that I support are very old, and I don't want to pull $#
out of them without first understanding what-is-going-on. For
instance, after finding that $# was the culprit, I figured that it
was because $today "looks" like a number, $# was being used, and
somehow eating up that newline. So I thought that:

	printf ("%6s\n", $today);

would force $today to be interpreted as a string, and so fix my
problem, but it did not work out that way. I did find that

	print "<$today>\n";

works like I expect.

Can anyone help me to understand this situation? TIA.

I am using v 5.004_04 built for sun4-solaris.
-- 

	John Lukas
	630-224-6290
	jalukas@lucent.com


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". 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". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 2235
**************************************

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