[12871] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 281 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 28 07:07:59 1999

Date: Wed, 28 Jul 1999 04:05:10 -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           Wed, 28 Jul 1999     Volume: 9 Number: 281

Today's topics:
    Re: 3 dimensional array (Anno Siegel)
        [Perl] How to find the Perl FAQ <rootbeer&pfaq*finding*@redcat.com>
        a little motivation, anyone? (Medley8086)
    Re: beginner-redirect and download <james.williamson@bbc.co.uk>
        Can perl declare constant? <c8133594@comp.polyu.edu.hk>
    Re: Can perl declare constant? <ewinter@pop3.stx.com>
        cgi HTTP header information <richard.garside@zen.co.uk>
        Directory Listing with Size <Adrian.Duncan@trinite.co.uk>
    Re: Don't want to make file that owner is "NOBODY" (I.J. Garlick)
    Re: ebcdic packed numbers (Anno Siegel)
        how to print an hexadecimal with more than 32 bits <michel.combes@hl.siemens.de>
        How to: run a DOS batch in perl/cgi? <timnett@mindspring.com>
        HTML - perl timeout ? (Frederick Tant)
    Re: Newbie needs help to connect to MS Access (Andreas Fehr)
        Newbie Q: Replacing a string by an array <andrewf@beausys.demon.co.uk>
        Newsgroups for Perl on NT <carvdawg@patriot.net>
    Re: Perl and Internet Information Server 4? <carvdawg@patriot.net>
    Re: R: How I can read to a script output frome an other (Anno Siegel)
    Re: reg expression (I.J. Garlick)
    Re: reg expression <flavell@mail.cern.ch>
        REST/RETR in Net::FTP (Donovan Rebbechi)
    Re: Sending HTML emails from perl script <gellyfish@gellyfish.com>
    Re: Sending HTML emails from perl script (I.J. Garlick)
        sending table  file to MSQL with Perl (Layout/Design)
    Re: splitting an array - well not really but ... <hal9000@fetchmail.com>
    Re: splitting an array - well not really but ... <mike@crusaders.no>
    Re: splitting an array - well not really but ... (Gary O'Keefe)
        Standard Unix Compress <bbo>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 28 Jul 1999 09:56:23 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: 3 dimensional array
Message-Id: <7nmk47$ak9$1@lublin.zrz.tu-berlin.de>

Larry Rosler <lr@hpl.hp.com> wrote in comp.lang.perl.misc:
>[Posted and a courtesy copy mailed.]
>
>In article <Pine.GSO.3.95.990727143135.7813A-100000@saul.cis.upenn.edu> 
>on Tue, 27 Jul 1999 14:33:47 -0400, Arnabnil Bhattacharjee 
><arnabnil@saul.cis.upenn.edu> says...
>> 	I am a perl novice and need some urgent help. I need to create a 3
>> dimensional array in perl 5 . constraints the ranges of the dimensions are
>> not known ( but of course begin from 0 ) and the elements are not inserted
>> in any kind of order. Could somebody write me some sample code please...
>
>Surely somebody could, but surely nobody should.  Why not learn how to 
>do it yourself?
>
>There are many examples in perllol and perldsc.  And perlref supplies 
>some detail of the underpinnings.  You may actually need to use hashes 
>instead of arrays, if 'the elements are not inserted in any kind of 
>order'.

Depends on what that phrase means.  If Arnabnil knows where each
element belongs and they only come in at random,

$a->[ $i]->[ $j]->[ $k] = $you_knew_that;

is just fine.  Oh, and here I posted code for a three-dimensional
array as I shouldn't have.

So  here's a quiz for ambitious newbies:  Why does the line above
begin with a "$"?

a - Because the individual element being assigned is a scalar.

b - Because all Perl variables begin with a "$".

c - Because $a is a reference.

Anno


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

Date: Wed, 28 Jul 1999 10:24:04 GMT
From: Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
Subject: [Perl] How to find the Perl FAQ
Message-Id: <pfaqmessage933157444.14825@news.teleport.com>

Archive-name: perl-faq/finding-perl-faq
Posting-Frequency: weekly
Last-modified: 10 Sep 1998

[ That "Last-modified:" date above refers to this document, not to the
Perl FAQ itself! The last major update of the Perl FAQ was in Summer of
1998; of course, ongoing updates are made as needed. ]

For most people, this URL should be all you need in order to find Perl's
Frequently Asked Questions (and answers).

    http://cpan.perl.org/doc/FAQs/

Please look over (but never overlook!) the FAQ and related docs before
posting anything to the comp.lang.perl.* family of newsgroups.

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

Beginning with Perl version 5.004, the Perl distribution itself includes
the Perl FAQ. If everything is pro-Perl-y installed on your system, the
FAQ will be stored alongside the rest of Perl's documentation, and one
of these commands (or your local equivalents) should let you read the FAQ.

    perldoc perlfaq
    man perlfaq

If a recent version of Perl is not properly installed on your system,
you should ask your system administrator or local expert to help. If you
find that a recent Perl distribution is lacking the FAQ or other important
documentation, be sure to complain to that distribution's author.

If you have a web connection, the first and foremost source for all things
Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
CPAN also includes the Perl source code, pre-compiled binaries for many
platforms, and a large collection of freely usable modules, among its
560_986_526 bytes (give or take a little) of super-cool (give or take
a little) Perl resources.

    http://cpan.perl.org/
    http://www.perl.com/CPAN/
    http://cpan.perl.org/doc/FAQs/FAQ/html/
    http://www.perl.com/CPAN/doc/FAQs/FAQ/html/

You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
selected FTP sites is especially good for you, a full list of CPAN sites
is in the SITES file within CPAN.)

    California     ftp://ftp.cdrom.com/pub/perl/CPAN/
    Texas          ftp://ftp.metronet.com/pub/perl/
    South Africa   ftp://ftp.is.co.za/programming/perl/CPAN/
    Japan          ftp://ftp.dti.ad.jp/pub/lang/CPAN/
    Australia      ftp://cpan.topend.com.au/pub/CPAN/
    Netherlands    ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
    Switzerland    ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
    Chile          ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/

