[17358] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4780 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 1 00:05:37 2000

Date: Tue, 31 Oct 2000 21:05:14 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <973055114-v9-i4780@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 31 Oct 2000     Volume: 9 Number: 4780

Today's topics:
    Re: "chown" of symlink instead of linked file (Tom Christiansen)
    Re: "chown" of symlink instead of linked file (Martien Verbruggen)
    Re: "chown" of symlink instead of linked file (Gwyn Judd)
    Re: "chown" of symlink instead of linked file <revjack@radix.net>
    Re: CGI.pm and dbm files <bwalton@rochester.rr.com>
    Re: cutting / parsing URLS out of a live HTML document <crud_alex@yahoo.com>
    Re: cutting / parsing URLS out of a live HTML document (Gwyn Judd)
        do you know why this doesn't work? jt_2000_ky@my-deja.com
    Re: do you know why this doesn't work? <elephant@squirrelgroup.com>
    Re: do you know why this doesn't work? <rick.delaney@home.com>
    Re: error using DBI, Dynaloader <pdmos23@geocities.com>
        Excel access <mvs@alumni.cwru.edu>
        GD.pm <admin@dybn.com>
    Re: GD.pm (Martien Verbruggen)
    Re: global variables and use strict (Anno Siegel)
    Re: global variables and use strict (Tom Christiansen)
        How do I get the html source code from a page on anothe <pnaimoli@rochester.rr.com>
    Re: How do I get the html source code from a page on an <not.my.real.email@bellglobal.com>
    Re: How do I get the html source code from a page on an <rick.delaney@home.com>
        INTERACTIVE DEBUGGER !!?? (Christopher James)
    Re: INTERACTIVE DEBUGGER !!?? (Tom Christiansen)
        limit to number of sockets/filedesc on Win2K? <cak@putzl.com>
        Net::SMTP and attachments <ruedas@geophysik.uni-frankfurt.de>
    Re: Net::SMTP and attachments <not.my.real.email@bellglobal.com>
    Re: Net::SMTP and attachments <rick.delaney@home.com>
    Re: Newbie question about hashes <ren.maddox@tivoli.com>
    Re: ODBC - Newbie having problems <bwalton@rochester.rr.com>
    Re: Operators for Tied hashes on NBDM_File and GDBM_Fil <bwalton@rochester.rr.com>
    Re: Pfff (Martien Verbruggen)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 31 Oct 2000 16:41:41 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: "chown" of symlink instead of linked file
Message-Id: <39ff58b5$1@cs.colorado.edu>

In article <slrn8vuhof.ksa.mgjv@verbruggen.comdyn.com.au>,
Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
>require 'syscall.ph';
>my $rc = syscall(&SYS_lchown, $file, $uid, $gid);

I *was* going to say that, but then I just *knew* they'd just whinge
about how syscall.ph Isn't Standard, so of course, this just Isn't Done.  
Or that there existed platforms where syscall() didn't work right.

Blech.

Hence, shelling out to chown(8).

--tom


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

Date: Wed, 01 Nov 2000 01:32:10 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: "chown" of symlink instead of linked file
Message-Id: <slrn8vuskp.ksa.mgjv@verbruggen.comdyn.com.au>

On Tue, 31 Oct 2000 19:51:29 GMT,
	Uri Guttman <uri@sysarch.com> wrote:
> >>>>> "TC" == Tom Christiansen <tchrist@perl.com> writes:
> 
> 
>   TC> Then the answer is system("chown -h").
> 
>   TC>      -h Change the user ID and/or the group ID on symbolic
>   TC>      links. The -R
> 
> hmm, gnu chown doesn't support that. solaris does have it but its sunos
> compatible chown does not.

I just checked this, because I seemed to recall GNU chown does support
-h. The manual page on GNU/Linux does mention this option, and it
actually also works. 

Are you maybe using an old version?

