[17243] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4665 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 19 18:05:44 2000

Date: Thu, 19 Oct 2000 15:05:22 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <971993121-v9-i4665@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 19 Oct 2000     Volume: 9 Number: 4665

Today's topics:
    Re: [very off topic] Re: Perl: Day One, a Stupid Questi <jeff@vpservices.com>
    Re: [very off topic] Re: Perl: Day One, a Stupid Questi <mrobison@c802.crane.navy.mil>
    Re: activestate install question ?? <mrobison@c802.crane.navy.mil>
    Re: Array stuck within a loop <tim@ipac.caltech.edu>
        Build up an array of "matching strings" fgont@my-deja.com
    Re: Build up an array of "matching strings" <james@NOSPAM.demon.co.uk>
    Re: Convert Text to HTML <iltzu@sci.invalid>
    Re: factorial function problem <iltzu@sci.invalid>
    Re: File Locking and CGI <ddunham@redwood.taos.com>
    Re: File::Find pruning <james@NOSPAM.demon.co.uk>
    Re: File::Find pruning <james@NOSPAM.demon.co.uk>
        finding mode and median of an array of numbers <gorbeast@SPAMSUCKS.subduction.org>
    Re: finding mode and median of an array of numbers <tony_curtis32@yahoo.com>
    Re: finding mode and median of an array of numbers <gorbeast@SPAMSUCKS.subduction.org>
    Re: finding mode and median of an array of numbers (Craig Berry)
    Re: finding mode and median of an array of numbers <godzilla@stomp.stomp.tokyo>
        formatting html email to send via sendmail <scott@nospam.corneil.com>
    Re: formatting html email to send via sendmail <scott@nospam.corneil.com>
        how do i find file size? <me@privacy.net>
        How to find out the number of lines in a flat file..... <ShadeyGradey@hotpop.com>
    Re: How to install DB_File package in windows perl <trwww@my-deja.com>
    Re: http referer manipulation <jeff@vpservices.com>
    Re: http referer manipulation <james@NOSPAM.demon.co.uk>
    Re: http referer manipulation <tina@streetmail.com>
    Re: I need a DB solution <mikelm@ameritech.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 19 Oct 2000 11:40:05 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: [very off topic] Re: Perl: Day One, a Stupid Question
Message-Id: <39EF4005.F842B68F@vpservices.com>

frannyzoo@hotmail.com wrote:
> 
> absolutely no offense intended with the "college bowl" reference

And none taken.  BTW, you may notice that the style that is used for
quoting in this newsgroup is to post a suitably trimmed version of the
previous post (minus signatures) and then follow it with your response
to the post rather than, as you have done, to quote the entire previous
post and put your response before it.  This preferred quoteing sytle
greatly assists in ongoing conversations so that anyone can read the
conversation as it has occurred in order of occurrence.  It will also
assit you since many of the newsgroup regulars stop reading postings
that are consistently out of order.

-- 
Jeff


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

Date: Thu, 19 Oct 2000 20:19:42 GMT
From: Miker <mrobison@c802.crane.navy.mil>
Subject: Re: [very off topic] Re: Perl: Day One, a Stupid Question
Message-Id: <8snl0m$j40$1@nnrp1.deja.com>


>that the style that is used for
> quoting in this newsgroup is to post a suitably trimmed version of the
> previous post (minus signatures) and then follow it with your response

ah hah!  i'm catching on quick.  ;-)  and a quick comment
about your (former) problem, fran.  i installed activestate
on both an NT box and a 98 laptop.  the NT ran fine with
just the simple "perl" command, cuz the path is correctly
set.

HOWEVER (there's always one of those, isn't there?), the
online docs stated that win9X will NOT install the path.
my memory might not be correct, but i believe the workaround
they had for that involved disabling several registry entries
and sacrificing a frog and a bat.