If you have no connection to the Internet at all (so sad!) you may wish
to purchase one of the commercial Perl distributions on CD-Rom or other
media. Your local bookstore should be able to help you to find one.
Another possibility is to use one of the FTP-via-email services; for
more information on doing that, send mail to <mail-server@rtfm.mit.edu>
(not to me!) with these lines in the body of the message, flush left:

    setdir usenet-by-group/news.announce.newusers
    send Anonymous_FTP:_Frequently_Asked_Questions_(FAQ)_List

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

Comments and suggestions on the contents of this document
are always welcome. Please send them to the author at
<pfaq&finding*comments*@redcat.com>. Of course, comments on
the docs and FAQs mentioned here should go to their respective
maintainers.

Have fun with Perl!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/


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

Date: 28 Jul 1999 09:26:08 GMT
From: medley8086@aol.com (Medley8086)
Subject: a little motivation, anyone?
Message-Id: <19990728052608.10608.00002258@ng-fq1.aol.com>

Ok, I'm running a win98 partition and a linux partition.  I have all sorts of
programming tools, and have studied how to program in assembly and c++.  In
addition, I plan to know c (should I bother after c++?  give me your opinion),
pascal, euphoria, and some scripting languages by the end of the summer. 
Through all this planning, however, I keep running into the same problem with
learning how to program.  I'm teaching myself, so the motivation isn't there. 
I've tried thinking of things that i think would be challenging for me to
create, rather than necessary, so now the most off-putting thing is not knowing
whether my progress is good.  What I'm asking is, could i please have some
posts of what some of you other programmers made when you were starting out, in
what languages, and how long it took.  I'm looking for stories to convince me
while trying to work with stubborn code that I'm not algorithmically
handicapped or just not cut out to be a coder at all.  Thanks in advance for
anyone who decides to help.

E. Leron Culbreath



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

Date: Wed, 28 Jul 1999 10:46:40 +0100
From: "James Williamson" <james.williamson@bbc.co.uk>
Subject: Re: beginner-redirect and download
Message-Id: <7nmjki$jit$1@nntp0.reith.bbc.co.uk>


Martien Verbruggen wrote in message ...
>In article <g1297h2j.fsf@wind.localdomain>,
> llornkcor <llornkcor@llornkcor.com> writes:
>
>The question was about some browser specific HTPP and/or HTML tricks.
>perl is not a browser.

