[19633] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1828 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 27 06:06:56 2001

Date: Thu, 27 Sep 2001 03:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1001585111-v10-i1828@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 27 Sep 2001     Volume: 10 Number: 1828

Today's topics:
    Re: [ASK] Perl and Windows <hkdennis2k@yahoo.com.hk>
        binmode with "perl -p" doesn't work (John Lin)
    Re: binmode with "perl -p" doesn't work <bart.lateur@skynet.be>
    Re: Custom Perl Script for Scanning IP's and Resources? <martin@ppmedia.at>
        Emacs modules for Perl programming (Jari Aalto+mail.perl)
    Re: Encrypt/Decrypt (Damian James)
    Re: exec call | mpack (Villy Kruse)
        GIF encoding <sspivey3@tampabay.rr.com>
    Re: GIF encoding (Martien Verbruggen)
    Re: Goto and global variables <dscarlett@REMOVETHIS.optushome.com.au>
        Horrible word "LOCAL" (was: Re: package initialization) (David Combs)
    Re: How do I compare strings? <goldbb2@earthlink.net>
    Re: How To Copy Files in Script w/Shell? <pne-news-20010927@newton.digitalspace.net>
        lists init  <tibaer@infomaniak.ch>
    Re: lists init (Martien Verbruggen)
        maths <na>
    Re: MIME::Lite problem (Villy Kruse)
        MSSQL and BLOBs <gusmail@gmx.net>
    Re: multipul http connections <goldbb2@earthlink.net>
        no database driver specified and DBI_DSN env var not se <ochampag@nortelnetworks.com>
        oracle <egcotzzi@altanvistai.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 27 Sep 2001 11:10:13 +0800
From: "Dennis" <hkdennis2k@yahoo.com.hk>
Subject: Re: [ASK] Perl and Windows
Message-Id: <9ou76m$9sj1@rain.i-cable.com>

 ......
But I still don't know how to put a tray-icon........
Is the following code right or not??
I saw it add a space at tray-icon......but, I don't know how to set the icon......
---------
use Win32::API;
$trayicon=new Win32::API("shell32","Shell_NotifyIcon",[I,P],V);
$p=pack("LLLLLL",0,0,0,0,0,0).' 'x64;
$p=pack("LLLLLL",length($p),$$,0,0,0x200,?????????????????).'ToolTip'."\x0";
#                                                                      ^^^^^^^^^^^^^^^^^ Any body can help me?
$return=$trayicon->Call(0,$p);
$i=<STDIN>;
$return=$trayicon->Call(2,$p);




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

Date: 26 Sep 2001 21:23:20 -0700
From: johnlin@chttl.com.tw (John Lin)
Subject: binmode with "perl -p" doesn't work
Message-Id: <a73bcad1.0109262023.698f5c5e@posting.google.com>

Dear all,
I got stuck when trying to help people with this question:
"substitute a certain string in a binary file with binmode" (on Win32)
He assumes the substitution won't destroy the binary file.

I was preparing to give this answer (1.doc is a MS-Word file):

perl -i.bak -0777 -ple "BEGIN{binmode STDIN; binmode STDOUT} s/abc/123/g" 1.doc

but I found binmode doesn't work with "perl -p".
The file size is changed.  Is this a bug of ActivePerl?

Secondly, I propose a "perl -b" switch for binmode processing.

Thank you.
John Lin

P.S.  Experiment:
Use right-click to create a new empty MS-Word document "1.doc".
The file size is 10752.  After running this command:

perl -i.bak -wpe "BEGIN{binmode STDIN; binmode STDOUT}" 1.doc

the file size becomes 6.
I suppose the file should be unchanged if binmode works correctly
(regardless of line mode or slurp mode).


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

Date: Thu, 27 Sep 2001 09:50:27 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: binmode with "perl -p" doesn't work
Message-Id: <f3t5rt8h539j7o6fm4tf6pcal840ugabcj@4ax.com>