And yes, I realise that it's not portable, but neither are symlinks.
If worst comes to worst, and you really do need to change the symlinks
permissions, you can eval the code that I submitted earlier, on
failure try a system('chown', '-h'), and then give up.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd.   | again. Then quit; there's no use
NSW, Australia                  | being a damn fool about it.


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

Date: Wed, 01 Nov 2000 02:06:51 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: "chown" of symlink instead of linked file
Message-Id: <slrn8vuulp.ubb.tjla@thislove.dyndns.org>

I was shocked! How could Tom Christiansen <tchrist@perl.com>
say such a terrible thing:
>I *was* going to say that, but then I just *knew* they'd just whinge
>about how syscall.ph Isn't Standard, so of course, this just Isn't Done.  
>Or that there existed platforms where syscall() didn't work right.

Who cares, really? Portability is admirable and all but sometimes it
makes things too difficult.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Ehrman's Commentary:
	1.  Things will get worse before they get better.
	2.  Who said things would get better?


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

Date: 1 Nov 2000 02:09:12 GMT
From: revjack <revjack@radix.net>
Subject: Re: "chown" of symlink instead of linked file
Message-Id: <8tnu08$gir$4@news1.Radix.Net>
Keywords: Hexapodia as the key insight

Gwyn Judd explains it all:
:I was shocked! How could Tom Christiansen <tchrist@perl.com>
:say such a terrible thing:
:>I *was* going to say that, but then I just *knew* they'd just whinge
:>about how syscall.ph Isn't Standard, so of course, this just Isn't Done.  
:>Or that there existed platforms where syscall() didn't work right.

:Who cares, really? Portability is admirable and all but sometimes it
:makes things too difficult.

You sound like my ex-wife.

-- 
revjack@radix.net
stochasticgnosisthroughablativedissonance


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

Date: Wed, 01 Nov 2000 04:33:27 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: CGI.pm and dbm files
Message-Id: <39FF9CFB.DCFDCA80@rochester.rr.com>

Roderick Clay wrote:
> 
> Hello.  I'm a fairly new perl programmer and completely new to this
> newsgroup, so please forgive my ignorance if it shows (which it
> probably will!)
> 
> We recently plugged the CGI.pm module into one of our CGI scripts, in
> order to use the 'param' method to get the parameters passed into our
> script.  A couple of days ago we noticed that we have a problem of
> some kind with a dbm file that we have used in this script for years -
> we appear to be either not getting or setting the right values in the
> dbm file now.  In fact, there appear to be duplicate keys in the dbm
> file now, which we thought was impossible!
> 
> Is there any possible connection that anyone is aware of between use
> of the CGI.pm module and use of dbm files?  Or is my problem
> elsewhere, in a place I haven't even thought to look yet?!?
> 
> Thanks in advance for any help that anyone can offer this relative
> newbie.
> 
> Rod Clay
> rclay@regents.state.oh.us
Did you do appropriate locking in your CGI program?  Remember that more
than one CGI process can run at the same time, and that DBM-type file
implementations are generally not proofed against that.  If you don't
know what I'm talking about, see:

    perldoc -q lock

and recipe 14.5 of Perl Cookbook.  Actually, I think it is better (and
certainly simpler!) to use a dedicated lock file to handle the locks. 
That approach has generated DBM-type tied hash files that have survived
many years of hits with zero problems.  Check the docs for recent
releases of DB_File for info on problems with the method described in
Perl Cookbook.  Note that file locking is a tricky subject, and also
that it is imperative to get it right if you want your database to
survive long-term.
-- 
Bob Walton


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

Date: Wed, 1 Nov 2000 09:10:52 +0800
From: "­»´ä¸}" <crud_alex@yahoo.com>
Subject: Re: cutting / parsing URLS out of a live HTML document
Message-Id: <8tnqli$d7a$1@imsp026.netvigator.com>