Yeah, but to a newbie who doesn't know any difference they might think that
Perl can provide that functionality. It's intellectual elitism to think that
everyone has your knowledge. The whole ethos of newsgroups (although feel
free to put me right) is to share information to help those less enabled.

>
>> I think your condescending answers
>> (Abigail) are of poor taste, and more off topic than any question here.
>
>Not at all. Although Abigail's answers are quite rough most of the
>time, they are always on topic, and almost always correct. And she's

Come on, Abigail's answers are always rough all the time, is there really a
need to flame everyone who makes a Usenet faux pas unintentionally?

>not rough at all when the questions are actually decent. You do know
>that penguins and cucumbers are considered on-topic here, right?

Yeah, to those of you in your cosy clique.

>
>Martien
>--
>Martien Verbruggen                  | My friend has a baby. I'm writing
down
>Interactive Media Division          | all the noises the baby makes so
later
>Commercial Dynamics Pty. Ltd.       | I can ask him what he meant - Steven
>NSW, Australia                      | Wright




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

Date: Wed, 28 Jul 1999 08:11:18 GMT
From: Carfield Yim <c8133594@comp.polyu.edu.hk>
Subject: Can perl declare constant?
Message-Id: <7nmdv4$gtm$1@nnrp1.deja.com>

Can perl declare unchangable varible like constant in C?? How??


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


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

Date: Wed, 28 Jul 1999 06:18:06 -0400
From: "Eric Winter" <ewinter@pop3.stx.com>
Subject: Re: Can perl declare constant?
Message-Id: <7nmlg5$ajr@post.gsfc.nasa.gov>

Sure.

use constant CONSTANT_NAME => CONSTANT_VALUE;

The Constant module is a standard module.

Carfield Yim <c8133594@comp.polyu.edu.hk> wrote in message
news:7nmdv4$gtm$1@nnrp1.deja.com...
> Can perl declare unchangable varible like constant in C?? How??
>
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.




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

Date: Tue, 27 Jul 1999 16:02:06 +0100
From: "Richard Garside" <richard.garside@zen.co.uk>
Subject: cgi HTTP header information
Message-Id: <R%yn3.116$da5.541@newreader.ukcore.bt.net>

Hi,

I have a cgi script that will be used by several users. It is a
sitesearching tool. It works fine but the problem is that at present anyone
using it can search through the directories of other people hosted on our
server. I want to find the path location of the pge that calls my script so
I can check they aren't trying to access other users sites.

I tried using HTTP_REFERER which did work but some of our users have domains
which are on virtual servers. Is there any header I can use to find the
physical location on the server of the page calling the script.

Thanks,
Richard.




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

Date: Wed, 28 Jul 1999 09:32:23 +0100
From: Adrian Duncan <Adrian.Duncan@trinite.co.uk>
Subject: Directory Listing with Size
Message-Id: <379EC017.5A6159CE@trinite.co.uk>

Hi,

I need to write an app in Perl that gets a list of directories
from a parent directory.  I need to know all of the
directory names and the space that the directory takes
up including any subdirecories.

Can anyone suggest a routine that would work on NT please?
Thanks
Adrian.



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

Date: Wed, 28 Jul 1999 09:01:35 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: Re: Don't want to make file that owner is "NOBODY"
Message-Id: <FFKp2n.HuJ@csc.liv.ac.uk>

In article <7nl2f9$6vb$3@news.servint.com>,
<vlad@doom.net> writes:
> If you're running the scripts from a shell where you are logged in, then the 
> data files your program creates will be owned by you. 
> 
> If you are running the scripts through a web browser the data files will be owned
> by whatever id the web server runs under (usually user:nobody and group:nogroup). 
> 
> The only way around this that I know of is installing the suexec module for Apache
> (if Apache is the web server you are using of course)

Yee gads man. Fix your news reader. 72 - 76  chars per line please.

> 
> Check out http://www.apache.org/docs/suexec.html for more details on suexec

No it's not, use chmod.

