[18433] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 601 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 2 21:08:44 2001

Date: Mon, 2 Apr 2001 18:05:48 -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: <986259948-v10-i601@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 2 Apr 2001     Volume: 10 Number: 601

Today's topics:
        A question about DB_File with different versions of Ber <nap@illx.org>
    Re: A question about DB_File with different versions of (Chris Fedde)
    Re: add lines from logfile <bmb@ginger.libs.uga.edu>
    Re: add lines from logfile <joe+usenet@sunstarsys.com>
    Re: Adding Values from an Array <mischief@velma.motion.net>
    Re: Advice on speeding up Perl launch (Me)
        ANNOUNCEMENT: SuperPython-0.91 released <mjd@plover.com>
    Re: ANNOUNCEMENT: SuperPython-0.91 released kent@darwin.eeb.uconn.edu
    Re: Any Perl code for a simple proxy server? (Nim Chu)
        atan2(y,x)*180/pi; <milliwave@rfengineering.freeserve.co.uk>
    Re: atan2(y,x)*180/pi; <milliwave@rfengineering.freeserve.co.uk>
    Re: atan2(y,x)*180/pi; <joe+usenet@sunstarsys.com>
    Re: atan2(y,x)*180/pi; <milliwave@rfengineering.freeserve.co.uk>
    Re: atan2(y,x)*180/pi; (Jay Tilton)
    Re: automatic email of data file <tlav1@mediaone.net>
    Re: automatic email of data file <mischief@velma.motion.net>
    Re: bash history from perl? (Abigail)
    Re: bash history from perl? (Peter Bismuti)
    Re: Better way to Flushing STDOUT? <donotreply@interbulletin.bogus>
    Re: binaries with Net::SMTP <webmaster@webdragon.unmunge.net>
    Re: cookies.how do I put one on a image? <chrisw+usenet@dynamite.com.au>
    Re: copying an array <peb@bms.umist.ac.uk>
        Current filename in one-liner - How? <eighner@io.com>
    Re: Current filename in one-liner - How? <tinamue@zedat.fu-berlin.de>
    Re: Current filename in one-liner - How? (Anno Siegel)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 02 Apr 2001 16:16:41 -0700
From: Nick Pinckernell <nap@illx.org>
Subject: A question about DB_File with different versions of Berkely DB's
Message-Id: <3AC90859.80307@illx.org>

Hello, I was just wondering why I could read this database type

database/database.db: Berkeley DB 2.X Hash/Little Endian (Version 5, 
Logical sequence number: file - 0, offset - 0, Bucket Size 4096, 
Overflow Point 10, Last Freed 1311, Max Bucket 952, High Mask 0x3ff, Low 
Mask 0x1ff, Fill Factor 0, Number of Keys 946)

with this code

#!/usr/bin/perl -w

use diagnostics;
use strict;
use DB_File;

tie my %db, "DB_File", "database/database.db", O_CREAT|O_RDWR, 0666, 
$DB_HASH;
print %db;
untie(%db);

BUT, I cannot read this database type
database/database.db.OLD: Berkeley DB 1.85 Hash/Little Endian (Version 
2, Bucket Size 4096, Bucket Shift 12, Directory Size 256, Segment Size 
256, Segment Shift 8, Overflow Point 9, Last Freed 75, Max Bucket 293, 
High Mask 0x1ff, Low Mask 0xff, Fill Factor 10, Number of Keys 2900)


I assume it has something to do witht the versions and I have
read the documentation on DB_File and it wasn't helpful, unless I'm blind.

I am running perl, version 5.005_03 built for i386-linux
and am using version 1.65 of DB_File

any help would be much appriciated.

thanks,
_nick



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

Date: Tue, 03 Apr 2001 00:04:22 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: A question about DB_File with different versions of Berkely DB's
Message-Id: <as8y6.542$T3.191127552@news.frii.net>