Maarten <maartenh@usa.net> wrote in message
news:8tn5l1$35g$1@azure.nl.gxn.net...
: Hello all,
:
: I am trying to accomplish cutting html code out of a live Internet page
and
: pasting it into a new one, but it just won't work. I already know how to
use
: perl to get all of the html of a document on my screen:
: -------
: use LWP::Simple;
: $stuff= get('http://www.hartsuijker.com/2000egypt_ses_index.html');
: print "$stuff";
: -------
:
: and I also know how to get URL's or other text out of a HTML document on
my
: test machine:
: -------
: $stuff= "/home/maarten/2000egypt_ses_index.html";
: print "$stuff";
: open STUFF, $stuff;
: while (<STUFF>) {
sorry people,i'm a newbie and i have a silly question
: print "$1 \n" if /"(http.*)">/i;
     what do this sign does">",i've been searching throughout my regex
reference and i got no hint
: }: -------
:
: So if I want to get the URL's right out of a live document, the following
: would seem logical to me:
: -------
: use LWP::Simple;
: $stuff= get('http://www.hartsuijker.com/2000egypt_ses_index.html');
: open STUFF, $stuff;
: while (<STUFF>) {
: print "$1 \n" if /"(http.*)">/i;
: }
:
: But perl just can't follow my logics and I was hoping someone could help
me
: out with this problem. First getting or using the document from my local
: drive isn't an option for me, because I want to use the data from a server
: which isn't the same host as the one perl is on.
:
: thnx in advance, maarten
: ------------------
: maarten@hartsuijker.com
:
:




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

Date: Wed, 01 Nov 2000 03:19:19 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: cutting / parsing URLS out of a live HTML document
Message-Id: <slrn8vv2tl.ubb.tjla@thislove.dyndns.org>

I was shocked! How could ­»´ä¸} <crud_alex@yahoo.com>
say such a terrible thing:
>sorry people,i'm a newbie and i have a silly question

Didn't someone tell you there are no sily questions, only silly people?
:)

>: print "$1 \n" if /"(http.*)">/i;
>     what do this sign does">",i've been searching throughout my regex
>reference and i got no hint

It does nothing, or put more simply, it matches a literal '>'. I hope
that helps. By the way, you really should put more effort into deleting
the bits of the post that aren't relevant to what you are replying to.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Good communication is as stimulating as black coffee, and just as hard
to sleep after.
		-- Anne Morrow Lindbergh


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

Date: Wed, 01 Nov 2000 01:55:13 GMT
From: jt_2000_ky@my-deja.com
Subject: do you know why this doesn't work?
Message-Id: <8tnt5u$s59$1@nnrp1.deja.com>



I'm trying to write a simple script to check to make sure a box is up.
I thought the easy part would be to get the Ping module to work
correctly but the script below doesn't work. Any suggestions?

I'm running 5.6.0.618 ActiveState Perl on Windows NT.

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

#!usr/bin/perl

use Net::Ping;

$host="www.virginrecords.com";
$host2="microsoft.com";

print($host);
$p=Net::Ping->new()
  or die "Can't create new ping object: $!\n";
 print "$host2 is alive" if $p->ping($host2) or die "can't ping $host2";
 print "$host is alive" if $p->ping($host) or die "can't ping $host";
 $p->close;


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


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

Date: Wed, 1 Nov 2000 13:38:16 +1100
From: jason <elephant@squirrelgroup.com>
Subject: Re: do you know why this doesn't work?
Message-Id: <MPG.146a2d1fab5170da989875@localhost>

jt_2000_ky@my-deja.com wrote ..
>I'm trying to write a simple script to check to make sure a box is up.
>I thought the easy part would be to get the Ping module to work
>correctly but the script below doesn't work. Any suggestions?
>
>I'm running 5.6.0.618 ActiveState Perl on Windows NT.
>
>-----------------
>
>#!usr/bin/perl
>
>use Net::Ping;
>
>$host="www.virginrecords.com";
>$host2="microsoft.com";
>
>print($host);
>$p=Net::Ping->new()
>  or die "Can't create new ping object: $!\n";
> print "$host2 is alive" if $p->ping($host2) or die "can't ping $host2";
> print "$host is alive" if $p->ping($host) or die "can't ping $host";
> $p->close;