> channeli <cybok@nobreak.com> wrote:
>> My perl script make several data files.
>> But the problems of my server is that never allow the file that owned by
>> "NOBODY".
> 
>> I'm using
> 
>> umask(077);
> 
>> now.
> 
>> At the result, some files owned by the owner of script, some are "nobody".
>> Any other solution is there?
> 
>> I'm really urgent...

I think I got this code from the blue Camel, could have been the faq though.

umask((umask() & 022 ) | 0);

It gives me permission to change a file if I am in the same group. That's
the key to all this, groups.

If the permissions on the directory are correct then no one should be able
to delete the file via the browser anyway. Of course this can be a bit
restrictive in that the file needs to exist first for a CGI to change it
so may not be viable.

As for a script being able to execute an rm -rf * command and delete said
files, well you should be checking input and trusting none of it or better
still use tainting.

Then again if the server wrote the file it can edit it, so just come up
with a suitably protected interface. Again this is less than ideal.

-- 
Ian J. Garlick
ijg@csc.liv.ac.uk

Fifth Law of Procrastination:
        Procrastination avoids boredom; one never has the feeling that
there is nothing important to do.



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

Date: 28 Jul 1999 08:10:02 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: ebcdic packed numbers
Message-Id: <7nmdsq$age$1@lublin.zrz.tu-berlin.de>

Uri Guttman  <uri@sysarch.com> wrote in comp.lang.perl.misc:

>on it. i did a pl/i any 2 any converter many years ago and know this
>stuff too well.

Oh yes... pl/i (or pl/1, nobody ever knew) inherited bcd from cobol.

ObOffTopic:  I am currently reading _The Mythical Man Month_ for the
first time (Yes... I know).  Brooks' ideas about the management of
large industrial software projects seem as sound as ever.  Well, it's
not my field at all, but it all looks very plausible.  But when he gets
down to detail, it's Computer Language Cemetery.  "Sketch your ideas in
ada, then implement them in pl/i."  Do you hear the bones rattle?  Lady
ada's ghost also rears her lovely but somewhat maggoty head.  Spooky.

Anno


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

Date: Wed, 28 Jul 1999 11:09:54 +0200
From: Michel Combes <michel.combes@hl.siemens.de>
Subject: how to print an hexadecimal with more than 32 bits
Message-Id: <379EC8E2.E7E7EA53@hl.siemens.de>

Hello perl-gurus,

I do have an interresting problem
but I can't figure out how to solve it
Any help is more than welcomed