you should be able to add the path, but i tried with a
path=c:\perl\bin entry (this was noted a ways back up in
the thread, i think) which mimicked my NT entry, and it
would not fly.  tonight i'll specify the path and see if
i have anything at all on my laptop.

good luck, miker



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 19 Oct 2000 18:30:58 GMT
From: Miker <mrobison@c802.crane.navy.mil>
Subject: Re: activestate install question ??
Message-Id: <8snel3$dap$1@nnrp1.deja.com>

hi bernard,

well, it was sort of my assumption that if it wouldn't
work when i assigned it as a path directly, that it
wouldn't work thru autoexec.bat either.  but you did
get to thinking (not a trivial accomplishment some
times ;-).

tonight i'll try using the full path in the command or
else put something right in the bin and see if it will
execute there.

thanks, miker

In article <slrn8utv6e.28m.bernard.el-hagin@gdndev25.lido-tech>,
  bernard.el-hagin@lido-tech.net wrote:
> On Thu, 19 Oct 2000 13:41:01 GMT, Miker
<mrobison@c802.crane.navy.mil> wrote:
> >hello,
> >
> >i installed the activestate perl on my NT box and
> >it works fine.  i installed in on my win98 laptop
> >and it won't work.
> >
> >i browsed the docs and it said that win98 wouldn't
> >install the path.  i checked my NT box and i had
> >"c:\perl\bin;" as a path.  on my laptop i had
> >nothing.  i tried duplicating the one on my NT box
> >but no luck.  i used default install locations on
> >both boxes.
> >
> >could somebody tell me what i need to do to make
> >activestate work on my win98 machine?
>
> Why don't you just add "c:\perl\bin" to your path in autoexec.bat?
>
> Cheers,
> Bernard
> --
> perl -le'
> ($B,$e,$r,$n,$a,$r,$d)=q=$B$e$r$n$a$r$d==~m;
> \$(.);xg;print$B.$e.$r.$n.$a.$r.$d;'
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 19 Oct 2000 13:18:34 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Array stuck within a loop
Message-Id: <39EF571A.AA04D35A@ipac.caltech.edu>

bhui wrote:
> 
> I have used regex to separate a large string into a bunch of little ones,
> within one of these little ones I have created and array using split to
> converting each character into the array.
> 
> The problem is when I go parsing throught this array and get to the end or
> an unassigned value it hangs my while loop.
> 
> I suspect whats happening it the string i converted into an array does not
> have a /n to tell the while loop we are at the end. Is there a way to
> terminate the while if the array is unassigned ??

It's really helpful if you post working code, including sample data that
reproduces the problem, keeping it all as short as possible. That said ...

Start your scripts with

use strict;
use warnings;

These impose small additional coding overhead on your part, but pay back by
catching lots of common errors.