umm .. what makes you think that it's not working ? .. what results did 
you get trying to ping each of those hosts from the command line in NT ?

did the results you got from the command line differ from the results 
you got using Net::Ping ?

thus endeth the first lesson in testing functions that have command line 
equivalents

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Wed, 01 Nov 2000 02:51:59 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: do you know why this doesn't work?
Message-Id: <39FF8858.865F323A@home.com>


jt_2000_ky@my-deja.com wrote:
> 
> I'm trying to write a simple script to check to make sure a box is up.
> I thought the easy part would be to get the Ping module to work
> correctly but the script below doesn't work. Any suggestions?

My first suggestion would be defining "doesn't work".  Beyond that, I'd
suggest reading the docs for Net::Ping and trying a different protocol.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Wed, 01 Nov 2000 01:23:48 GMT
From: Pasquale <pdmos23@geocities.com>
Subject: Re: error using DBI, Dynaloader
Message-Id: <39FF7162.6990429A@geocities.com>

Charles DeRykus wrote:

> In article <39FA3604.14B88913@geocities.com>,
> Pasquale  <pdmos23@geocities.com> wrote:
> >I am getting the following error:
> >DynaLoader object version 1.03 does not match $DynaLoader::VERSION 1.04
> >at /dir/mydir/cgi-bin/DynaLoader.pm line 93.
> >BEGIN failed--compilation aborted at /dir/mydir/cgi-bin/DBI.pm line 149.
> >
> >BEGIN failed--compilation aborted at exit.pl line 5.
> >
> >I looked at all the lines mentioned above, mainly the DynaLoader
> >version, but I don't see what I can do.  Unless I manually change the
> >version from 1.04 to 1.03, but I don't think that would be right.  I
> >have included the lines of code from the list above.  I understand the
> >bottom two errors, hierarchy thing.  Why is it having a problem with
> >line 93 from the DynaLoader.pm??
> >I have all the most recent versions of modules, DBI.pm-1.14, CGI.pm-2.74
> >& DynaLoader-1.04.
> >
> >snippet from my exit.pl script:
> >#!/usr/bin/perl -wT
> >use strict;
> >use lib "/dir/mydir/cgi-bin";
> >use CGI::Carp qw(fatalsToBrowser);
> >use DBI;   ### Line 5
> >use CGI qw(:standard);
> >
>
> Remove your private copy of DynaLoader-1.04. Perl
> wants to use its own earlier version.
>
> hth,
> --
> Charles DeRykus

Thank you....
I removed my own version of DynaLoader.  I also removed my own version of DBI
because after I removed DynaLoader I was getting the same error only this
time it was referring to DBI.pm.  Now that both are removed the error I am
getting is:
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC
contains:
/dir/mydir/cgi-bin /usr/lib/perl5/i386-linux/5.004 /usr/lib/perl5
/usr/local/lib/site_perl/i386-linux /usr/local/lib/site_perl) at (eval 5)
line 2.
Perhaps the DBD::mysql perl module hasn't been fully installed, or perhaps
the capitalisation of 'mysql' isn't right.
Available drivers: ADO, ExampleP, Pg, Proxy.
 at exit.pl line 25
What does this mean?
The line I am using in my script to connect is:
my $dbh = DBI->connect("DBI:mysql:database=$database;host=$host", "", "") ||
die "Can't connect to database: $DBI::errstr\n";
Is there something wrong with this??
Your help would be much appreciated.
Pasquale






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

Date: Tue, 31 Oct 2000 15:27:57 -0600
From: "Michael V. Schaefer" <mvs@alumni.cwru.edu>
Subject: Excel access
Message-Id: <39FF395D.5585FB5E@alumni.cwru.edu>


Is there an API definition for accessing data from
Microsoft Excel files from w/in a perl script?  If
so what module(s) are required?

Thanks!

mvs


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