In article <3AC90859.80307@illx.org>, Nick Pinckernell  <nap@illx.org> wrote:
>Hello, I was just wondering why I could read this database type
>
>database/database.db: Berkeley DB 2.X Hash/Little Endian (Version 5, 
>BUT, I cannot read this database type
>database/database.db.OLD: Berkeley DB 1.85 Hash/Little Endian (Version 
>

Because some where between version 1 of Berkeley DB and version 2 there was
an incompatable file format change.  The www.sleepycat.com site has some
details on this for you.

chris
-- 
    This space intentionally left blank


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

Date: Fri, 30 Mar 2001 20:53:25 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: add lines from logfile
Message-Id: <Pine.A41.4.21.0103302039330.19306-100000@ginger.libs.uga.edu>

BB> Golf?
  
BB> perl -ane '$h{"@F[0,1]"}+=$F[2]}print"$_:$h{$_}\n"for keys%h;{' logfile
  
URI> perl -lane '$h{"@F[0,1]"}+=$F[2]}print"$_:$h{$_}"for keys%h;{' logfile
  
URI> one less (if you count the options)

I guess I win a Guinness:

perl -ane '$_{"@F[0,1]"}+=$F[2]}$"=$/;print"@{[%_]}";{' logfile

My, that was tasty.  :-)

Brad



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

Date: 30 Mar 2001 21:49:29 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: add lines from logfile
Message-Id: <m3g0fu7iva.fsf@mumonkan.sunstarsys.com>

Brad Baxter <bmb@ginger.libs.uga.edu> writes:

> BB> Golf?
>   
> BB> perl -ane '$h{"@F[0,1]"}+=$F[2]}print"$_:$h{$_}\n"for keys%h;{' logfile
>   
> URI> perl -lane '$h{"@F[0,1]"}+=$F[2]}print"$_:$h{$_}"for keys%h;{' logfile
>   
> URI> one less (if you count the options)
> 
> I guess I win a Guinness:
> 
> perl -ane '$_{"@F[0,1]"}+=$F[2]}$"=$/;print"@{[%_]}";{' logfile
> 
> My, that was tasty.  :-)
> 

  % perl -pale '$_{"@F[0,1]"}+=$F[2]}for(%_){' logfile

-- 
Joe Schaefer   "It is not best that we should all think alike; it is difference
                              of opinion that make horseraces."
                                               --Mark Twain


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

Date: Sat, 31 Mar 2001 02:38:31 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Adding Values from an Array
Message-Id: <tcagp7b91c9l24@corp.supernews.com>

Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:

> [dysfunctional comp.lang.perl trimmed from the newsgroups]

> According to Chris Stith  <mischief@velma.motion.net>:
>> FORM Rookie <m0rejunkmail@home.com> wrote:
>> > OK here we go again. I need your help.
>> 
>> > Here's what I have:
>> 
>> > %some_things = ($thing1 => "2",
>> >                           $thing2 => "4");
>> 
>> [snip]
>> 
>> > I need to add the values of $thing1 (2) and $thing2 (4) for a Grand
>> > Total.
>> 
>> [snip]
>> 
>>     my $total = eval join '+', values %foo;

> Oh, come on.  This may look pretty, but it is about as elegant as
> shaving with a lawn mower.  Don't string-eval unless you must.

Okay, let's relegate it to golf, then. I guess I'm just having
flashbacks to another language where evaluating a string isn't
such a strike on performance. What ever did happen to my Rexx
manual, anyway? Oh, that's right, I ritualistically burned it
when I started learning Perl.
  
>> or maybe:
>> 
>>     my $total;
>>     for (values %foo) { $total += $_ }

> The standard solution.  It is 26 times more efficient than the eval-
> thing on my machine.

But not as pretty. ;-)

I am surprised it's only 26 times more efficient.


>> or for the really perverse:
>> 
>>     my $total;
>>     $total = (map { $total += $_ } values %foo)[-1]; 

> Well... ahem... never mind :)

I did place a warning on that one. 


I thought I'd put a little humor and a little information in one
post. I now realize I should have labelled the eval version about
as strongly as the map version. I'm all for variety, but I'm sorry
if I gave anyone the impression the eval version is best.

Chris

-- 
Christopher E. Stith
People understand instinctively that the best way for computer programs to
communicate with each other is for each of the them to be strict in what they
emit, and liberal in what they accept. The odd thing is that people themselves
are not willing to be strict in how they speak, and liberal in how they listen.
 -- Larry Wall, 2nd State of the Onion Address, August 1998



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

Date: 2 Apr 2001 06:02:34 GMT
From: me@nospam.com (Me)
Subject: Re: Advice on speeding up Perl launch
Message-Id: <Xns9076EAA716D37mememeyeahme@206.165.3.70>

"David Akers" <David@TheAkers.com> wrote in
<3ac67ecc$1@news.dsldesigns.com>: 