Problem :
---------
I have an integer on more than 32b (2**33-2 for instance)
Question : how to print it in hex format ?
(note I'm running perl on a 32b-architecture machine!)

Trial of solution :
-------------------
for $e (30..34) {
  $l = 2**$e - 2;

  printf("a big number             = %s\n",$l);
  # saturated to 0xFFFF.FFFF
  printf("this doesn't work        : %016x\n",$l);
  $lsb = $l & (2**32-1);
  $msb = $l >> 32;

  printf("this doesn't work either : %08x.%08x\n",$msb,$lsb);

}


Thanks for your proposal.

Michel
--
" Do not follow where the path may lead. Go instead
    where there is no path and leave a trail. "




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

Date: Wed, 28 Jul 1999 06:31:36 -0400
From: "Tim Nettleton" <timnett@mindspring.com>
Subject: How to: run a DOS batch in perl/cgi?
Message-Id: <7nmm6b$lgd$1@nntp9.atl.mindspring.net>

I have need to run a batch file that requests nslookup and ping information
on several hosts.  I would like to have a form on a page that someone can
just type in the IP or domain and then the .bat file will run in the
CGI-BIN.  I have a unix server and a NT server.

Is this possible?  Can anyone reference some working code that I may learn
from?

Thanks.




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

Date: Wed, 28 Jul 1999 10:50:36 GMT
From: frederick@belbone.be (Frederick Tant)
Subject: HTML - perl timeout ?
Message-Id: <379ee06d.167715281@news.skynet.be>

Hello,

Consider the following perl script :

####################################"
#!/opt/perl5/bin/perl

$html = "";

$html .= "Content-type: text/html\n\n"
         . "<HTML>\n";


@output  = `CLASSPATH=/home/fred ; export CLASSPATH ; /opt/java/jre/jr
e/bin/jre agent one /tmp/scriptname.sh`;

$html .=  $output[0]
         . "<BR>END"
         .  "</html>";

###########################################

When I execute the above scripts on the unix commandline I get the
rigth result in @output[1].

The line   @output  = `CLASSPATH=/home/fred ; export CLASSPATH ;
/opt/java/jre/jr e/bin/jre agent one /tmp/scriptname.sh`;  takes about
10 seconds.

When I execute it  in a webbrowser the line is not (?)  executed.

REMARK : when I use a simple scripts (time < 1 sec) I have no problems

Have I a problem with a timeout in HTML. Any solution(s) for this ?


Thanks for your reply !


FRed



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

Date: Wed, 28 Jul 1999 08:37:24 GMT
From: backwards.saerdna@srm.hc (Andreas Fehr)
Subject: Re: Newbie needs help to connect to MS Access
Message-Id: <379ec0ac.11662329@news.uniplus.ch>

On Wed, 28 Jul 1999 12:53:22 +1000, "Niclas Wendel"
<N.Wendel@mailbox.gu.edu.au> wrote:

>
>I need some help to get started.
>I'm working on an application that has to extract some data from an Access
>DB.

Look at perlwin32faq9.html of the ActivePerl documentation.

Andreas


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

Date: Wed, 28 Jul 1999 11:57:53 +0100
From: Andrew Fry <andrewf@beausys.demon.co.uk>
Subject: Newbie Q: Replacing a string by an array
Message-Id: <kCkLqCAxIun3Ew5R@beausys.demon.co.uk>

I have written a (CGI) program that uses HTML templates.

The template is contained in array A and contains a line
which contains a tag that I need to replace by text contained
in another array (B).

However, when I find the line and do the replacement, using a
statement of the form s/$tag/@B/, and then print the new
(modified) array A, it appears that each line in array B of the
form xxx\n comes out as xxx\n FOLLOWED BY A SPACE.
Why is this, and how can I get rid of this extra space ?

Here is a little demo of what happens...
----------------------------------------------------
use strict;

my @a;
my @b;
my $i;

  $a[0] = "Mary had a little lamb\n";
  $a[1] = "Whose fleece was white as snow\n";
  $a[2] = "And everywhere that Mary went\n";
  $a[3] = "The lamb was sure to go\n";
  $b[0] = "pqr\n";
  $b[1] = "stu\n";
  $b[2] = "vwx\n";
  print @a, @b;
  for ($i=0; $i<=$#a; $i++)
  {
    if ($a[$i] =~ /fleece/)
    {
      $a[$i] =~ s/fleece/@b/;
    }
  }
  print "\n";
  print @a;
----------------------------------------------------
Ouput:
Mary had a little lamb
Whose fleece was white as snow
And everywhere that Mary went
The lamb was sure to go
pqr
stu
vwx

Mary had a little lamb
Whose pqr
 stu
 vwx
 was white as snow
And everywhere that Mary went
The lamb was sure to go
---
Andrew Fry
"Time flies like an arrow. Fruit flies like a banana". (Groucho Marx).


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

Date: Wed, 28 Jul 1999 05:58:34 -0400
From: HC <carvdawg@patriot.net>
Subject: Newsgroups for Perl on NT
Message-Id: <379ED44A.F5936E6@patriot.net>

Folks,

Dave Roth has made a newsserver available w/ groups pertaining to
his modules, and the Win32::Lanman module.  For anyone using
these modules (ODBC, AdminMisc, Perms, Lanman, etc), it would
behoove you to check it out.  For instance, Dave released a new version
of
Perms recently!

Dave' site:  http://www.roth.net
                 news.roth.net

check it out!



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

Date: Wed, 28 Jul 1999 05:56:05 -0400
From: HC <carvdawg@patriot.net>
Subject: Re: Perl and Internet Information Server 4?
Message-Id: <379ED3B4.2F500658@patriot.net>

Joe,

I have looked around and asked the same thing.  It seems that Win32::OLE can
be used
to set up the vdirs, as long as you configure DCOM properly, and Win32::Perms
can be
used to set permissions...

Joe Ramsey wrote:

> Anyone know of any modules out there or in the works for interfacing to
> the IIS metabase?
>
> I'm trying to write a script that will automatically set up a web site,
> some virtual directories, and set permissions on those directories.
>
> Anyone want to field this one???
>
> Thanks
>
> Joe Ramsey
> Technical Consultant
> Access Systems LLC
> wjramsey@hotmail.com
>
> BTW: I'm amazed with Perl!  I haven't programmed since college (10 years)
> but with the aid of the Camel, the PRK and a few other titles (and quite
> a few module coders *grin*) been able to write several scripts for
> converting text reports to nice html pages and a automated mailer program
> and customers are using them in production with no problems.  Best of all
> I'm having a blast!!!!  Thanks to all of you gurus and aspiring gurus for
> all of the support and information  - Joe



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

Date: 28 Jul 1999 10:17:46 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: R: How I can read to a script output frome an other one ?
Message-Id: <7nmlca$anp$1@lublin.zrz.tu-berlin.de>

Claudio Villa Santa <claudio@elettrodata.it> wrote in comp.lang.perl.misc:
>Thank You
>
>I tried but script A recived nothing.
>
>Part of Script A:
>
>open(PIPPO, "categorie.cgi |");
> while (<PIPPO>) {
>  $riga=$riga . $_;
> }
>close (PIPPO);

Say, are you deliberately being dense?  Your script differs in two
important points from the one Tad proposed.  Spot the differences.
Correct your script.  Scan the error log on your web server.  Then,
not before, come back if you have more questions.

Anno


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

Date: Wed, 28 Jul 1999 08:36:20 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: Re: reg expression
Message-Id: <FFKnwK.H7p@csc.liv.ac.uk>

In article <933076700.1270095593@news.earthlink.net>,
llornkcor <llornkcor@earthlink.net> writes:
> I still don't see why, if those people that lurk here for years, are
> tired of seeing these questions posted, can't just IGNORE them???
> Instead of making rude comments about learning to read. No One is
> making them answer.

I have read this thread and come to the conclusion that you really can't
see the obvious can you.

The reason why Abigail, Tad, Tom, Larry, Uri and many others who have been
here for years jump in with varying degrees of "rudeness" is simply for
self preservation and the good of Perl. If they do what you propose a faq
doesn't get answered corectly so some well meaning not-so-newbie comes
along and says "oh good one I can answer". They then proceed to answer,
badly.

In the case of this thread you would probably have gotten the
/<img[^>>+/gi answer. This has been pointed out to be bad code, and
because the above mentioned care about Perl they would then feel honour
bound to correct the mistake. By then however the mistake is in black and
white and the original poster may never read the correct way of doing
things.

So by pure logic they arrived at the conclusion don't ignore anything as
it creates way more problems than it solves.

It also stops us not-so-newbie/lurkers making the same mistakes, but don't
have the guts to post admitting we don't know how to do it properly :-)

You probably wont agree with this but that's my 2 peneth worth.

OWL.

-- 
Ian J. Garlick
ijg@csc.liv.ac.uk

Fifth Law of Procrastination:
        Procrastination avoids boredom; one never has the feeling that
there is nothing important to do.



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

Date: Wed, 28 Jul 1999 11:22:31 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: reg expression
Message-Id: <Pine.HPP.3.95a.990728112158.21563C-100000@hpplus03.cern.ch>

On 27 Jul 1999, llornkcor wrote:

> My point is this:

You're making a real pest of yourself, and you don't seem to have
anything useful to contribute to the group.




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

Date: 28 Jul 1999 04:45:19 -0400
From: elflord@news.newsguy.com (Donovan Rebbechi)
Subject: REST/RETR in Net::FTP
Message-Id: <slrn7ptgor.8af.elflord@panix3.panix.com>

Hi. I am working on a perl-Tk ftp client.

I am using Net::FTP for the ftp routines.

I currently use $ftp->retr to retrieve files. This proves somewhat 
problematic when I want to reget, however. 

At the moment, I want to do something like this:

$ftp->port;
$ftp->quot ( "REST",$offset );
my $dataconn= $ftp->retr($file);  

The problem is that ftp->retr issues its own port command, and this seems
to disable my REST command and hence disable my reget ( ie it fetches 
the whole file ) 

I do not have an elegant solution at this stage. 

Currently, my fix is to modify _data_cmd FTP.pm with this cheap hack

 $ok = $ftp->port 
     unless (defined ${*$ftp}{'net_ftp_port'} ||
                defined ${*$ftp}{'net_ftp_pasv'} ||
		                     $cmd =~ /RETR/ );   # I added this line

After this, it works fine.

Are there any thoughts about better workarounds ? or maybe it's 
worth considering tweaking FTP.pm a little so retr can be used for 
regets ? 

Thanks,
-- 
Donovan


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

Date: 28 Jul 1999 09:27:43 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Sending HTML emails from perl script
Message-Id: <379ebeff@newsread3.dircon.co.uk>

Michael Dransfield <mike@euromortgage.cc> wrote:
> I have a script which returns the contents of a script.  It is difficult to
> read however in its current format.  I would like to send it in HTML format
> with a table.
> 
<snip>
> at the start of the email and then the required <TD> and <TR> HTML tags
> between each bit of information.
> 
> What am I doing wrong??  Is this possible - or am I barking up the wrong
> tree??
> 
I would suggets that you look at the MIME::Lite module from CPAN - this will
take care of everything except actually creating the HTML.

/J\
-- 
"The most frightening thing on television since Anthea Turner revealed
she had a sister" - Suggs


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

Date: Wed, 28 Jul 1999 09:44:30 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: Re: Sending HTML emails from perl script
Message-Id: <FFKr26.IJq@csc.liv.ac.uk>

In article <oggx7ig3.fsf@wind.localdomain>,
llornkcor <llornkcor@llornkcor.com> writes:
> Might need to add this print line in your script, perhaps??
> 
> print "Content-type: text/html; charset=\n\n";
> 
> before the print "<tags>";

This was precisely what I was getting at before.

No visible input from the gurus so you rush in where fools fear to tread.

Going on the clues, like Subject: "Sending HTML emails from perl script"
and the badly worded spec I would guess (it can only be a guess because
the original poster really hasn't made it clear enough what they want) the
original poster wants to know how to MIME encode an email message.

I could be miles of base here but I think personally I am closer than you
are. Although it can be argued that he will eventually need to print
something like that I doubt that will help when emailing.

To the original poster.

Go to CPAN. Search for the MIME::Lite module, it will contain all you need
to accomplish what you want.

If you are feeling really adventurous read rfc1341 and then add the
missing bits to your email header.

Hopefully I wont start too much of a flame war with this. But then wishes
are something or other.... and I can't remember the rest of the quote.

-- 
Ian J. Garlick
ijg@csc.liv.ac.uk

Fifth Law of Procrastination:
        Procrastination avoids boredom; one never has the feeling that
there is nothing important to do.



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

Date: Wed, 28 Jul 1999 09:06:50 +0100
From: "Paul Foran (Layout/Design)" <Paul.Foran@analog.com>
Subject: sending table  file to MSQL with Perl
Message-Id: <379EBA1A.EDB29FEB@analog.com>

I have a table withing access. I am looking for the easiest way that I
can update a table within MSQL on my ISP's unix box. I bewlieve that I
have to write a MSQL/Perl script that will accept the Access comma
delimited file and send it to the MSQL server. Ideally I would like to
have the option to login  to the database through a HTML form and use
this form to send delimited file to the MSQL server.
 Is this the only way that a MSQL table could be updated or created.
I thought that All I would have to do i to create a delimited file and
FTP to a certain loation then get MSQL to point to that table as
reference. Can this be done also if so how.

Any other sugestions would be greatly appreciated.



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

Date: Wed, 28 Jul 1999 10:27:49 +0200
From: hal9000 <hal9000@fetchmail.com>
Subject: Re: splitting an array - well not really but ...
Message-Id: <379EBF05.EC0485A3@fetchmail.com>

Eric Smith wrote:
> 
> Hi
> 
> I would like to take an array like say @ARGV and instead of having each
> token (if the arguments) as an array element, I would like to have each
> group of tokens a an element in the top level array.  After that I wish to
> take the group and split that on white space to form an array of arrays
> thusly.
> 
> command.pl john m smi, pete MBchB school, mike west high

You can join the @ARGV and then split it twice:

@top = split( /, */ , join( ' ' , @ARGV ) );

for $e (@top) { $e = [ split( / +/ , $e ) ] };

> @first= qw(john m smi)
> @second= qw(pete MBchB school)
> @third= qw(mike west high)
> 
> @top=(@first, @second, @third)

This just puts it all back into one array, probably not what
you want. Use references instead.

-- 
~hal9000


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

Date: Wed, 28 Jul 1999 10:42:28 +0200
From: "Trond Michelsen" <mike@crusaders.no>
Subject: Re: splitting an array - well not really but ...
Message-Id: <aozn3.86$ZU.777@news1.online.no>


Eric Smith <eric@fruitcom.com> wrote in message
news:slrn7ptclq.28u.eric@plum.fruitcom.com...
> Hi
>
> I would like to take an array like say @ARGV and instead of having each
> token (if the arguments) as an array element, I would like to have each
> group of tokens a an element in the top level array.  After that I wish to
> take the group and split that on white space to form an array of arrays
> thusly.
>
> command.pl john m smi, pete MBchB school, mike west high

okay, first you need the entire @ARGV as a string.

my $everything = "@ARGV";

then you can split on the comma and remove extra whitespaces

my @ARGS = split /\s*,\s*/, $everything;

then you can go through the array and create array-references

for (@ARGS) {push @top, splitref($_)}
sub splitref {
  my @a = split " ", $_[0];
  return \@a;
}

but you can use [ ] to create a reference to the array that split() returns,
so &splitref() isn't really needed
for (@ARGS) {push @top, [split " ", $_]}

and when we omit the default-values
for (@ARGS) {push @top, [split]}

> @first= qw(john m smi)
> @second= qw(pete MBchB school)
> @third= qw(mike west high)
> @top=(@first, @second, @third)

This would produce @top = (john, m, smi, pete, MBchB, school, mike, west,
high)
what you want is an array of array-references, like this:
@top = ([john, m, smi], [pete, MBchB, school], [mike, west, high]);

or this:
@top=(\@first, \@second, \@third);

> How do I best process the @ARGV to return the above?

@top = map({[split]} split /\s*,\s*/, "@ARGV");

> It seems you cannot use `split' on the comma for an array.

split() creates an array, so splitting an array is kind of unneccessary.
However, if you stringify the array with "@array" you can split on that
string.

--
Trond Michelsen





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

Date: Wed, 28 Jul 1999 09:46:40 GMT
From: gary@onegoodidea.com (Gary O'Keefe)
Subject: Re: splitting an array - well not really but ...
Message-Id: <379ed068.4247857@news.hydro.co.uk>

Eric Smith wrote:

>I would like to take an array like say @ARGV and instead of having each
>token (if the arguments) as an array element, I would like to have each
>group of tokens a an element in the top level array.  After that I wish to
>take the group and split that on white space to form an array of arrays
>thusly.
>
>command.pl john m smi, pete MBchB school, mike west high 
>
>@first= qw(john m smi) 
>@second= qw(pete MBchB school) 
>@third= qw(mike west high)
>
>@top=(@first, @second, @third)
>
>How do I best process the @ARGV to return the above?
>It seems you cannot use `split' on the comma for an array. 

'join' the @ARGV array first and then create your tokens with split:

#!/usr/local/bin/perl -w

my $foo = join ( ' ', @ARGV );
my @bars = split ( /\, */, $ARGS );

foreach my $bar ( @bars ) {
        print ( "$bar\n" );
}

I think the @bars list is what you're looking for.

Gary
--
Gary O'Keefe
gary@onegoodidea.com

You know the score - my current employer has nothing to do with what I post


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

Date: Wed, 28 Jul 1999 11:48:28 +0100
From: "bob" <bbo>
Subject: Standard Unix Compress
Message-Id: <933158660.5219.0.nnrp-07.c1ed09c6@news.demon.co.uk>

Can I compress a tar archive that i have created with the tar module
into a .Z format which can be uncompressed by the UNIX command uncompress ?

I know you can use gzip from the tar module and create a gzipped tar archive

but I need to use th standard lzw compression.

Oh by the way the tar archive is being created on a NT box




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

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". 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 V9 Issue 281
*************************************


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