Date: Wed, 01 Nov 2000 00:25:58 GMT
From: "James G. Stewart" <admin@dybn.com>
Subject: GD.pm
Message-Id: <qqJL5.105570$j6.11292463@news1.rdc1.va.home.com>

I have been trying to use the GD module to render images from text, with no
success. Can anyone give an example of the proper syntax or an example that
should work?

Any help is appreciated,
James G. Stewart




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

Date: Wed, 01 Nov 2000 01:38:13 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: GD.pm
Message-Id: <slrn8vut04.ksa.mgjv@verbruggen.comdyn.com.au>

On Wed, 01 Nov 2000 00:25:58 GMT,
	James G. Stewart <admin@dybn.com> wrote:
> I have been trying to use the GD module to render images from text, with no
> success. Can anyone give an example of the proper syntax or an example that
> should work?

Maybe you want to have a look at the GDTextUtils package, available
from CPAN and ActiveState. Classes included are GD::Text,
GD::Text::Align (to draw aligned strings) and GD::Text::Wrap (to draw
wrapped text in a box).

If nothing else, you can have a look at the code to see how it's done.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd.   | make up 3/4 of the population.
NSW, Australia                  | 


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

Date: 31 Oct 2000 16:46:59 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: global variables and use strict
Message-Id: <8tmt23$hbc$1@lublin.zrz.tu-berlin.de>

Tad McClellan <tadmc@metronet.com> wrote in comp.lang.perl.misc:
>On 30 Oct 2000 15:31:44 -0700, Tom Christiansen <tchrist@perl.com> wrote:
>>In article <slrn8vrnqi.55h.tadmc@magna.metronet.com>,

>>>But there _is_ something that I can get with "use vars" that
>>>I cannot get with our():
>
>
>I now see that that is not true.
>
>I just need to type a little more. No problem.

Are you sure?  You'll not only have to type those declarations once,
in every file, but you'll have to maintain them.  Keeping declarations
in sync across many files has been a severe problem in some languages,
and ingenious inventions have been made.  All of C's include-file
culture and even the preprocessor itself are ultimately dedicated to
this one problem.
 
Perl has been reasonably free from it, and only maintaining export
lists sometimes reminds me of the bad old days.  

I don't believe that replacement of "use vars" by "our" will make
Perl a maintenance nightmare, but the matter shouldn't be treated
lightly.  Of course, this has probably all been hashed out on P5P.

Anno


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

Date: 31 Oct 2000 16:39:11 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: global variables and use strict
Message-Id: <39ff581f@cs.colorado.edu>

In article <8tmt23$hbc$1@lublin.zrz.tu-berlin.de>,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>Are you sure?  You'll not only have to type those declarations once,
>in every file, but you'll have to maintain them.  Keeping declarations
>in sync across many files has been a severe problem in some languages,
>and ingenious inventions have been made.  All of C's include-file
>culture and even the preprocessor itself are ultimately dedicated to
>this one problem.
>
>Perl has been reasonably free from it, and only maintaining export
>lists sometimes reminds me of the bad old days.  

This is way overblown--don't get scared.  *WHY* would you be 
doing this?  You should really be using the Exporter.  This is
how one shares variables between modules.  Or better yet, consider
a functional inferface instead (which includes an OO i/f).

>I don't believe that replacement of "use vars" by "our" will make
>Perl a maintenance nightmare, but the matter shouldn't be treated
>lightly.  Of course, this has probably all been hashed out on P5P.

use vars sucks because:

    1) Its syntax is not at all like that of my(), and thus
       does not appear to be a variable declaration.  

    2) People are always confused by 
	    use vars qw($foo $bar);
	compared with 
	    my($foo, $bar);
	and often mistakenly write one of
	    use vars qw($foo, $bar);
	    use vars ($foo, $bar);

    3) There's no way to combine use vars with initialization.
	    use vars qw($foo);
	    $foo = 1;
	vs
	    our $foo = 1;

    4) use vars is not scoped!  our() is scoped.  Localize visibility.

    5) use vars brooks no type declaration, but my() and our()
       both do.