>I thought about Apache Mod perl, but cannot find a binary
>distribution for windows, and I am not really set-up to do my own
>compiles. 

From http://perl.apache.org/distributions.html

Win32 ActivePerl mod_perl ppms - suitable for builds 6xx. You can 
install this via ppm: 
ppm install http://theoryx5.uwinnipeg.ca/ppmpackages/mod_perl-
xxx_yyy.ppd






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

Date: Sun, 01 Apr 2001 18:40:24 -0400
From: Mark-Jason Dominus <mjd@plover.com>
Subject: ANNOUNCEMENT: SuperPython-0.91 released
Message-Id: <20010401224025.12978.qmail@plover.com>


(I have crossposted this to comp.lang.python because it may be of
general interest there also.)

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

NAME
    SuperPython - Perl filter module to implement the SuperPython language

SYNOPSIS
      perl -MSuperPython hello.spy

      use SuperPython;
      # (SuperPython code follows here)
      no SuperPython;
      # regular Perl code resumes
      # (not recommended; regular Perl is too hard to understand and maintain)


DESCRIPTION
    This module implements a Perl source filter for the SuperPython
    language, allowing SuperPython code to be embedded into Perl programs.

    SuperPython brings to Perl all the benefits of Python's vaunted
    whitespace-sensitivity, including readability, maintainability, less
    punctuation, and all that other great crap. In fact, it goes several
    steps further than Python in this direction. However, SuperPython
    retains Perl's powerful and flexible underlying semantics.

    Example SuperPython programs (`*.spy') are included with this module.
    The syntax should be clear even to a casual observer; however, watch out
    for the upcoming 'SuperPython in a Nutshell' book from O'Reilly and
    Associates.

FUTURE WORK
    There is no reason why Python itself could not take advantage of the
    benefits of SuperPython's improved syntax. I look forward to working
    with the Python community to port this module to work with Python.

AUTHOR
    Mark Jason Dominus (mjd@plover.com)

SEE ALSO
    python(1).
----------------------------------------------------------------

The module is available from 
        http://perl.plover.com/SuperPython/SuperPython-0.91.tar.gz

and should be on the usual CPAN mirrors within the next 48 hours.


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

Date: 02 Apr 2001 07:00:01 -0500
From: kent@darwin.eeb.uconn.edu
Subject: Re: ANNOUNCEMENT: SuperPython-0.91 released
Message-Id: <uofufpl4u.fsf@darwin.eeb.uconn.edu>

Definitely the best April Fool's I've seen. It's going to take me
quite a while to figure out how that damn thing works. (If you
haven't followed the link to 

   http://perl.plover.com/SuperPython/SuperPython-0.91.tar.gz

do so.) What you see after the the standard install will delight and
amaze you!

Kent

-- 
Kent E. Holsinger                kent@darwin.eeb.uconn.edu
                                 http://darwin.eeb.uconn.edu
-- Department of Ecology & Evolutionary Biology          
-- University of Connecticut, U-3043                                       
-- Storrs, CT   06269-3043                                               


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

Date: Sat, 31 Mar 2001 11:18:52 GMT
From: nimchu@yahoo.com (Nim Chu)
Subject: Re: Any Perl code for a simple proxy server?
Message-Id: <3ac5e4ee.31356580@news-server.houston.rr.com>

merlyn@stonehenge.com (Randal L. Schwartz) wrote:

>1) Go to www.stonehenge.com/perl/googlecolumnsearch
>2) type "proxy HTTP::Daemon" in the search box
>3) follow the links

Thank you, both you (Randal Schwartz) and Blnukem for suggesting
places to look. I did look at the perl scripts, they are written for
the UNIX platform, not Windows 98. This is kind of a naive question,
can they run without modifications in 98? I happy to know Randal has
these tutorial columns and I can see they are very helpful.
Also the CGIPROXY script runs under some CGI system, does that mean to
make it run on my PC as a standalone program, I need substantial
re-write? If so, that may take a lot of learning.


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

Date: Sat, 31 Mar 2001 00:57:30 +0100
From: "Milliwave" <milliwave@rfengineering.freeserve.co.uk>
Subject: atan2(y,x)*180/pi;
Message-Id: <9a36dm$p0n$1@newsg4.svr.pol.co.uk>

I need a quick solution to the problem I am currently experiencing

I have $variable = atan2(y,x)*180/pi;

when y is (say) 0 and x = -600
$variable gives me an answer of 180 degrees which is incorrect, as
atan2(0, -600) should be equal to
zero, and hence $variable should be equal to zero. After investigating
further I noticed I got a wrong
answer whenever negative values (y,x) are involved? how do I overcome this
problem?


Many thanx





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

Date: Sat, 31 Mar 2001 01:42:44 +0100
From: "Milliwave" <milliwave@rfengineering.freeserve.co.uk>
Subject: Re: atan2(y,x)*180/pi;
Message-Id: <9a392g$1ij$1@newsg2.svr.pol.co.uk>

What is the difference between atan2() and atan()? The book I have states
the use of
arctangent atan2!

John Joseph Trammell wrote in message ...
>On Sat, 31 Mar 2001 00:57:30 +0100, Milliwave wrote:
>> I need a quick solution to the problem I am currently experiencing
>[snip]
>
>Perhaps you are confusing atan2() with atan()?
>




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

Date: 30 Mar 2001 19:53:07 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: atan2(y,x)*180/pi;
Message-Id: <m3ofui7o98.fsf@mumonkan.sunstarsys.com>

"Milliwave" <milliwave@rfengineering.freeserve.co.uk> writes upside-down
from the right half plane:

> What is the difference between atan2() and atan()? The book I have states
> the use of
> arctangent atan2!

One hint might be that atan2 takes two arguments (none-too-subtly named
"y" and "x"), while atan only takes one. Another might be that the range 
of atan2 is twice the range of atan. Finally, you might guess that
there's a C function that belies the origins of both:
  
  % man atan
 ...
  DESCRIPTION
       The  atan() function calculates the arc tangent of x; that
       is the value whose tangent is x.

  RETURN VALUE
       The atan() function returns the arc tangent in radians and
       the  value  is  mathematically defined to be between -PI/2
       and PI/2 (inclusive).
 ...


  % man atan2
 ...
  DESCRIPTION
       The atan2() function calculates the arc tangent of the two
       variables x and y.  It is similar to calculating  the  arc
       tangent  of y / x, except that the signs of both arguments
       are used to determine the quadrant of the result.

  RETURN VALUE
       The atan2() function returns the result in radians,  which
       is between -PI and PI (inclusive).
 ...

HTH
-- 
Joe Schaefer     "A cynic is a man who knows the price of everything and the
                                      value of nothing."
                                               --Mark Twain


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

Date: Sat, 31 Mar 2001 02:21:54 +0100
From: "Milliwave" <milliwave@rfengineering.freeserve.co.uk>
Subject: Re: atan2(y,x)*180/pi;
Message-Id: <9a3bca$69t$1@newsg1.svr.pol.co.uk>

After reading into the difference between atan and atan2.........
Yes, I need to make use of atan2(y,x) but the result is wrong when either or
both y,x are negative
integers? like some of the examples I have given below

Your guidance and help is appreciated

Thanx


Milliwave wrote in message <9a39gv$r1b$1@newsg4.svr.pol.co.uk>...
>The problem still exists
>when I use atan(y,x)*180/pi;
>say y=  -600
>      x =  -600
>answer = 45 degrees but instead gives me approx 90 degress
>
>
>
>Milliwave wrote in message <9a36dm$p0n$1@newsg4.svr.pol.co.uk>...
>>I need a quick solution to the problem I am currently experiencing
>>
>>I have $variable = atan2(y,x)*180/pi;
>>
>>when y is (say) 0 and x = -600
>>$variable gives me an answer of 180 degrees which is incorrect, as
>>atan2(0, -600) should be equal to
>>zero, and hence $variable should be equal to zero. After investigating
>>further I noticed I got a wrong
>>answer whenever negative values (y,x) are involved? how do I overcome this
>>problem?
>>
>>
>>Many thanx
>>
>>
>>
>
>




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

Date: Sat, 31 Mar 2001 02:48:32 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: atan2(y,x)*180/pi;
Message-Id: <3ac53ec9.154973049@news.erols.com>

On Sat, 31 Mar 2001 00:57:30 +0100, "Milliwave"
<milliwave@rfengineering.freeserve.co.uk> wrote:

>I need a quick solution to the problem I am currently experiencing
>I have $variable = atan2(y,x)*180/pi;
>when y is (say) 0 and x = -600
>$variable gives me an answer of 180 degrees which is incorrect, as

180 degrees is the correct measurement of the angle from origin to a
point on the negative X axis.

>atan2(0, -600) should be equal to
>zero, and hence $variable should be equal to zero.

That is incorrect.

The arctangent of y/x when y=0 and x=-600 is 0, but there is an
implicit expectation that you will correct the angle into the proper
quadrant as needed.

atan2 uses the signs of each coordinate to determine the quadrant and
automatically correct the angle.

This is basic high school geometry.  Go back and review rectangular
coordinate systems before accusing algorithms that have been around
for decades of being wrong.


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

Date: Mon, 02 Apr 2001 01:29:02 GMT
From: ted <tlav1@mediaone.net>
Subject: Re: automatic email of data file
Message-Id: <3AC800C0.38A42FFD@mediaone.net>

For the email question check out the module MIME::Lite

For setting up a daily time to have the file emailed to you try "man crontab" (
no quotes ) at UNIX command line.

Never encountered a textarea leaving <BR>s, usually textareas leave "\n"s or
"\r"s.  CGI.pm usually takes care of stuff like that pretty well.

Hope this gets you started,
ted



Roy Chappell wrote:

> HiYa All
>
> Not sure if this is the correct place to post a query here goes.
> I have a Profile Manager script up and running at
> http://www.everyday-recruitment.co.uk, that saves profiles to a flat file
> database. What i would like is for the data file to be automatically emailed
> to the site owner. I would like this to occur at least daily and preferably
> every time the data file is changed or from a button on a password protected
> page.
>
> The script also saves a <br> character in the data file from the large text
> areas when the form filler hits the return key for new lien. How can i stop
> this, as i have to use x-replace to remove them each time.
>
> Thanks for any help you can give me, my knowledge of cgi is limited (but iam
> very keen on improving it) so please be gently.
>
> SeeYa
>
> Roy Chappell



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

Date: Sat, 31 Mar 2001 02:43:56 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: automatic email of data file
Message-Id: <tcah3cqemjs1bc@corp.supernews.com>

Roy  Chappell <roy@greenparrot.fsnet.co.uk> wrote:
> HiYa All

> Not sure if this is the correct place to post a query here goes.

Although this could be solved with Perl, it would be more easily
solved with cron or at, depending on your OS, optional utility
program packages, and preference.

> database. What i would like is for the data file to be automatically emailed
> to the site owner. I would like this to occur at least daily and preferably

This is where cron or at comes in.

> The script also saves a <br> character in the data file from the large text
> areas when the form filler hits the return key for new lien. How can i stop
> this, as i have to use x-replace to remove them each time.

In Perl,

    $string =~ s/<br>//g;

Chris

-- 
Christopher E. Stith
Programming is a tool. A tool is neither good nor evil. It is
the user who determines how it is used and to what ends.



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

Date: Fri, 30 Mar 2001 23:12:37 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: bash history from perl?
Message-Id: <slrn9ca4n5.5bo.abigail@tsathoggua.rlyeh.net>

Peter Bismuti (bismuti@cs.fsu.edu) wrote on MMDCCLXVIII September
MCMXCIII in <URL:news:9a0lo3$qto$1@news.fsu.edu>:
,, 
,, I tried writing a script that executed the 'history' command and 
,, parsed the output.  What I discovered is that the history command is
,, a bash command, there is no binary file, no /bin/history or 
,, /usr/bin/history.  I can't figure out any way of executing it from within
,, perl, `` don't work.  Reading in the .bash_history command directly 
,, doesn't work either since the history is cached and what is in the file
,, does not represent the current history, but what the history was the 
,, last time a shell exited ( I believe ). 
,, 
,, 
,, How can this be done?


Probably by modifying the source code of bash and implementing an
interface.

Your problem isn't "how do I do X in Perl", but "how do I make Y available
from bash". So, you should ask a group about bash.  Probably somewhere
in the gnu.* hierarchy.



Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'


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

Date: 2 Apr 2001 23:07:55 GMT
From: bismuti@cs.fsu.edu (Peter Bismuti)
Subject: Re: bash history from perl?
Message-Id: <9ab0ob$n5b$1@news.fsu.edu>

Yes, but your history is cached until your shell exits and then written out to
 .bash_history, so it is worthless unfortunately. 

Gregory Toomey (gtoomey@usa.net) wrote:
: The history command is a shell builtin, like echo.
: history does not work in batch mode (see man bash).
: 
: ~/.bash_history is inititlised at startup, but still should be readable.
: 
: gtoomey
: -------------
: "Peter Bismuti" <bismuti@cs.fsu.edu> wrote in message
: news:9a0lo3$qto$1@news.fsu.edu...
: >
: > I tried writing a script that executed the 'history' command and
: > parsed the output.  What I discovered is that the history command is
: > a bash command, there is no binary file, no /bin/history or
: > /usr/bin/history.  I can't figure out any way of executing it from within
: > perl, `` don't work.  Reading in the .bash_history command directly
: > doesn't work either since the history is cached and what is in the file
: > does not represent the current history, but what the history was the
: > last time a shell exited ( I believe ).
: >
: >
: > How can this be done?
: >
: > Thanks!
: >
: 
: 


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

Date: Sun, 01 Apr 2001 21:56:53 +0000
From: Hon-Chi Ng <donotreply@interbulletin.bogus>
Subject: Re: Better way to Flushing STDOUT?
Message-Id: <3AC7A425.1C2409B6@interbulletin.com>

anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in article 
<9a1e48$9uu$1@mamenchi.zrz.TU-Berlin.DE> : 
>According to Bernie Cosell  <bernie@fantasyfarm.com>:
>> Ilmari Karonen <iltzu@sci.invalid> wrote:
>> 
>> } In article <3AC0F6FC.48D60A15@interbulletin.com>, Hon-Chi Ng wrote:
>> } >
>> } >I would like to flush any buffered output in STDOUT at a given point in my
>> } >Perl script, is
>> } >
>> } >  $old_autoflush = $|; $| = 1; print ""; $| = $old_autoflush;
>> } 
>> }    {local $| = 1}
>> 
>> Doesn't quite work: you need the print to actually make the flush happen:
>>   {local $| = 1; print ""}
>> does the job.
>
>One might think so, but setting $| to true flushes the file immediately.
>See perlvar.

It depends on which version of perlvar.  Only version 5.004 or later says
  "forces a flush right away and after every write or ..."

But, version 5.003 or before says
  "forces a flush after every write or ..."

So, does it mean $| will only flush "right away" when set to non-zero in
Perl 5.004 or later?  Or was the perlvar 5.003 or before just "unclear" on $|?

Hon-Chi

_______________________________________________
Submitted via WebNewsReader of http://www.interbulletin.com



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

Date: 2 Apr 2001 19:56:41 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: binaries with Net::SMTP
Message-Id: <9aalhp$6qn$1@216.155.32.18>

In article <3AC8B46F.49970CC9@ugs.com>, Ron Hill <hillr@ugs.com> wrote:

 | novastar wrote:
 | > 
 | > Thanks Logan,
 | > 
 | > I knew it, it would be hard !
 | > 
 | > George
 | > 
 | [snipped]
 | 
 | It's not that hard try something like this
 | 
 | use Mail::Internet;
 | use MIME::Entity;
 | 
 | $top = MIME::Entity-> build(   Type     => "multipart/mixed",
 |                                From    => 'someone@somewhere.com',
 |                                To      => 'someone@somewhere.com',
 |                                Subject => "test message",
 |                                );   
 | 
 |                                
 | 
 | $top->attach(    Path     => '/your/binary/here',
 |                  Type     => "/your/type/here",
 |                  Encoding => "base64");
 | 
 | $top->attach(Path=>"/your/text/file/here");
 | 
 | 
 | $top->smtpsend(host=>'your.smtphost.here');

does this use Net::SMTP ? 

if so, it might also be sending invalid RFC-822 headers (something I 
encountered recently).. Would anyone know the method for sending the 
above (or similarly via MIME::Lite) created MIME message via 
Mail::Mailer instead? 

I'm *very* curious to know how to do this, as a script I am currently 
working on to e-mail a resulting template to a user from their filling 
in a form is nearing that stage of being built. :)

All previous attempts at parsing the docs (MIME::Lite, Mail::Mailer, 
Net::SMTP) have been slightly less than enlightening, possibly due to my 
(as yet) lack of understanding in the matter, and I can 
almost-but-not-quite connect the dots.. *sigh* 

The author of MIME::Lite might wish to consider the optional use of the 
MailTools modules if they are present instead of directly using 
Net::SMTP (unless his usage has somehow gotten around this in ways I'm 
not aware of as yet).

-- 
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw"; 
# ( damn spammers. *shakes fist* take a hint. =:P )


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

Date: Tue, 3 Apr 2001 08:43:47 +1000
From: "Chris W" <chrisw+usenet@dynamite.com.au>
Subject: Re: cookies.how do I put one on a image?
Message-Id: <Ei7y6.3$uV5.59451@news.interact.net.au>

<gabloid@eudoramail.com> wrote in message
news:3ac81612.7513138@news.aruba.it...
> I'd like to know if it is possible to put a cookie on a image, so that
> how download it sends me back the cookie..

http://www.eff.org/pub/Privacy/Profiling_cookies_webbugs/web_bug.html

Since the main users of sureptitious data gathering techniques like this are
marketing companies and spammers you will generally not be liked for these
sorts of shennanigans.




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

Date: Mon, 02 Apr 2001 15:46:27 +0100
From: Paul Boardman <peb@bms.umist.ac.uk>
Subject: Re: copying an array
Message-Id: <3AC890C3.10273AE6@bms.umist.ac.uk>

danny webster wrote:
> im writing this script to strip out VirtualHosts from apache into
> an array. The beginning starts <VirtualHost domain.com>
> then ends with </VirtualHost>
> 
> I have that read into an array call conf.
> 
> How can I copy the stuff between the above delimiting parts, into a
> new array? This is how it is atm:
> 
> @conf = <CONF>;
>         for($i=1;$i< ($#conf +1);$i++)   {
>         #print "DEBUG: (Line $i) ->      $conf[$i]\n";
>                 if ($conf[$i] =~ /^<VirtualHost \D+>/i) {
>                    print "$conf[$i]\n";
>                         # We are now inside the vhost section.
>                         while ($conf[$i] !~ /^<\/VirtualHost/i) {
>                                 print "$conf[(($i++) + 1)]\n";
>                                    $vhost[$j] = $conf[$i];
> 
>                         }
>                 } # end if
> } # end for

how about

while(<CONF>){
	if(/<VirtualHost domain.com>/../<\/VirtualHost>/){
		push(@vhost, $_);
	}
}

Ths saves the tags as well, but if you want to remove them its a simple
unshift and pop operation.

Paul


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

Date: 02 Apr 2001 02:12:25 -0500
From: Lars Eighner <eighner@io.com>
Subject: Current filename in one-liner - How?
Message-Id: <86ae5zydut.fsflars@dumpster.io.com>

How can I use the current filename in a one-liner?

For example:

perl -pi -e "s/flastmod file\=\"/flastmod file\=\"$$$$/g" *.html

The $$$$ is where I want the name of whatever the current file
is.  $ARGV doesn't work outside of a glob, so it doesn't work
here.

-- 
  Lars Eighner           eighner@io.com           http://www.io.com/~eighner/
Break out of the faceless masses: http://www.cs.indiana.edu/picons/ftp/faq.html
       Health is merely the slowest possible rate at which one can die.


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

Date: 2 Apr 2001 10:20:57 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: Current filename in one-liner - How?
Message-Id: <9a9jq9$46sbm$2@fu-berlin.de>

hi,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> According to Lars Eighner  <eighner@io.com>:
>> 
>> perl -pi -e "s/flastmod file\=\"/flastmod file\=\"$$$$/g" *.html

>   perl -pi -e 's/flastmod file=/"flastmod file="$$$$/g' *.html'

close =)

perl -pi -e 's/flastmod file="/flastmod file="$$$$/g' *.html

(note that on windows you need to put " around the code (AFAIK)
instead of single quotes.)

regards,
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: 2 Apr 2001 10:28:08 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Current filename in one-liner - How?
Message-Id: <9a9k7o$9kg$3@mamenchi.zrz.TU-Berlin.DE>

According to Tina Mueller  <news@tinita.de>:
> hi,
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> > According to Lars Eighner  <eighner@io.com>:
> >> 
> >> perl -pi -e "s/flastmod file\=\"/flastmod file\=\"$$$$/g" *.html
> 
> >   perl -pi -e 's/flastmod file=/"flastmod file="$$$$/g' *.html'
> 
> close =)
> 
> perl -pi -e 's/flastmod file="/flastmod file="$$$$/g' *.html

Oh... right.
 
> (note that on windows you need to put " around the code (AFAIK)
> instead of single quotes.)

Yes, shell quoting conventions may enter the picture.  All one-liners
(command-liners?) share this minor portability problem.

Anno


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

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 V10 Issue 601
**************************************


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