> 
> $string =~ (/^(.*?) "(.*?);(.*?)"
> \/REVISION="(.*?)"(.*?)VCS_TAGS(.*?)\)(.*?)\n.*/) ;
> 
>     {

Why is there a curly here?

>      $ui  =    $1 ;
>  $item_id_tmp =  $2 ;
>  $old_rev =  $3 ;
>  $real_rev =   $4 ;
>  $cmd1 =   $5 ;
>  $vcs_tags =   $6 ;
>  $user_filename =  $7 ;
> 
> @tags = split (//,$vcs_tags) ;
>  $num_of_tags_ui = scalar @tags ;
>  $char_count = 150;

It'd be better if these (and all your variables) were all lexicals, i.e.
declared with 'my', rather than globals as you have them. If you use strict as I
recommend above, you'll *have* to make them lexicals. Still, I don't think
that's your problem.

>  $char_to = $char_count ;

Why are you starting your search for commas at the 151st character? Well, none
of my business. Just wanted to be sure it's what you meant.

> 
> until (@tags[$char_to] =~ /\,/)

You'll get warnings on this because a single array elements should be refered to
as $tags[$char_to]. Also, the pattern match is hardly necessary since all the
array elements are single char.s. Just use '$tags[$char_to] eq ","'. But that's
not your problem either.

>    {
>    $char_to++ ;
>    }

This loop will go on forever if there's no comma in @tags. You can prevent this
with

until (! defined $tags[$char_to] || $tags[$char_to] eq ",")

> 
> $tag1 = join("",@tags[1..--$char_to]);

Are you deliberately skipping the first character of @tags? Arrays start at 0,
you know. Just checking ...

>  print "$ui \"$item_id_tmp;$old_rev\" \/REVISION=\"$real_rev\"$cmd1
> VCS_TAGS=\[$tag1\]\) $user_filename\n\n";
> 
> while ($char_to < $num_of_tags_ui)

You're missing a '{' here, and it's partner '}' down below. I'll assume this is
a transcription error. Try to post working code.

Is this the while statement that's going on forever?

> 
>    print "I got to while \n\n";
>    print "num of tags $num_of_tags_ui\n";
> 
>    until (@tags[$char_to] =~ /\,/)
>      {
>      print "got to until \n";
>        $char_to++ ;
>      }

This loop too will go on indefinitely unless you test for definedness as in the
previous loop.

>   print "$num_of_tags_ui\n";
>   print "@tags[$char_to]\n";
>   print "$char_to\n";
>    &write_uia ;

Now allow me to make an additional comment:

It appears you're using lots of C-like code to do something which is very simple
in perl. Don't you just want to split $vcs_tags on commas? Why not do most of
the work of all those loops with

@tags = split(/,/ , $vcs_tags);

???

Or, if you really meant to start 151 char.s in, for some reason

@tags = split(/,/ , substr($vcs_tags,150));

Just a suggestion ...

--

-- Tim Conrow         tim@ipac.caltech.edu                           |


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

Date: Thu, 19 Oct 2000 21:01:45 GMT
From: fgont@my-deja.com
Subject: Build up an array of "matching strings"
Message-Id: <8snnfj$ljg$1@nnrp1.deja.com>

Hi!

Suppose I have a variable (say $a) that contains e-mail addresses.
For example:

$_ = "fnt\@sohome.net, lcho\@elcho.com.ar>";


and I want to build up an array with the e-mail addresses.

I tried to do it by doing de following:

$_= $a;
$temp=0;

while(m/[\w\-\.]+\@[\w\-]+(\.[\w\-]+)+/g){
      $arrayofadd[$temp]= $&;
      $temp++;
}

but it seems that my regexp doesn't match anything.

Note: the problem IS NOT the regex, as I used it outside the while loop,
and it works Ok.

Can you help me?

Kind regards,
Fernando Ariel Gont

e-mail: fgont@ANTISPAM.softhome.net



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 19 Oct 2000 22:49:30 +0100
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: Build up an array of "matching strings"
Message-Id: <ant1921306d2fNdQ@oakseed.demon.co.uk>

In article <8snnfj$ljg$1@nnrp1.deja.com>,
<URL:mailto:fgont@my-deja.com> wrote:
> 
> it seems that my regexp doesn't match anything.

It works for me when I rewrote the code like this:

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

$_ = "fnt\@sohome.net, lcho\@elcho.com.ar>";

# $_= $a;
my $temp=0;
my @arrayofadd;

while(m/[\w\-\.]+\@[\w\-]+(\.[\w\-]+)+/g){
      $arrayofadd[$temp]= $&;
      $temp++;
}

print map "$_\n", @arrayofadd;

Output:
fnt@sohome.net
lcho@elcho.com.ar

Perhaps, the $_= $a; line which I commented out was your
problem. Good luck!

-- 
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02



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

Date: 19 Oct 2000 20:27:16 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Convert Text to HTML
Message-Id: <971986751.14984@itz.pp.sci.fi>

In article <ant181324497fNdQ@oakseed.demon.co.uk>, James Taylor wrote:
>Forgive me for joining this thread late, but if we're talking
>about HTML then what is the <xmp> tag? It doesn't seem to be
>described in my HTML4 book.

It's an old, deprecated HTML 2.0 tag.  Anything you could use it for
can and should (and if you want to be standards compliant, must) be
done with PRE.  Like any obsolete information on the net, however, it
still leads a ghostly, cargo-cult existence in advice that has been
passed around for years without ever actually being verified.

Just shows what one gets for HTML advice in a Perl newsgroup.

[Followups set to ciwah.]
-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla  | "By promoting postconditions to
and its pseudonyms -    |  preconditions, algorithms become
do not feed the troll.  |  remarkably simple."  -- Abigail



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

Date: 19 Oct 2000 21:49:58 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: factorial function problem
Message-Id: <971991896.23906@itz.pp.sci.fi>

In article <slrn8utci4.16d.tjla@thislove.dyndns.org>, Gwyn Judd wrote:
>necessary so I didn't bother. Does anyone in the know, know what the
>deal is with order of evaluation for operators like '+'? Is it
>guaranteed to happen in some order?

In short, no.

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla  | "By promoting postconditions to
and its pseudonyms -    |  preconditions, algorithms become
do not feed the troll.  |  remarkably simple."  -- Abigail



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

Date: Thu, 19 Oct 2000 18:56:29 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: File Locking and CGI
Message-Id: <xtHH5.682$YR.41293@news.pacbell.net>

jeacocks@uk.ibm.com wrote:
> At the moment there is no file locking implemented. I would like to 
> implement file locking. I cannot use flock() as the file in question is on 
> an AFS filesystem. 

Irrelevant.  You don't mention where the program runs.  Does it always
run on the same server?

If so, you can create a local lockfile not on AFS.  Open/lock that file,
then if successful, open the AFS file and deal with it.  When done,
close the AFS file and then release the local lock.

-- 
Darren Dunham                                           ddunham@taos.com
Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                           San Francisco, CA bay area
      < Please move on, ...nothing to see here,  please disperse >


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

Date: Thu, 19 Oct 2000 20:02:52 +0100
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: File::Find pruning
Message-Id: <ant191952064fNdQ@oakseed.demon.co.uk>

In article <8pFH5.2290$q9.76959@news1.gvcl1.bc.home.com>, Peter Scott
<URL:mailto:peter@PSDT.com> wrote:
> 
> $File::Find::prune = 1 if -e "$_/../.overview";

Trouble is that wouldn't work when $_ was a file (well not on my OS anyway).
Also, given that find() sets the current directory anyway, it would have
been better just to say -e '.overview'.

> Note that pruning doesn't work if you're using finddepth
> or the bydepth attribute.

Really? My understanding of finddepth() is that it scans the
directory structure depth first. Why should that preclude the
possibility of pruning?

I'm using find() without the bydepth attribute but strangely it seems
to search depth first anyway. The port of Perl (or should that be perl)
for my OS (Acorn RISC OS in fact) has had many of the standard modules
hacked to be more portable by the porter, so I suppose it's possible
that he broke something in doing so.

Having said that the idea of a recursive routine doing a breadth first
traversal does seem rather odd, because it would have to remember the
prune settings for all the subdirectories before entering any one of
them. Have I missed something about depth first versus breadth first?

-- 
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02



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

Date: Thu, 19 Oct 2000 20:11:35 +0100
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: File::Find pruning
Message-Id: <ant191935339fNdQ@oakseed.demon.co.uk>

In article <8snab9$hjo@gap.cco.caltech.edu>, Gary E. Ansok
<URL:mailto:ansok@alumni.caltech.edu> wrote:
>
> In article <ant191253345fNdQ@oakseed.demon.co.uk>,
> James Taylor  <james@NOSPAM.demon.co.uk> wrote:
> >
> Part of the problem with what you propose is that File::Find does
> not guarantee anything about the order in which the files/directories
> within a directory are returned.

I shall bear that in mind for portability, but on my OS the files are
returned in ASCIIbetical therefore with .overview appearing first.

> Besides, are you sure you're ready to prune after seeing .overview?
> Couldn't there be newsgroup directories still to be checked?  You
> wouldn't want to skip comp/lang/c/moderated just because you saw
> comp/lang/c/.overview, would you?

Oh no a bug! Thanks for spotting that one. Let me kill it now.
STOMP STOMP. Actually, I don't have any such groups in the hierarchy
I'm scanning, but better to be safe than sorry.

> >$File::Find::prune=1, return if /^\d{5}$/;
> 
> This is probably the best way.

Yes, as thing currently stand this would enter subdirectories that
were sub-groups.

> If you knew that ".overview" would be the *only* interesting file in
> a directory, and having seen it you could skip all subdirs, I might
> code it like this:
> 
> sub wanted { 
>     return unless -d && -e "$_/.overview";
>     process("$_/.overview");
>     $File::Find::prune = 1;
> }

That's clever. Why didn't I think of that. However, I think I'll
leave it to scan for subgroups as discussed above.

Thanks.

-- 
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02



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

Date: Thu, 19 Oct 2000 12:23:41 -0700
From: Gorbeast <gorbeast@SPAMSUCKS.subduction.org>
Subject: finding mode and median of an array of numbers
Message-Id: <39EF4A3D.F23B0253@SPAMSUCKS.subduction.org>

Hi all

I have a question.  If anyone can give me an answer, I'd be much
obliged. This is the question: What is a good way to iterate over an
array of numbers and find the mode and median of those numbers?

Thank you for your time.


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

Date: 19 Oct 2000 14:28:09 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: finding mode and median of an array of numbers
Message-Id: <87g0ls3a2e.fsf@limey.hpcc.uh.edu>

>> On Thu, 19 Oct 2000 12:23:41 -0700,
>> Gorbeast <gorbeast@SPAMSUCKS.subduction.org> said:

> Hi all I have a question.  If anyone can give me an
> answer, I'd be much obliged. This is the question: What
> is a good way to iterate over an array of numbers and
> find the mode and median of those numbers?

By using the normal (:-) statistical techniques.  One way
is to

    use Statistics::Descriptive;

and plug the data in to a Statistics::Descriptive::Full
object, then use the methods

    mode
and
    median

to get the required values.

You can get the module from CPAN.

hth
t
-- 
Eih bennek, eih blavek.


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

Date: Thu, 19 Oct 2000 12:34:41 -0700
From: Gorbeast <gorbeast@SPAMSUCKS.subduction.org>
Subject: Re: finding mode and median of an array of numbers
Message-Id: <39EF4CD1.B801C6B@SPAMSUCKS.subduction.org>

Thanks Tony

Tony Curtis wrote:
> 
> >> On Thu, 19 Oct 2000 12:23:41 -0700,
> >> Gorbeast <gorbeast@SPAMSUCKS.subduction.org> said:
> 
> > Hi all I have a question.  If anyone can give me an
> > answer, I'd be much obliged. This is the question: What
> > is a good way to iterate over an array of numbers and
> > find the mode and median of those numbers?
> 
> By using the normal (:-) statistical techniques.  One way
> is to
> 
>     use Statistics::Descriptive;
> 
> and plug the data in to a Statistics::Descriptive::Full
> object, then use the methods
> 
>     mode
> and
>     median
> 
> to get the required values.
> 
> You can get the module from CPAN.
> 
> hth
> t
> --
> Eih bennek, eih blavek.

-- 
"If I had one wish, I would ask for a big enough ass for the whole world
to kiss." 
--Marshall Mathers


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

Date: Thu, 19 Oct 2000 20:30:59 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: finding mode and median of an array of numbers
Message-Id: <suumg35lh7bfc9@corp.supernews.com>

Gorbeast (gorbeast@SPAMSUCKS.subduction.org) wrote:
: I have a question.  If anyone can give me an answer, I'd be much
: obliged. This is the question: What is a good way to iterate over an
: array of numbers and find the mode and median of those numbers?

There are almost certainly modules out there which can do this more
efficiently, but if your data set is small, this will suffice:


#!/usr/bin/perl -w
# mode - calculate mode and median of arguments
# Craig Berry (20001019)

use strict;

my $median = (sort { $a <=> $b } @ARGV)[$#ARGV / 2];      

my %h;        
$h{$_}++ foreach @ARGV;
   
my $mode = (sort { $h{$a} <=> $h{$b} } keys %h)[-1];

print "$mode : $median\n";


-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "Quidquid latine dictum sit, altum viditur."
   |


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

Date: Thu, 19 Oct 2000 14:20:20 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: finding mode and median of an array of numbers
Message-Id: <39EF6594.CB4D727A@stomp.stomp.tokyo>

Craig Berry wrote:
 
> Gorbeast (gorbeast@SPAMSUCKS.subduction.org) wrote:
> : I have a question.  If anyone can give me an answer, I'd be much
> : obliged. This is the question: What is a good way to iterate over an
> : array of numbers and find the mode and median of those numbers?
 
> There are almost certainly modules out there which can do this more
> efficiently, but if your data set is small, this will suffice:
 
> #!/usr/bin/perl -w
> # mode - calculate mode and median of arguments
> # Craig Berry (20001019)



Some challenges for you, Mr. Berry.

Godzilla!
--

TEST SCRIPT:
____________


#!/usr/local/bin/perl

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


@Argv = qw (1 2 3 4 5 6);

print "Test 1: Mode: None  Median: 3.5\n";

&Test;


@Argv = qw (1 2 3 4 5 6 7);

print "\n\nTest 2: Mode: None  Median: 4\n";

&Test;


@Argv = qw (1 2 2 2 3 4 5 6 7);

print "\n\nTest 3: Mode: 2  Median: 3\n";

&Test;


@Argv = qw (1 2 3 40 50 60);

print "\n\nTest 4: Mode: None  Median: 21.5\n";

&Test;



sub Test
 {
  my $median = (sort { $a <=> $b } @Argv)[$#Argv / 2];      

  my %h;        
  $h{$_}++ foreach @Argv;
   
  my $mode = (sort { $h{$a} <=> $h{$b} } keys %h)[-1];

  print "  Test Results -  Mode: $mode  Median: $median\n\n";
 }

exit;


PRINTED RESULTS:
________________


Test 1: Mode: None  Median: 3.5
  Test Results -  Mode: 6  Median: 3



Test 2: Mode: None  Median: 4
  Test Results -  Mode: 6  Median: 4



Test 3: Mode: 2  Median: 3
  Test Results -  Mode: 2  Median: 3



Test 4: Mode: None  Median: 21.5
  Test Results -  Mode: 60  Median: 3


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

Date: Thu, 19 Oct 2000 21:35:25 GMT
From: Scott Corneil <scott@nospam.corneil.com>
Subject: formatting html email to send via sendmail
Message-Id: <39EF68F5.A00BE687@nospam.corneil.com>

Hi,

I'm having difficulty formatting the headers correctly to send html
email messages.  I can't use a module like MIME::Lite because I have no
root access, and the server admins don't allow modules to be installed.

Here's what I have.  The email client views it only as html source code.

open (HTML,"<$htmlemail");
@htmlsource = <HTML>;
close HTML;
open (MAIL, "|$mailprog -t") || die "Can't open $mailprog!\n";
print MAIL "To: $recipient\n";
print MAIL "From: $FORM{'FROM'}\n";
print MAIL "Subject: $FORM{'SUBJECT'}\n\n";
print MAIL "MIME-Version: 1.0\n";
print MAIL "Content-type: text/html\n\n";
foreach $htmlsource (@htmlsource)
        {
        print MAIL "$htmlsource";
        }
close MAIL;

I've tried it with and without the MIME-Version line, neither works.

I would appreciate any suggestions that anyone could make.

Scott



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

Date: Thu, 19 Oct 2000 21:43:00 GMT
From: Scott Corneil <scott@nospam.corneil.com>
Subject: Re: formatting html email to send via sendmail
Message-Id: <39EF6ABD.4EF71E5B@nospam.corneil.com>

Never mind.  I just figured out that two \n's signifies the end of the
header region, and I had 2 line breaks after my subject when I only should
have had one.

Scott Corneil wrote:

> Hi,
>
> I'm having difficulty formatting the headers correctly to send html
> email messages.  I can't use a module like MIME::Lite because I have no
> root access, and the server admins don't allow modules to be installed.
>
> Here's what I have.  The email client views it only as html source code.
>
> open (HTML,"<$htmlemail");
> @htmlsource = <HTML>;
> close HTML;
> open (MAIL, "|$mailprog -t") || die "Can't open $mailprog!\n";
> print MAIL "To: $recipient\n";
> print MAIL "From: $FORM{'FROM'}\n";
> print MAIL "Subject: $FORM{'SUBJECT'}\n\n";
> print MAIL "MIME-Version: 1.0\n";
> print MAIL "Content-type: text/html\n\n";
> foreach $htmlsource (@htmlsource)
>         {
>         print MAIL "$htmlsource";
>         }
> close MAIL;
>
> I've tried it with and without the MIME-Version line, neither works.
>
> I would appreciate any suggestions that anyone could make.
>
> Scott



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

Date: Thu, 19 Oct 2000 21:34:05 GMT
From: "EM" <me@privacy.net>
Subject: how do i find file size?
Message-Id: <hNJH5.7097$44.21423@news.iol.ie>

whats the perl code to find the size of a file?

also does anyone know any code to download a binary file off a http server
and save it to a file
i have a code for this already

$url = http://www.wherever.com/file.zip;
use LWP::Simple;
$file = get($url);

but this code is very unreliable & slow and often gets corrupted/not fully
downloaded files




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

Date: Thu, 19 Oct 2000 16:37:30 -0400
From: Slim <ShadeyGradey@hotpop.com>
Subject: How to find out the number of lines in a flat file.....
Message-Id: <c0muus86hf77rs5ott92mr9prg2p0a65gi@4ax.com>

Hello,
I'm trying to make a image gallery script and I'm using many flat file
databases..... they all may have more or less lines and I want to know
how to get the number of lines there are.....

also I've been trying to print out a table of them three cols by what
ever many rows to how many it needs to finish adding the images.......

to get the images I split the database up and get $thumb[0] is the
first image....... and there are a different number of thumbs in each
of the databases, could be 10, 20, etc.........

I would like to count up to the end of all the thumbs while adding
them in a table 3 across and what ever down to the thumbs
finish........

any help would be great,
thanks,
-Slim-



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

Date: Thu, 19 Oct 2000 20:25:23 GMT
From: trwww <trwww@my-deja.com>
Subject: Re: How to install DB_File package in windows perl
Message-Id: <8snlba$jhs$1@nnrp1.deja.com>

In article <39EEA673.F31E09B4@lucent.com>,
  myhandle@lucent.com wrote:
> I have installed perl windows version. How to install DB_File package?
(  like in
> unix we r moving to cpan prompt and typing "install DB_File" ) How to
do this
> for windows.
> Please Help
>
> Thanks and regars
> S Saravanan
>

The activestate version of perl comes with a utility called the Perl
Package Manager (PPM). Type ppm at a dos prompt and install your
package. You must have a network connection open first, of course.

Start->Programs->actveperl->online documentation will tell you all you
need to know.
--
trwww
http://digitalideas.virtualave.net/ (business)
http://gozips.uakron.edu/~trw3/ (personal)


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 19 Oct 2000 11:33:31 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: http referer manipulation
Message-Id: <39EF3E7B.D154DCD4@vpservices.com>

EM wrote:
> 
> I use this code to redirect the browser to an url
> 
> print "Content-type: text/html\n";
> print "Location: $url\n\n";
> 
> this works fine 

Really?  It is contrary to the specs.  You should issue either a
content-type or a location header, not both.  If you do continue to use
something similar to this method, I encourage you to use this instead
since it corrects that and other errors:

  use CGI qw(:standard);
  print redirect($url);

-- 
Jeff


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

Date: Thu, 19 Oct 2000 19:32:51 +0100
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: http referer manipulation
Message-Id: <ant1918517a1fNdQ@oakseed.demon.co.uk>

In article <tVFH5.7056$44.21265@news.iol.ie>, EM
<URL:mailto:me@privacy.net> wrote:
> I use this code to redirect the browser to an url
> 
> print "Content-type: text/html\n";
> print "Location: $url\n\n";

I thought the use of those two HTTP headers was mutually exclusive.
Either you tell the browser the location of the document with the
Location: header, *or* you send content with a Content-type: header.

> this works fine

Then either your web server or browser are compensating for your error.

> but i want a way to do this but not to send any http referer
> to the target url if possible

It's up to the browser whether to send a Referer: header, so you
don't have any control over that.

> also is there a way to send a fake http referer?

Ditto, so no.

PS. You should be asking about this in a CGI group, not this one.

-- 
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02



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

Date: 19 Oct 2000 21:50:38 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: http referer manipulation
Message-Id: <8snqbe$kujje$3@ID-24002.news.cis.dfn.de>

hi,
In comp.lang.perl.misc EM <me@privacy.net> wrote:
> I use this code to redirect the browser to an url

> print "Content-type: text/html\n";
> print "Location: $url\n\n";

> this works fine but i want a way to do this but not to send any http referer
> to the target url
> if possible also is there a way to send a fake http referer?

write your own browser:
perldoc lwpcook

means, insteat of redirecting to the url, call
the url with lwp (with your own referer), then
print out the result of the url.

tina

-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \__,_\___/\___/_| /__/ perception
please don't email unless offtopic or followup is set. thanx


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

Date: Thu, 19 Oct 2000 15:26:28 -0500
From: "Ancient1" <mikelm@ameritech.net>
Subject: Re: I need a DB solution
Message-Id: <aNIH5.16378$gj1.17534@nntp0.chicago.il.ameritech.net>

You may try "Ocelot" which can be used with the stock Win32::ODBC module.
http://ourworld.compuserve.com/homepages/OCELOTSQL/


"Fraser Maclennan" <fraser.maclennan@free-minder.com> wrote in message
news:39E798AC.465859DC@free-minder.com...
> I know Inprise (formerly Borland) have released an open source version of
> Interbase for Linux (as I am currently using it) and I think they are
intending
> to release the same for the Windows environments. You may want to check
out
> their site.
>
> Fraser
>
> Neb wrote:
>
> > Ok,
> >
> > I don't have anymore choice, I need a DB for my web site (which now has
more
> > than 600 members).
> >
> > Here are the facts: my web site "engine" is in Perl, that I develop on
my PC
> > (Windows 98).  My site is hosted by a "free" server on the internet (so,
I
> > don't have the control on the server) which is running some flavor of
Unix.
> >
> > Since I entend for my site to have one day thousands of members, I need
a DB
> > that I could change for something like SQL Server using ODBC.  But for
now,
> > I would maybe like to use Access, since I have it, plus it's easy to
> > manipulate the data in it.
> >
> > But if I don't have much access to my internet server, plus it's Unix,
is it
> > a good idea to use Access (and how)?!
> >
> > Or is there an other DB I can use that I don't need some kind of DB
server
> > to access it (not like MySql which needs to install a server to access a
DB)
> > ?  Some DB that can be used under Windows and Unix ?
> >
> > Thanks for the help!
> >
> > neb
>




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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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

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

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


------------------------------
End of Perl-Users Digest V9 Issue 4665
**************************************


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