--tom


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

Date: Wed, 01 Nov 2000 01:52:51 GMT
From: "Peter Naimoli" <pnaimoli@rochester.rr.com>
Subject: How do I get the html source code from a page on another server
Message-Id: <THKL5.115330$JS3.17855879@typhoon.nyroc.rr.com>

I am writing a script to analyze meta tags in html.  But i don't know how i
could make my perl script get the html source from a given page, usually on
a different server.
If anyone could show me how to do this, i would be very grateful.
                                Pete




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

Date: Wed, 01 Nov 2000 02:35:43 GMT
From: "MNJP" <not.my.real.email@bellglobal.com>
Subject: Re: How do I get the html source code from a page on another server
Message-Id: <3kLL5.405488$Gh.12755262@news20.bellglobal.com>


The fast and cheap way to do it is

$source = `lynx -source http://www.blah.com/dir/filename.ext`;

"Peter Naimoli" <pnaimoli@rochester.rr.com> wrote in message
news:THKL5.115330$JS3.17855879@typhoon.nyroc.rr.com...
> I am writing a script to analyze meta tags in html.  But i don't know how
i
> could make my perl script get the html source from a given page, usually
on
> a different server.
> If anyone could show me how to do this, i would be very grateful.
>                                 Pete
>
>




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

Date: Wed, 01 Nov 2000 03:01:49 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: How do I get the html source code from a page on another server
Message-Id: <39FF8AA6.ED463676@home.com>

[posted & mailed]

Peter Naimoli wrote:
> 
> I am writing a script to analyze meta tags in html.  But i don't know how i
> could make my perl script get the html source from a given page, usually on
> a different server.

a.  Save it with your browser software.
b.  Use LWP::Simple, a module available on CPAN:

   http://search.cpan.org/search?mode=module&query=LWP%3A%3ASimple

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Wed, 01 Nov 2000 00:11:56 GMT
From: chris@hitsquad.com (Christopher James)
Subject: INTERACTIVE DEBUGGER !!??
Message-Id: <39ff5a6c.1926823@news.one.net.au>

Hi all,
You guys know of any interactive visual debugger for perl ?
Wanna watch my variables and stuff...

Thanx in advance.




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

Date: 31 Oct 2000 17:28:49 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: INTERACTIVE DEBUGGER !!??
Message-Id: <39ff63c1$1@cs.colorado.edu>

In article <39ff5a6c.1926823@news.one.net.au>,
Christopher James <chris@hitsquad.com> wrote:
>You guys know of any interactive visual debugger for perl ?
>Wanna watch my variables and stuff...

First, see perldebug(1), or see the appropriate chapter in the
current Camel.    Certainly it can "watch your variables and stuff".

As for the visual part, I guess that means keeping your eyes open.  :-)

Here's a tip: go to google and type the words you're curious about.

---tom


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

Date: Tue, 31 Oct 2000 18:38:53 -0800
From: Chris Kantarjiev <cak@putzl.com>
Subject: limit to number of sockets/filedesc on Win2K?
Message-Id: <39FF823D.CF4506E@putzl.com>

I'm trying to create a lot (500 to 1000) connections from one perl
script, and am running into a limit - when I try to open the 254th
connection, I get the error "Bad file descriptor"  from
IO::Socket::INET->new(). This is on Win2K - is it a hard limit? A quicky
experiment with a C program lets me open 508 file descriptors...

Thanks.


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

Date: Wed, 01 Nov 2000 03:06:05 +0100
From: Thomas Ruedas <ruedas@geophysik.uni-frankfurt.de>
Subject: Net::SMTP and attachments
Message-Id: <39FF7A8D.F6A31AEE@geophysik.uni-frankfurt.de>