John Lin wrote:

>I was preparing to give this answer (1.doc is a MS-Word file):
>
>perl -i.bak -0777 -ple "BEGIN{binmode STDIN; binmode STDOUT} s/abc/123/g" 1.doc
>
>but I found binmode doesn't work with "perl -p".
>The file size is changed.  Is this a bug of ActivePerl?

I think  it is because your file doesn't come in on STDIN, but on ARGV,
and your STDOUT isn't the same STDOUT you started with.

I don't think you can achieve this. You should set binmode on ARGV (not
STDIN) everytime a new file is opened,but *before* anything is read. And
that is impossible. If <> sees no file open, it will get the next file
from @ARGV, open it, and read a line, before you get a chance to set
binmode.

-- 
	Bart.


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

Date: Thu, 27 Sep 2001 11:13:48 +0200
From: Martin <martin@ppmedia.at>
Subject: Re: Custom Perl Script for Scanning IP's and Resources?
Message-Id: <3BB2EDCC.10702@ppmedia.at>

in this function you can create a ip range
and then just ping it

use NetAddr::IP qw($Use_CIDR_Notation $Always_Display_Mask);

# generates a ip reange
sub _make_range
     {
     my $start = shift;
	my $end = shift;
	my $ip = new NetAddr::IP "$start";
	my $final_ip = new NetAddr::IP "$end";
     my @range = $ip->range($final_ip);
	foreach (@range)
     	{
	 
	my $test = $_->to_string;
		$test =~ s/\/.+$//ig;
		push @out, $test;
   		}
     return @out;
     }

Nezar Nielsen wrote:

> "Belphegor" <globalpunk@hotmail.com> wrote in message
> news:isyg7.31951$vG4.1593277@weber.videotron.net...
> 
>>Okay, here's the issue
>>
>>I need to get a perl script that will scan ips, (ping them) with a given
>>set.
>>1. I say "192.1.1 -100" and it'll ping  from "192.1.1.1" to "192.1.1.255",
>>with the exception of "192.1.1.100".
>>2. Then it asks for Samba Share name.
>>3. Then it asks for the SHARES it enters ALL Share data, and EVERY Last
>>
> file
> 
>>into a given database......
>>
> 
> Take a look at the following modules available from CPAN:
> 
> Net::Ping,
> Filesys::SmbClient &
> Filesys::SmbClientParser
> 
> If you're using Win32, also take a look at the Win32::* modules available
> from http://www.roth.net/perl/
> 
> and for db-stuff: DBI and DBD::whatever_kind_of_db_you_want_to_use.
> 
> If you want a working script, pay up, otherwise, read the modules'
> documentation and at least give it a try yourself.
> 
> XFUT: comp.lang.perl.misc,comp.lang.perl.modules,dk.edb.programmering.perl
> FUT: comp.lang.perl.misc
> 
> --
> Mvh. Nezar Nielsen
> http://fez.dk/
> 
> 
> 
> 



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

Date: 27 Sep 2001 09:17:38 GMT
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: Emacs modules for Perl programming
Message-Id: <perl-faq/emacs-lisp-modules_1001582193@rtfm.mit.edu>

Archive-name: perl-faq/emacs-lisp-modules
Posting-Frequency: 2 times a month
URL: http://tiny-tools.sourceforge.net/
Maintainer: Jari Aalto <jari.aalto@poboxes.com>

Announcement: "What Emacs lisp modules can help with programming Perl"

    Preface

        Emacs is your friend if you have to do anything comcerning software
        development: It offers plug-in modules, written in Emacs lisp
        (elisp) language, that makes all your programmings wishes come
        true. Please introduce yourself to Emacs and your programming era
        will get a new light.

    Where to find Emacs/XEmacs

        o   Unix:
            http://www.gnu.org/software/emacs/emacs.html
            http://www.xemacs.org/

        o   Windows
            http://www.gnu.org/software/emacs/windows/ntemacs.html
	    ftp://ftp.xemacs.org/pub/xemacs/windows/setup.exe

	o   More Emacs resources at 
	    http://tiny-tools.sourceforge.net/emacs-elisp.html