Hello again,
this time my problem might be more complicated: How do I attach a file
to a mail sent with Net::SMTP? I want to send a mail with a normal text
and possibly attach either a PostScript file or a MS Word document. Is
this possible? It doesn't seem to me that it would be a good idea to
simply read these files in as normal text files and just hand them over
to smtp->datasend().
-- 
Sign the Linux Driver petition:
http://www.libralinux.com/petition.english.html
------------------------------------------------------------------------
Thomas Ruedas
Institute of Meteorology and Geophysics, J.W.Goethe University Frankfurt
e-mail: ruedas@geophysik.uni-frankfurt.de
http://www.geophysik.uni-frankfurt.de/~ruedas/
------------------------------------------------------------------------


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

Date: Wed, 01 Nov 2000 02:33:22 GMT
From: "MNJP" <not.my.real.email@bellglobal.com>
Subject: Re: Net::SMTP and attachments
Message-Id: <ShLL5.405468$Gh.12753632@news20.bellglobal.com>

Funny you asked, I jsut answered this question 2 days ago in another perl
newsgroup. Here's a copy-paste of the message..

-




Here's a little script I wrote that takes the first argument as the filename
and the second argument as the email address to send it too. You can
extrapolate on that.

You will need MIME::Base64 installed for this to work, if you don't, then
run:
perl -MCPAN -e shell

and when you get the cpan> prompt, type:
install MIME::Base64

Good luck. Also I was lazy and made the boundary static, which is fairly
dangerous. You might want to truly randomize it every run.

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

#!/usr/bin/perl

use MIME::Base64;

$filename = shift || die "I need a filename send\n";
(-e $filename) || die "$filename does not exist\n";
$email = shift || die "I need an email address to email this file to...\n";


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

$justfile = $filename;
$justfile =~ s/^.*\///;
$hostname = `hostname`;
chomp $hostname;
$boundary = '----=_NextPart_000_000E_01C041BF.DBEEE780';

$encoded = encode_base64(&readfile($filename));

open (SENDMAIL, "|/usr/sbin/sendmail -ti");
print SENDMAIL <<"EOM";
From: $email
To: $email
Subject: File $justfile attached here
MIME-Version: 1.0
Content-Type: multipart/mixed;
    boundary="$boundary"
Status:

This is a multi-part message in MIME format.

--$boundary
Content-Type: text/plain;
    charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

Attached to this email is the file $filename on the machine $hostname.

--$boundary
Content-Type: application/octet-stream;
    name="$justfile"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
    filename="$justfile"

$encoded

--$boundary--
EOM
close SENDMAIL;

sub readfile() {
    my $filename = shift || return "";
    my $temp;
    my $result;
    $temp = $/;
    undef $/;
    open (FILE, $filename);
    $result = <FILE>;
    close FILE;
    $/ = $temp;
    return $result;
    }



"Thomas Ruedas" <ruedas@geophysik.uni-frankfurt.de> wrote in message
news:39FF7A8D.F6A31AEE@geophysik.uni-frankfurt.de...
> Hello again,
> this time my problem might be more complicated: How do I attach a file
> to a mail sent with Net::SMTP? I want to send a mail with a normal text
> and possibly attach either a PostScript file or a MS Word document. Is
> this possible? It doesn't seem to me that it would be a good idea to
> simply read these files in as normal text files and just hand them over
> to smtp->datasend().
> --
> Sign the Linux Driver petition:
> http://www.libralinux.com/petition.english.html
> ------------------------------------------------------------------------
> Thomas Ruedas
> Institute of Meteorology and Geophysics, J.W.Goethe University Frankfurt
> e-mail: ruedas@geophysik.uni-frankfurt.de
> http://www.geophysik.uni-frankfurt.de/~ruedas/
> ------------------------------------------------------------------------




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

Date: Wed, 01 Nov 2000 02:56:39 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Net::SMTP and attachments
Message-Id: <39FF8968.464EC043@home.com>

[posted & mailed]

Thomas Ruedas wrote:
> 
> Hello again,
> this time my problem might be more complicated: How do I attach a file
> to a mail sent with Net::SMTP?

Use MIME::Lite.  You can make it send mail with Net::SMTP.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: 31 Oct 2000 15:58:16 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Newbie question about hashes
Message-Id: <m3og00ad1j.fsf@dhcp11-177.support.tivoli.com>