Emacs Perl Modules

    Cperl -- Perl programming mode

        .ftp://ftp.math.ohio-state.edu/pub/users/ilya/perl
        .<olson@mcs.anl.gov>           Bob Olson (started 1991)
        .<ilya@math.ohio-state.edu>    Ilya Zakharevich

        Major mode for editing perl files. Forget the default
        `perl-mode' that comes with Emacs, this is much better. Comes
        standard in newest Emacs.

    TinyPerl -- Perl related utilities

	.http://tiny-tools.sourceforge.net/

        If you ever wonder how to deal with Perl POD pages or how to find
        documentation from all perl manpages, this package is for you.
        Couple of keystrokes and all the documentaion is in your hands.

        o   Instant function help: See documentation of `shift', `pop'...
        o   Show Perl manual pages in *pod* buffer
        o   Load source code into Emacs, like Devel::DProf.pm
        o   Grep through all Perl manpages (.pod)
        o   Follow POD manpage references to next pod page with TinyUrl
        o   Coloured pod pages with `font-lock'
        o   Separate `tiperl-pod-view-mode' for jumping topics and pages
            forward and backward in *pod* buffer.
        o   TinyUrl is used to jump to URLs (other pod pages, man pages etc)
            mentioned in POD pages. (It's a general URL minor mode)

    TinyIgrep -- Perl Code browsing and easy grepping

        [TinyIgrep is included in the Kit]

        To grep from all installed Perl modules, define database to
        TinyIgrep. There is example file emacs-rc-tinyigrep.el that shows
        how to set up datatbases for Perl5, Perl4 whatever you have
        installed

        TinyIgrep calls Igrep.el to run the find for you, You can adjust
        recursive grep options, ignored case, add user grep options.

        You can get `igrep.el' module from <kevinr@ihs.com>. Ask for copy.
	Check also ftp://ftp.ihs.com/pub/kevinr/

    TinyCompile -- Browsing grep results in Emacs *compile* buffer

        TinyCompile is minor mode for *compile* buffer from where
        you can collapse unwanted lines, shorten the file URLs

            /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file1:NNN: MATCHED TEXT
            /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file2:NNN: MATCHED TEXT

            -->
            cd /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/
            file1:NNN: MATCHED TEXT
            file1:NNN: MATCHED TEXT

End



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

Date: 27 Sep 2001 06:48:24 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Encrypt/Decrypt
Message-Id: <slrn9r5ip2.1se.damian@puma.qimr.edu.au>

On Thu, 27 Sep 2001 11:42:50 +0930, Wyzelli said:
>"Logan Shaw" <logan@cs.utexas.edu> wrote in message
>news:9ou19a$gs8$1@charity.cs.utexas.edu...
>> In article <9otf71$lt8$01$1@news.t-online.com>,
>> Steffen Müller <tsee@gmx.net> wrote:
>> >"David Wall" <darkon@one.net> schrieb im Newsbeitrag
>> >news:Xns9128AA5FCF3B8darkononenet@207.126.101.97...
>> >> So is "buttload" one of those Perl culture terms like JAPH or
>Schwartzian
>> >> Transform?
>> >
>> >Maybe just bad English?
>>
>> Yeah, it is an English measurement unit (most of which are bad).  The
>> metric unit for the same quantity is the "metric buttload".
>>
>> Closely related to the "buttload" is the "boatload".  There is a
>> "metric boatload" too.
>
>In Australia, all metric boatloads get sent to Nuaru.

tr/ua/au/;

I am assured by many old hands that 'bootload' was a data quantity,
which is closely related to the statement:

    Never underestimate the bandwidth of
    a station wagon full of tapes.

I'm sure I once had an attribution for that line, but can't for the
life of me place it now. Anyone have an idea?

Cheers,
Damian
-- 
@:=grep!(m!$/|#!..$|),split//,<DATA>;@;=0..$#:;while($:=@;){$;=rand
$:--,@;[$;,$:]=@;[$:,$;]while$:;push@|,shift@;if$;[0]==@|;select$,,
$,,$,,1/80;print qq x\bxx((@;+@|)*$|++),@:[@|,@;],!@;&&$/}  __END__
Just another Perl Hacker,### http://home.pacific.net.au/~djames.hub


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

Date: 27 Sep 2001 08:05:38 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: exec call | mpack
Message-Id: <slrn9r5nei.j8v.vek@pharmnl.ohout.pharmapartners.nl>

On 26 Sep 2001 21:04:09 GMT,
    Abigail <abigail@foad.org> wrote:


>evan.cooch@NOSPAMcornell.edu (evan.cooch@NOSPAMcornell.edu) wrote on
>MMCMXLVIII September MCMXCIII in <URL:news:3bb1cafa.52551636@newsstand.cit.cornell.edu>:
>|| Grettings -
>|| 
>|| I wrote several perl scripts for handling file upoads via a webpage,
>|| using an exec function call to mpack to MIME encode the uploaded file
>|| before mailing it to me. 
>|| 
>|| However, I'm not able to figure out an easy way to prevent the mail
>|| coming in from 'nobody'. Basically, any process run by the perl script
>|| assigns nobody as the owner, and thus any mail mpack sends out from
>|| the exec(mpack) call comes in from nobody, which is a pain to
>|| reply-to: I end up having to parse the note to find the users real
>|| email address (which is a form variable), and then paste that in place
>|| manually for the reply. 
>|| 
>|| Anyone know a simple workaround?
>
>That's why there's a Reply-To header.
>



For these kind of message you typical have three addresses.

The address of the sending person, which goes into the From: header field.

The address to which people is supposed to reply to, which goes into
the Reply-To: header.  This address may be different from the From:
address if the replies should go to some mailing list rather than
to the sending person.

Then you have the envelope sender (nobody@xxx here) which is the address
you specify with the -f sendmail option or the MAIL FROM: SMTP command.
By default the envelope sender will be the same as the user id the program
runs as appended by @ and hostname of the system the program runs on.
This is the address receiving messages about deliviry problems, and it
is most convenient that these error message goes to the maintainer of
the web site rather than to the sending person or the reply-to address.


Villy


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

Date: Thu, 27 Sep 2001 05:35:18 GMT
From: Steve Spivey <sspivey3@tampabay.rr.com>
Subject: GIF encoding
Message-Id: <3ee5rtkbot90s1ada32s065l6had2ah9un@4ax.com>

Does anyone know o a good GIF encoding script?  I need to create a pic
on the fly, but I don't know anything about how to encode the pixels.

I know the file format, so if the script can just encode, then I can
build the GIF. 


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

Date: Thu, 27 Sep 2001 16:36:57 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: GIF encoding
Message-Id: <slrn9r5i89.t75.mgjv@martien.heliotrope.home>

On Thu, 27 Sep 2001 05:35:18 GMT,
	Steve Spivey <sspivey3@tampabay.rr.com> wrote:
> Does anyone know o a good GIF encoding script?  I need to create a pic
> on the fly, but I don't know anything about how to encode the pixels.
> 
> I know the file format, so if the script can just encode, then I can
> build the GIF. 

You're confusing me. If you know the file format, then you know the
'encoding'. If you are talking about LZW compression, then you can
forget it. The LZW compression scheme is proprietory, and is not allowed
to be used without licensing fees being paid to Unisys. Complain to
them.

If you want to create images, the normal options are

- use the GD module 
    jpg, png, wbmp output
- use the Image::Magick module
    virtually any image format is supported. raw RGB pixels can be given
    as input, if you want to build the image yourself, pixel by pixel.
- use the Imager module
    this has been a bit unstable for me.
- write something yourself, from scratch.
    You probably shouldn't be using Perl. It'll be too slow, unwieldy
    and memory hungry, really.

Base don your rather vague requirements, I'd say Image::Magick is
your best bet.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | I used to have a Heisenbergmobile.
Commercial Dynamics Pty. Ltd.   | Every time I looked at the
NSW, Australia                  | speedometer, I got lost.


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

Date: Thu, 27 Sep 2001 04:24:38 GMT
From: "David Scarlett" <dscarlett@REMOVETHIS.optushome.com.au>
Subject: Re: Goto and global variables
Message-Id: <aSxs7.4527$98.22471@news1.rivrw1.nsw.optushome.com.au>

"Mark Jason Dominus" <mjd@plover.com> wrote in message
news:3bb1cf0a.2146$1e0@news.op.net...
> Do you find that funny as well?

Yes.


--
David Scarlett
dscarlett@REMOVETHIS.optushome.com.au
http://www.listen.to/artifice/
http://members.optushome.com.au/dscarlett/

"Damn it, Kif, where's the little umbrella? That's what makes it a scotch on
the rocks!"
        -Capt. Zapp Brannigann, Futurama




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

Date: 27 Sep 2001 07:09:47 GMT
From: dkcombs@panix.com (David Combs)
Subject: Horrible word "LOCAL" (was: Re: package initialization)
Message-Id: <9oujbr$g9i$1@news.panix.com>

In article <slrn9qg284.2ps.tadmc@tadmc26.august.net>,
Tad McClellan <tadmc@augustmail.com> wrote:
><SNIP>
>
>Also: 
>
>   my() is about variables. local() is about the _value_
>   of variables.
>
>my() gets you a new variable.
>
>local() does not get you a new variable (except via "first use",
>but any operator can do that).
>
>local() gets you a new _value_ for the variable.
>
>local() does not get you a "local variable", it gets you
>a "local value" (which, strangely enough, is NOT local,
>but global!).
>
>That's right, dynamic variables are global variables. Most folks
>already know why global variables are bad, and so should not
>require much convincing to use lexicals.
>

Seems to me that some perl+lisp guru is needed to
"really" explain all this.

Would have to start with what lisp did circa 1960
up through maclisp (and what emacs-lisp still does).

When there wasn't even the *concept* of lexical 
variables -- not yet invented.

A discussion of why lisp could last as long as
it did with only dynamic binding.

Some of he *useful* things available only via
*dynamic* binding.

The two ways of implementing them, via either
deep or shallow binding (as discussed in
Allen's early 70's classic book on lisp).

Then how Steele and whats-his-name at mit came
up with Scheme and lexical variables, and why
they were considered better (and far safer).

Then how Common Lisp, successor to maclisp,
switched to lexical variables -- but still kept
the dynamic ability via the content-free
name "special" (but vastly better than "local"!).

-----

I have now exhausted everything I know about the
subject -- or at least *thought* I knew.

But the naming of "local" is *so* horrible and
confusing that I believe it will take some
extreme step like the above explanation
(fleshed out with correct information, not
my wild guesswork) to make it clear.

Further, some pictures would help, showing
how this stuff (my, local, our, ...) is IMPLEMENTED --
to give the user a *concrete* (rather than abstract)
understanding of what's happening.

----

Finally, I sure wish Larry et al would *not* 
creat new names for old concepts -- just use
the name that people (in c.s.) have *already*
been using, written up in papers, textbooks,
etc.

Doing so will sure make perl easier (quicker)
to learn for those who have a c.s. background!

End of david's rant.


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

Date: Thu, 27 Sep 2001 00:19:48 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: How do I compare strings?
Message-Id: <3BB2A8E4.AA7DE560@earthlink.net>

Bart Lateur wrote:
> 
> Benjamin Goldberg wrote:
> 
> >> How can I find this position, short of writing a for loop that will
> >> go through each string and use substr to compare character by
> >> character?
> >
> >       $pos = index( "$str1" ^ "$str2", "\0" );
> >
> >Using index should be faster than using a regex.  Plus, this is a
> >little bit clearer.
> 
> Except it's useless. The OP wants the first byte that's DIFFERENT from
> "\0", not the first one that's the same.

Umm, oops?  I made a thinko?

-- 
"I think not," said Descartes, and promptly disappeared.


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

Date: Thu, 27 Sep 2001 07:07:46 +0200
From: Philip Newton <pne-news-20010927@newton.digitalspace.net>
Subject: Re: How To Copy Files in Script w/Shell?
Message-Id: <2pc5rt0ser0nsn2ratcd85r3k2vodl4au5@4ax.com>

On Wed, 26 Sep 2001 05:35:50 GMT, Bob Walton <bwalton@rochester.rr.com>
wrote:

>     exec('scp /home/cust/*.cust herring:/home/cust/');

This gives you a warning under -w ("Statement unlikely to be reached"),
I think, unless you also remove the exit(0) afterwards.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Thu, 27 Sep 2001 10:17:00 +0200
From: Thierry Baertschiger <tibaer@infomaniak.ch>
Subject: lists init 
Message-Id: <3BB2E07C.F658621C@infomaniak.ch>

Hello!

I'm a new Perl programer and I've got a question about something strange
that happens to me:

in a sub program, I have

I define a list of list as

my @F = ([0.0,0.0,0.0]) x $N;

and I make a loop

for $i (0 .. $N-1){
    for $j (0..2) {

        $value=result of a calculation;
        $F[$i][$j] += $value;

    }
}

the problem is that $F[$i][$j] doesn't change (even if $value != 0 !!!)
but if
I put  $F[$i][$j] += 1.0;  then it works  (increments of 1 !!)


If I initialize @F with  a loop  then it works:    $F[$i][$j] +=
$value;   is ok !!

Can anybody explain me  what is the problem !

and if there is a better way to initialize a list.


Thanks


Thierry



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

Date: Thu, 27 Sep 2001 19:25:18 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: lists init
Message-Id: <slrn9r5s3u.t75.mgjv@martien.heliotrope.home>

On Thu, 27 Sep 2001 10:17:00 +0200,
	Thierry Baertschiger <tibaer@infomaniak.ch> wrote:
> Hello!
> 
> I'm a new Perl programer and I've got a question about something strange
> that happens to me:
> 
> in a sub program, I have
> 
> I define a list of list as
> 
> my @F = ([0.0,0.0,0.0]) x $N;

Well, you sort of do. What you do here is you create 1 anonymous array
reference, and then you create a list of three copies of this same
reference.  Also: you don't need to put 0.0 in there. For Perl there
isn't really a difference. When something needs to be a double, it'll be
a double.

my @F;
push @F, [0, 0, 0] for 1 .. $N;

or maybe

my @F = map { [0, 0, 0] } 1 .. $N;

> and I make a loop
> 
> for $i (0 .. $N-1){
>     for $j (0..2) {
> 
>         $value=result of a calculation;
>         $F[$i][$j] += $value;
> 
>     }
> }

For this particular loop, and the particular values you have, you don't
even need to initialise @F. All the references will spring to life when
first used.

> the problem is that $F[$i][$j] doesn't change (even if $value != 0 !!!)

I don't believe you.

> but if
> I put  $F[$i][$j] += 1.0;  then it works  (increments of 1 !!)

No. With your code, you should have seen an array with three identical
array references, all pointing to the same array with three times the
value 3.

> If I initialize @F with  a loop  then it works:    $F[$i][$j] +=
> $value;   is ok !!
> 
> Can anybody explain me  what is the problem !

Well, there were some few things wrong with your code, and you didn't
actually tell us what really happened. Next time, post REAL WORKING
code, that runs without warnings and errors under -w and strict.
Accompany it with output that proves your assertions.

BTW, do you know about the Data::Dumper module? Invaluable for debugging
structures like these.

> and if there is a better way to initialize a list.

It isn't a list. It's an array. See the Perl FAQ for the difference.
There are many ways to initialise an array. It depends on what you want
in it on how you do it.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Begin at the beginning and go on till
Commercial Dynamics Pty. Ltd.   | you come to the end; then stop.
NSW, Australia                  | 


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

Date: Thu, 27 Sep 2001 10:39:39 +0100
From: "NEWS" <na>
Subject: maths
Message-Id: <3bb2f3e2$0$236$ed9e5944@reading.news.pipex.net>

i have made a script when calculates a value from one standard input dived
by another standard input times by another standard input etc etc.

the scalar value im left is correct to aprrox 18 decimal places, how do i
correct this to just two decimal places ?

cheers




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

Date: 27 Sep 2001 09:13:49 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: MIME::Lite problem
Message-Id: <slrn9r5rec.kki.vek@pharmnl.ohout.pharmapartners.nl>

On 26 Sep 2001 13:05:10 -0400,
    bill <bill02115@hotmail.com> wrote:


>In <slrn9r3mt2.ecd.vek@pharmnl.ohout.pharmapartners.nl> vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse) writes:
>

>
>It prints:
>
>  Content-Transfer-Encoding: binary

Not sure this header should be here at all for multipart messages.
C-T-E: headers apply to each individual mime parts rather than
the message as a whole.  See below.

>  Content-Type: multipart/mixed; boundary="_----------=_1001523516135880"
>  MIME-Version: 1.0
>  X-Mailer: MIME::Lite 2.117  (F2.6; B2.12; Q2.03)
>  Date: Wed, 26 Sep 2001 16:58:36 UT
>  From: drfoo@some.domain.com
>  To: drbar@some.other.domain.com
>  Subject: Schedule
>  Reply-To: drquux@some.domain.com
>
>  This is a multi-part message in MIME format.
>
>  --_----------=_1001522175134000
>  Content-Disposition: inline
>  Content-Length: 326
>  Content-Transfer-Encoding: binary

That is the only thing that looks iffy.  Encoding should be 7bit here.
add the parameters "Encoding => '7bit' to the text part.  C-T-E: of
binary is hardly ever a good choice, as such messages might not
make it through mail systems.  As the text is US-ASCII text 7bit
encoding is the proper choice.


>  Content-Type: text/plain

Might want to add "; charset=US-ASCII" but that would be default anyway 
if omitted.

>
>  Dear Dr. Foo:
>
>
>I tried the following alternative code in my script:
>
>     my $msg = new MIME::Lite(From       => FROM,
>                          To         => $to,
>                          Subject    => SUBJECT,
>                          'Reply-To' => REPLY_TO,
>                          Type       => 'TEXT',
                           Encoding   => '7bit',
>                          Data       => "${address}\n\n${text}"
>                         );
>     $msg->attach(Type        => 'application/pdf',
>              Path        => PATH,
>              Filename    => PDF_FILE,
>              Disposition => 'attachment');
>
>but got pretty much the same results (the only difference is that the
>line "X-Mailer: MIME::Lite 2.117 (F2.6; B2.12; Q2.03)" as the ninth
>line instead as of the fourth).
>
>In contrast to the output of MIME::Lite, Eudora produces:
>
>  X-Sender: yourstruly@my.domain
>  Date: Wed, 26 Sep 2001 12:53:10 -0400
>  To: drbar@some.other.domain.com
>  From: drfoo@some.domain.com
>  Subject: Schedule
>  Content-Type: multipart/mixed;
>         boundary="=====================_79226521==_"
>
>  --=====================_79226521==_
>  Content-Type: text/plain; charset="us-ascii"; format=flowed
>
>  Dear Dr. Foo:
>
>



The sequence of headers should not be significant.  The
Content-Transfer-Encoding: header is ommitted, defaulting to 7bit.


Villy


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

Date: Thu, 27 Sep 2001 11:56:17 +0200
From: gus <gusmail@gmx.net>
Subject: MSSQL and BLOBs
Message-Id: <3BB2F7C1.67AEDB4@gmx.net>

Hi!

Does anybody get it working to extract/insert BLOBs from/into a MSSQL (7 or
2000) database with Perl?
What is the best way to do it? Are there any samples available?

I tried it with DBI and ODBC but there's the 1MB limit and I need to access
BLOBs with a size >1MB.

Any help greatly appreciated.

  Guido


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

Date: Thu, 27 Sep 2001 02:18:21 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: multipul http connections
Message-Id: <3BB2C4AD.2971FCF2@earthlink.net>

Edwin B wrote:
> 
> I want to fetch content from the web but as it's quite a bit and
> from different url's I am looking for a way to open multiple
> connections.
> 
> I have looked at the fork function but I am not sure if this is
> what I should use.
> 
> Can anybody help me a bit and give some pointers into
> the right direction?

There's two ways:  you can either fork, and have each child process
fetch one page, or you can try to have multiple connections within one
process, using select or IO::Select to do it with minimal blocking.

For writing your own, the multiple processes thing is easiest... you can
even do that from your unix shell:
for i in 0 1 2 3 4 5 6 7 8 9; do
   for j in 0 1 2 3 4 5 6 7 8 9; do
      lynx -dump http://foo/bar/baz$i$j.jpg > baz$i$j.jpg
    done &
done

This runs 10 loops in parallel, with each loop sequentially getting 10
images.  If you moved the & to the end of the lynx line, it would try to
get all 100 images in parallel, which would likely result in a slower
[or maybe just *apparently* slower] download, due to increased net
traffic, and decreased speed per download.

I believe that LWP::Parallel does the multiple connections within one
process, and I wrote [a few weeks ago] a solution for someone else's
problem for making many many connections and downloads in parallel.

That was <3B987051.7B5C2C58@earthlink.net>.  It's for a slightly
different problem [he had three steps, repeated 6000 times... make a
request, parse the results, make a second requested based on the
first... and do it all in parallel].  It's not readily adaptable to
something simpler, but you might want to at least look at it and try to
see what it's doing.

-- 
"I think not," said Descartes, and promptly disappeared.


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

Date: Thu, 27 Sep 2001 11:18:49 +0200
From: "olivier" <ochampag@nortelnetworks.com>
Subject: no database driver specified and DBI_DSN env var not set
Message-Id: <9ouqun$opc$1@bcarh8ab.ca.nortel.com>

Hi,

I encouter the following problem when lauching my script :

no database driver specified and DBI_DSN env var not set at
DbFunctionnalities.pl line 100


The main script require a another script to work as followed :

In the main script i have launched :
----------------------------------
 ..
 ..
# include common libraries
require "DbFunctionnalities.pl";
 ...

$dbh=ConnectDb($dbname,$server,$login,$passwd); ==>> Call the function
defined in the require script

In the require script :
--------------------
#!/usr/bin/env perl
use DBI;
 ..
 ..
sub ConnectDb() {

        # Parameters

        local($dbname)=$_[0];
        local($server)=$_[1];
        local($login)=$_[2];
        local($passwd)=$_[3];

        Debug("server -> ".$server);
        Debug("dbname -> ".$dbname);


$connectline="'dbi:mysql:".$dbname.":".$server."','".$login."','".$passw
d."'";
        my $dbh = DBI->connect($connectline) || ErrorExit("Database
connection n
ot made: $DBI::errstr");

        return $dbh;
}

 ..
1;





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

Date: Thu, 27 Sep 2001 10:25:07 +0200
From: "Esteban Cozzi" <egcotzzi@altanvistai.com>
Subject: oracle
Message-Id: <OaBs7.550$M38.3801146@news.jazztel.es>

How i can use oracle from perl?

thx





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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 1828
***************************************


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