Chris Kantarjiev <cak@putzl.com> writes:

> So what's the "right" way to declare/initialize these hashes? Just do it
> outside the subroutines? (One of these days I'm going to dig in and
> learn how to great such things as an object...)

While it is bad to quote the entire post to which you are responding,
it does help if you quote the relevant portion.  It's just easier to
keep track of the conversation that way.

I assume you are looking for:

$sessionKey{$s} = 0;

Though based on your next conditional, you might be better served by:

$sessionKey{$s} ||= $id;

-- 
Ren Maddox
ren@tivoli.com


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

Date: Wed, 01 Nov 2000 04:43:02 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: ODBC - Newbie having problems
Message-Id: <39FF9F3A.388556@rochester.rr.com>

P&C wrote:
 ...
> Now the problem, if I go to my URL and type in the test.pl which came
> with the ODBC package
> 
> ----------------------  T E S T   Error Report: ---------------------
>         Error Report:
> The following were errors:
> Test 3a = new(): [-1024] [] "[Microsoft][ODBC Microsoft Access Driver]
> Could not use '(unknown)'; file already in use."
> 
> Also, any attempts to call my &initialize($dsn); function just returns
> a blank html page.  I never get the die message nor any other messages
> and the database never gets updated.
> 
> What do I do next, where do I go from here?
> 
> Thanks,
> 
> Phil
> p c   a t   n t a d m i n   d o t   c o m
Sounds to me like you probably didn't define your system ODBC connection
on the computer that is running your web server.  That is where your CGI
script would be trying to get it.
-- 
Bob Walton


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

Date: Wed, 01 Nov 2000 04:53:45 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Operators for Tied hashes on NBDM_File and GDBM_File, plus DB_File  for AIX
Message-Id: <39FFA1BD.72A6700@rochester.rr.com>

sajjidm@my-deja.com wrote:
> 
> I normally use the DB_File package for database manipulation and this
> works fine for Berkley compatible Unixes.
> 
> However, I need to use a database on a non-Berkley compatible UNIX
> (AIX). Perl for AIX does not seem to contain DB_File support, so I need
> to use the GDBM_File or NDBM_File packages.
> 
> However, the "seq" method does not seem to be available in GDBM_File
> and NDBM_File pacakages, and the Perl Reference does not seem to contain
> any information on what methods, if any, are available or what I can use
> instead of "seq".
> 
> Does anyone know where I may find detailed information on GDBM_File and
> NDBM_File packages including all parameters valid on tie-ing hashes and
> the methods available and their parameters.
> 
> Also, does anyone know if there is a version of DB_File which will work
> on AIX?
 ...
> Sajjid
 ...
I think you'll find that DB_File is the only one that provides any
"extra" methods.  You should be able to do:

    perldoc NDBM_File

or

    perldoc GDBM_File

You could also look at the module source if the above isn't enough, and
you could look up the man pages on your system for ndbm and gdbm (which
underlie the Perl implementation).  I don't know anything about AIX, so
I can't help you with AIX-specific info.

You could also get the DB_File source from CPAN and compile it for your
system (it works on Windoze, so I'm sure it will work on any flavor of
Unix).
-- 
Bob Walton


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

Date: Wed, 01 Nov 2000 01:40:02 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Pfff
Message-Id: <slrn8vut3h.ksa.mgjv@verbruggen.comdyn.com.au>

On Tue, 31 Oct 2000 22:01:49 +0100,
	Oliver Söder <soeder@ai-lab.fh-furtwangen.de> wrote:
> Hey lazy boy read any manual, yor question is too stupid and simple.

Hey, lazy person, read the articles that are regularly posted to
news.announce.newusers. Your posting behaviour is, at least, odd.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | If it isn't broken, it doesn't have
Commercial Dynamics Pty. Ltd.   | enough features yet.
NSW, Australia                  | 


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

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 4780
**************************************


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