[13367] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 777 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 13 12:07:35 1999

Date: Mon, 13 Sep 1999 09:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 13 Sep 1999     Volume: 9 Number: 777

Today's topics:
        ATTN: Who would like to write a perl IDE for linux <nathan@bigfreakinserver.com>
    Re: ATTN: Who would like to write a perl IDE for linux <tchrist@mox.perl.com>
    Re: ATTN: Who would like to write a perl IDE for linux (Kragen Sitaker)
    Re: ATTN: Who would like to write a perl IDE for linux <rra@stanford.edu>
    Re: baffle about flock() please help! (Kragen Sitaker)
        Can't get list to sort... <yandellb@wfu.edu>
    Re: Comparing against today's date? <glenn.kauffman@worldnet.att.net>
    Re: Comparing against today's date? (Larry Rosler)
    Re: converting a number into a binary? (Kragen Sitaker)
    Re: display graph through CGI <glenn.kauffman@worldnet.att.net>
    Re: File IO Question <glenn.kauffman@worldnet.att.net>
    Re: folder name question <glenn.kauffman@worldnet.att.net>
    Re: folder name question (Larry Rosler)
    Re: Is anyone capable of explaining this?? (Lack Mr G M)
        Is perl Safe? (Mike Smith)
    Re: Is perl Safe? <tchrist@mox.perl.com>
    Re: Question about split <jeffp@crusoe.net>
    Re: Question about split <srooij@wins.uva.nl>
    Re: Question about split (Kragen Sitaker)
    Re: Question: How to send large (3+ MB) emails via Net: eric_poulsen@my-deja.com
        reading from odbc <michaelw@palawnet.com>
    Re: regexp with variables containing unknown data <bbarnett@nospamhere.L8R.net>
    Re: regexp with variables containing unknown data <bbarnett@nospamhere.L8R.net>
    Re: UNCRAP project proposal <ken@bitsko.slc.ut.us>
        where is Perl for Win32 build 303? <craig@ariel.hq.group.com>
    Re: Zipping (Kragen Sitaker)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Mon, 13 Sep 1999 08:41:32 -0700
From: Nathan Downey <nathan@bigfreakinserver.com>
Subject: ATTN: Who would like to write a perl IDE for linux
Message-Id: <37DD1B2C.8A264C02@bigfreakinserver.com>

I am starting to embark on a great journey.  What, you may ask is that
journey?
I plan to develop a IDE for perl.

I work with windows alot(ughh), but one thing that Is cool about windows
is there excellent IDEs, intellisense, smart tool tips for functions...
etc....

Hmmm I was wondering wouldnt it nice to have something like that for
perl.

Initially I was thinking about using GTK, in linux.
and I dont know about a Win32, but well see (I hate MFC)
Anyway how many of you perl and/or C gurus out there would like to a
participate in such a product.

Just think of the purty menus (ahhhhhhhhh....)    :)

Drop me an email:
nathan@bigfreakinserver.com





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

Date: 13 Sep 1999 09:47:02 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: ATTN: Who would like to write a perl IDE for linux
Message-Id: <37dd1c76@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    nathan@bigfreakinserver.com writes:
:I plan to develop a IDE for perl.

From the FAQ:

    If you're on Unix, you already have an IDE -- Unix itself.  This
    powerful IDE derives from its interoperability, flexibility, and
    configurability.  If you really want to get a feel for Unix-qua-IDE,
    the best thing to do is to find some high-powered programmer whose
    native language is Unix.  Find someone who has been at this for
    many years, and just sit back and watch them at work.  They have
    created their own IDE, one that suits their own tastes and aptitudes.
    Quietly observe them edit files, move them around, compile them,
    debug them, test them, etc.  The entire development *is* integrated,
    like a top-of-the-line German sports car: functional, powerful,
    and elegant.  You will be absolutely astonished at the speed and
    ease exhibited by the native speaker of Unix in his home territory.
    The art and skill of a virtuoso can only be seen to be believed.
    That is the path to mastery -- all these cobbled little IDEs are
    expensive toys designed to sell a flashy demo using cheap tricks,
    and being optimized for immediate but shallow understanding rather
    than enduring use, are but a dim palimpsest of real tools.

    In short, you just have to learn the toolbox.  However, if you're not
    on Unix, then your vendor probably didn't bother to provide you with
    a proper toolbox on the so-called complete system that you forked
    out your hard-earned cash on.

In short, Unix types are seldom interested in a new "IDE".

--tom
-- 
"Memory is the cabinet of imagination, the treasury of reason, the registry of
 conscience, and the council chamber of thought."
				- St. Basil


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

Date: Mon, 13 Sep 1999 15:57:49 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: ATTN: Who would like to write a perl IDE for linux
Message-Id: <1a9D3.8041$N77.632086@typ11.nn.bcandid.com>

In article <37DD1B2C.8A264C02@bigfreakinserver.com>,
Nathan Downey  <nathan@bigfreakinserver.com> wrote:
>I am starting to embark on a great journey.  What, you may ask is that
>journey?
>I plan to develop a IDE for perl.

Some people use Emacs for their "IDE".

>I work with windows alot(ughh), but one thing that Is cool about windows
>is there excellent IDEs, intellisense, smart tool tips for functions...

Tooltips are nice.  What's "intellisense"?

>Initially I was thinking about using GTK, in linux.
>and I dont know about a Win32, but well see (I hate MFC)

If you build with wxWindows or Tk, you can have it cross-platform from
the get-go, without suffering from MFC.  Tk you could even use from
Perl.

>Anyway how many of you perl and/or C gurus out there would like to a
>participate in such a product.

Not I.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Thu Sep 09 1999
60 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: 13 Sep 1999 08:51:48 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: ATTN: Who would like to write a perl IDE for linux
Message-Id: <ylemg224iz.fsf@windlord.stanford.edu>

Nathan Downey <nathan@bigfreakinserver.com> writes:

> I am starting to embark on a great journey.  What, you may ask is that
> journey?  I plan to develop a IDE for perl.

> I work with windows alot(ughh), but one thing that Is cool about windows
> is there excellent IDEs, intellisense, smart tool tips for functions...
> etc....

Have you tried emacs for Windows NT and cperl-mode running under it?  Best
to be aware of what's already out there before starting on your own
project.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Mon, 13 Sep 1999 15:14:33 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: baffle about flock() please help!
Message-Id: <tx8D3.7896$N77.623552@typ11.nn.bcandid.com>

In article <37daabe6.29045007@news.inet.co.th>,
Ryan Ngi <ryanngi@hotmail.com> wrote:
>ooh ... successful cat test.xxx ......... i think
>it should access denied or something unsuccessful 'cuz it's lock....

In Unix, you don't need to lock a file to access it.  So cat doesn't.
So locking a file doesn't prevent anyone from accessing it; it only
prevents them from locking it.

I believe some recent (SVR4?) Unices have a 'mandatory locking' kludge:
setgid without group execute means you can't open the file without
locking it first, or some such.

Windows NT takes a very different approach.

Kragen
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Thu Sep 09 1999
60 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Mon, 13 Sep 1999 11:51:09 -0400
From: Brant Yandell <yandellb@wfu.edu>
Subject: Can't get list to sort...
Message-Id: <37DD1D6D.9183BB87@wfu.edu>

Here is my code....

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

#!/usr/local/bin/perl

use CGI qw (:standard);
use CGI::Carp qw(fatalsToBrowser);

$data="data/sladata.txt";

$file = "$data" ;
open(INFO, "<$file" ) ;
@lines = <INFO> ;
close(INFO) ;

print "Content-type: text/html\n\n";
print<<HTML;
   <BODY>
   <CENTER><FORM METHOD="post" ACTION="test2.cgi">
	<SELECT NAME="search_for">
        <Option value="">&nbsp;
HTML

foreach $data (@lines)
{
@record = split(/\n/, $data);

foreach $record (@record)
{

@field  = split(/\|/, $record);

print "<option value=\"$field[1]\">$field[1]\n";
}
}

print<<HTML;
      </select></CENTER></FORM>
HTML

print "</BODY>\n" ;
print "</HTML>\n" ;

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

The listbox is populating fine.  I need to get "$field[1]" sorted
alphabetically but have had no luck.  I have omitted my sort string here
for fear of your laughter... :-)  Can anyone give me a sort statement? 
I fear I may launch my laptop out the window.

Thank You....

Brant Yandell
Winston-Salem, NC


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

Date: Mon, 13 Sep 1999 10:52:01 -0400
From: "Glenn Kauffman" <glenn.kauffman@worldnet.att.net>
Subject: Re: Comparing against today's date?
Message-Id: <7rj4fv$to$1@bgtnsc03.worldnet.att.net>

This may help. Date modulues are large if that's all you're trying to do.
BTW: you should always use 4 digit years. (Y2K)


sub ConverttoYYYYMMDD
{
 my ($date_in) = @_;
 my @temp = split('/', $date_in);
 if (length($temp[0]) < 2) { $temp[0] = "0$temp[0]"; }
 if (length($temp[1]) < 2) { $temp[1] = "0$temp[1]"; }
 return "$temp[3]$temp[1]$temp[2]";
}

sub main
{
 my $date1 = "09/09/1999";
 my $date2 = "09/10/1999";
 if (ConverttoYYYYMMDD($date1) gt ConverttoYYYYMMDD($date2))
 {
  print "Greater Than";
 }
}

Glenn Kauffman
Linux GNUBEE <dchurch@kabana.net> wrote in message
news:7r8pgl$an0$1@macaw.cyberport.com...
I would like to compare a stored date string ('09/09/99' for example) with
the current date.

Do I have to do a split on the stored date to get the individual day, month,
and year values out in order to compare to the values given by
localtime(time)?

If so, do I also need to convert '09' (September) to simply '9' so that the
comparison with the month value generated by localtime(time) will work
correctly?

Thanks!

dan :)

dchurch@kabana.net




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

Date: Mon, 13 Sep 1999 08:51:26 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Comparing against today's date?
Message-Id: <MPG.1246bd52109fd6c1989f46@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <7rj4fv$to$1@bgtnsc03.worldnet.att.net> on Mon, 13 Sep 1999 
10:52:01 -0400, Glenn Kauffman <glenn.kauffman@worldnet.att.net> says...
 ...
> sub ConverttoYYYYMMDD
> {
>  my ($date_in) = @_;
>  my @temp = split('/', $date_in);
>  if (length($temp[0]) < 2) { $temp[0] = "0$temp[0]"; }
>  if (length($temp[1]) < 2) { $temp[1] = "0$temp[1]"; }
>  return "$temp[3]$temp[1]$temp[2]";
> }

That last line should be "$temp[2]$temp[0]$temp[1]".

But why not replace the last three lines by simply this:

    sprint '%d%.2d%.2d' => @temp[2, 0, 1]

> sub main
> {
>  my $date1 = "09/09/1999";
>  my $date2 = "09/10/1999";
>  if (ConverttoYYYYMMDD($date1) gt ConverttoYYYYMMDD($date2))
>  {
>   print "Greater Than";
>  }
> }

Above quoted so we can see (guess) that the input order is M/D/Y.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Mon, 13 Sep 1999 15:05:50 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: converting a number into a binary?
Message-Id: <ip8D3.7867$N77.625941@typ11.nn.bcandid.com>

In article <37da061e.303592784@news.nikoma.de>,
Philip 'Yes, that's my address' Newton <nospam.newton@gmx.net> wrote:
>On Thu, 09 Sep 1999 00:52:25 GMT, kragen@dnaco.net (Kragen Sitaker)
>wrote:
>
>>I'm using POSIX::floor because perldoc -f int said not to use int for
>>rounding.  (What the hell else do you use int for?)
>
>POSIX::floor doesn't round -- it floors. For example, floor(2.9) == 2,
>floor(-2.9) == -3. If you want to round, you can use floor($num +
>0.5), although this means that .5 will always round down.

Right.  This behavior was what I wanted -- although the difference
between flooring and truncation disappears when your domain is
restricted to be positive, as mine was.

What puzzled me was this: what else is int good for?

>perlfaq4 says that "For rounding to a certain number of digits,
>sprintf() or printf() is usually the easiest route.".

Makes sense :)

Kragen
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Thu Sep 09 1999
60 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Mon, 13 Sep 1999 11:07:50 -0400
From: "Glenn Kauffman" <glenn.kauffman@worldnet.att.net>
Subject: Re: display graph through CGI
Message-Id: <7rj4g0$to$2@bgtnsc03.worldnet.att.net>

Yes, you can do this, as I have. You will have to use the GD module to draw
your image from the data.

Glenn Kauffman

<harris_m@my-deja.com> wrote in message news:7rc2v5$4au$1@nnrp1.deja.com...
I have Excel spreadsheet which creates graph. I could use Perl OLE
interface and maniputate excel spreadsheet.

Is there any way my CGI script can display the graph from Excel on Web
browser? One way would be to save Excel graph in bit map format (how?)
and send out HTML code which will refer to the bitmap created.

Anyone has done something like this or some pointers how to do this?
Thank you.
Harris


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




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

Date: Mon, 13 Sep 1999 11:14:07 -0400
From: "Glenn Kauffman" <glenn.kauffman@worldnet.att.net>
Subject: Re: File IO Question
Message-Id: <7rj4g1$to$3@bgtnsc03.worldnet.att.net>

I had the same problem. So, I started to use

 foreach $cnt ($start,$end)

and the problem went away.

GlennKauffman

John J. Straumann <jstraumann@worldnet.att.net> wrote in message
news:37DA6F3A.4E4CA917@worldnet.att.net...
Hey All:

I have a simple program that outputs some data to a file.

When I tried this:

if ( open( outFile, ">>$dataFile" ) )
{
  for ( $r=0; $r<25; $r++ )
  {
    print outFile ( "$input[ $r ]" );
  }
  close( outFile );
}

it doesn't work, only prints the first data element and then nothing...

 ...but this does...
if ( open( outFile, ">>$dataFile" ) )
{
  print outFile ( "$input[ 0 ]" );
  print outFile ( "$input[ 1 ]" );
  print outFile ( "$input[ 2 ]" );
  print outFile ( "$input[ 3 ]" );
  print outFile ( "$input[ 4 ]" );
  print outFile ( "$input[ 5 ]" );
  print outFile ( "$input[ 6 ]" );
  .
  .
  .
  print outFile ( "$input[ 24 ]" );
  close( outFile );
}


Any idea what I am missing here?

TIA.
John.




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

Date: Mon, 13 Sep 1999 11:19:14 -0400
From: "Glenn Kauffman" <glenn.kauffman@worldnet.att.net>
Subject: Re: folder name question
Message-Id: <7rj4g2$to$4@bgtnsc03.worldnet.att.net>

my $docRoot = $ENV{'DOCUMENT_ROOT'};


Jake <kptoth@microdsi.net> wrote in message
news:rtj2pc3n1iv71@corp.supernews.com...
> Hi,
>
> Does anybody know how a perl script can identify the current folder that
it
> is residing in? For example, can the script process.cgi identify that it
is
> currently residing in a folder named Alabama?
>
> Thanks in advance. -- JR
>
>




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

Date: Mon, 13 Sep 1999 08:56:00 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: folder name question
Message-Id: <MPG.1246be623f4a509f989f47@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.  Reordered so answer follows question, 
as in normal human discourse.]

In article <7rj4g2$to$4@bgtnsc03.worldnet.att.net> on Mon, 13 Sep 1999 
11:19:14 -0400, Glenn Kauffman <glenn.kauffman@worldnet.att.net> says...
> Jake <kptoth@microdsi.net> wrote in message
> news:rtj2pc3n1iv71@corp.supernews.com...
 ...
> > Does anybody know how a perl script can identify the current folder that
> it
> > is residing in? For example, can the script process.cgi identify that it
> is
> > currently residing in a folder named Alabama?

> my $docRoot = $ENV{'DOCUMENT_ROOT'};

Simply wrong.  That tells where the web root is located, which has 
nothing to do with where the CGI program is located.

Several other responses have pointed out that this is a difficult 
question, which may not have a completely portable solution.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Mon, 13 Sep 1999 16:18:26 BST
From: gml4410@ggr.co.uk (Lack Mr G M)
Subject: Re: Is anyone capable of explaining this??
Message-Id: <1999Sep13.161826@ukwit01>

In article <7rj0dr$l70$1@nnrp1.deja.com>, ladlad@my-deja.com writes:
|
|> I have a file. I need to read it (to find a regular expression) and
|> after few calculations write back to the file.
|>...
|> open(search,"+<searchEC.htm");  #open searchEc.htm file both for
|> 				#reading and writting
|> while (<search>)
|> {
|> $_= '123'; 			#modify
|> print search $_;	 # and print back to the searchEC.htm

    Have you checked that this print succeeds?

    print search $_ or print STDERR "print failed: $!\n";

    However, it seems unlikely that this is what you wish to do anyway.
You have just read a line - you can't expect a print to modify that line
(well, you can expect it, but it won't happen).

|> Where do I make a mistake or is it a bug?. Thank you very much for help.

   Your mistake is in assuming that $_ has some file-based meaning, and
that writing back a modified version will affect what you read to get
the value.

   Or that writing back in the middle of a file which yiu are reading
with buffered reads will do what you want.

   Or that print will add a newline for you....


   If you wish to change the contents of a text file then you will have
to write put a new one from scratch, with the required modifications,
and then move this new version into place.

   If the change you wish to make is reasonably short to code you can do
this with a single command line:

 perl -pi -e '$_ = "123\n" if (/matched/)" file1 [file2....filen]
   

-- 
--------- Gordon Lack --------------- gml4410@ggr.co.uk  ------------
This message *may* reflect my personal opinion.  It is *not* intended
to reflect those of my employer, or anyone else.


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

Date: Mon, 13 Sep 1999 14:31:53 GMT
From: mike.smith@nats.co.uk (Mike Smith)
Subject: Is perl Safe?
Message-Id: <37dd0a28.26977237@news.virgin.net>

Hi all,

We use Perl as a tools to help us wade through all of our data on our
project.  My System Integrity team are asking how do I know that perl
is safe, has it been trough code inspection, unit test, coverage test
etc.
Can anyone help?  What is the update process for perl.

Thanks,  Mike.


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

Date: 13 Sep 1999 09:45:32 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Is perl Safe?
Message-Id: <37dd1c1c@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    mike.smith@nats.co.uk writes:
:We use Perl as a tools to help us wade through all of our data on our
:project.  My System Integrity team are asking how do I know that perl
:is safe, has it been trough code inspection, unit test, coverage test

1) Define "safe".
2) See the test suites in the distribution.

--tom
-- 
 I enjoy working with human beings, and have stimulating relationships with
 them.   --HAL 9000


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

Date: Mon, 13 Sep 1999 11:13:26 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Question about split
Message-Id: <Pine.GSO.4.10.9909131104570.19013-100000@crusoe.crusoe.net>

[posted & mailed]

Virginia Tech.  My sister and brother-in-law's alma mater.

On Sep 13, Matthew Miller blah blah blah:

> I'm working on a program and I'm having some problems with the split function.
> What happens is split returns a list that contains an undefined element at
> position 0. The offending code is below.
> 
> $expression = "f(a,b,c)";
> @variables = split /[\(\),]/, substr( $expressions, 1);
> 
> I strip off the first charactor from the string and split around () and ,. The
> contents of @variables is now ('', a, b, c). What causes this? This was a hard
> bug to track down. While I could write some code to remove the '' from the 
> list, I would rather know why the first element is undefined. Do I need to
> change my regexp? If so, what would provide the match I want i.e (a, b, c)?

From perldoc -f split:

  Splits a string into an array of strings, and returns it.  By default,
  empty leading fields are preserved, and empty trailing ones are deleted.

Before the "(", there is an empty field.
After the ")", there is an empty field, but it gets removed.

It's not a bug.  Find some way around it.  Personally, I'd do:

  $string = "f(a,b,c)";
  @args = split /,/, substr($string, 2, length($string) - 3);

That's how I'd approach it.

-- 
jeff pinyan    japhy@pobox.com
perl stuff     japhy+perl@pobox.com
CPAN ID: PINYAN            http://www.perl.com/CPAN/authors/id/P/PI/PINYAN



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

Date: Mon, 13 Sep 1999 17:46:48 +0200
From: Steven de Rooij <srooij@wins.uva.nl>
Subject: Re: Question about split
Message-Id: <37DD1C68.5CCCA6D@wins.uva.nl>

Hi,

I've another solution to do what you want to do that may be safer than
the other proposed pieces of code. This is your program.

> $expression = "f(a,b,c)";
> @variables = split /[\(\),]/, substr( $expressions, 1);

I would instead say:

$expression="f(a,b,c)";
my ($funcname, $params) = $expression =~ /^(.*)\((.*)\)$/;
my @variables = split /,/, $params;

This method has a number of advantages:
 . It's more straightforward because you don't try to solve two problems
at once (separating the a,b,c bit and splitting it up).
 . It is quicker because the complicated regular expression has to find
only one match
 . You can have function names that are longer than just 'f'.
 . It gives you the name of the function in the expression for free

The regular expression looks pretty bad but you can reverse-engineer it
once you see that the two (.*) bits correspond to the pieces of
information we're trying to extract.


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

Date: Mon, 13 Sep 1999 15:54:00 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Question about split
Message-Id: <s69D3.8028$N77.631853@typ11.nn.bcandid.com>

In article <37DD1C68.5CCCA6D@wins.uva.nl>,
Steven de Rooij  <srooij@wins.uva.nl> wrote:
> [ a better solution ]
>This method has a number of advantages:
>. It's more straightforward because you don't try to solve two problems
>at once (separating the a,b,c bit and splitting it up).
>. It is quicker because the complicated regular expression has to find
>only one match
>. You can have function names that are longer than just 'f'.
>. It gives you the name of the function in the expression for free

I agree with all of these except for 'quicker'.  I'm always very
reluctant to make assertions about speed without testing first; in this
case, it turns out you were mistaken -- at least on my machine,
according to Benchmark.pm.

I ran this program:

use Benchmark;
timethese(100000, {
	broken => sub { 
		my $expression = "f(a,b,c)";
		my @variables = split /[\(\),]/, substr( $expression, 1);
	}, 
	steven => sub {
		my $expression="f(a,b,c)";
		my ($funcname, $params) = $expression =~ /^(.*)\((.*)\)$/;
		my @variables = split /,/, $params;
	}
	}
);

I got these results:

Benchmark: timing 100000 iterations of broken, steven...
    broken: 13 wallclock secs ( 9.41 usr +  0.00 sys =  9.41 CPU)
    steven: 16 wallclock secs (11.62 usr +  0.01 sys = 11.63 CPU)

My machine is
SunOS kirk 5.6 Generic_105181-13 sun4m sparc SUNW,SPARCstation-20

My Perl is
Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=solaris, osvers=2.6, archname=sun4-solaris
    uname='sunos shadow 5.6 generic sun4m sparc sunw,sparcstation-20 '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='gcc', optimize='-O', gccversion=2.8.1
    cppflags='-I/usr/local/include'
    ccflags ='-I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -lgdbm -ldl -lm -lc -lcrypt
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Built under solaris
  Compiled at May 17 1999 23:47:08
  @INC:
    /usr/local/lib/perl5/5.00503/sun4-solaris
    /usr/local/lib/perl5/5.00503
    /usr/local/lib/perl5/site_perl/5.005/sun4-solaris
    /usr/local/lib/perl5/site_perl/5.005
    .
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Thu Sep 09 1999
60 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Mon, 13 Sep 1999 15:51:38 GMT
From: eric_poulsen@my-deja.com
Subject: Re: Question: How to send large (3+ MB) emails via Net::SMTP or other module
Message-Id: <7rj6i5$q6i$1@nnrp1.deja.com>

In article <37DA919E.EBA796EF@ingress.com>,
  ehpoole@ingress.com wrote:
> eric_poulsen@my-deja.com wrote:
> >
> > I have a remote machine reporting system that emails zipped files to
> > clients & myself.  It works very well for smallish files (<1MB), but
> > usually cannot send larger files.
> >
> > The Net::SMTP module doesn't allow passing of a filehandle or
filename
> > (that I'm aware of, and this is confirmed from viewing the source),
but
> > instead requires a variable or reference.  Passing a filehandle
> > reference does not work.
> >
> > Has anyone out there had any success at sending large SMTP messages
via
> > (pure) perl?
> >
> > I'm running 5.004 on NT boxes, so no access to those cool *NIX
utilities
> > like sendmail =P
>
> If it is working for files smaller than 1MB but failing for larger
files,
> it sounds much more like a configuration issue with the SMTP servers.
The
> SMTP server could very well be configured not to accept postings
greater
> than 1MB.  Further, assuming your SMTP server does accept unlimited
> message sizes is no guarantee that the remote (recipient's) SMTP
server
> will do the same. Nowadays, many ISPs place restrictions on the size
of
> incomming messages as well as limit their users to much smaller
storage
> limits (which can also result in rejected emails) to prevent pack-rats
and
> the "I can't be bothered to ever read my email" individuals from
consuming
> large amounts of storage.
>
> Otherwise, there is no particular reason why you should not be able to
> send larger files through an open socket to an SMTP server so long as
the
> files have been properly encoded and the socket handle set to binary
with
> binmode() to prevent closing if an EOF character occurs within the
data
> stream.


To address your points:  I've used the same SMTP server to send emails
as large as 10MB.

This is one of those problems that sort of solved itself when I read the
Net::SMTP documentation more closely.  Rather than doing this:

$smtp->data($data);
$smtp->quit();

command, I should have been doing:

$smtp->data();
while (<DATAFILE>)
{
 $smtp->datasend($_);
}
$smtp->dataend();
$smtp->quit();

Of course, the above is simplified w/no error checking.  DATAFILE is my
pre-formatted (MIME-ized) data file created using MIME::Lite.

In any case, I've solved the problem, but I do appreciate your help &
speculation.

-- Eric


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


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

Date: Mon, 13 Sep 1999 15:39:09 GMT
From: gregarine <michaelw@palawnet.com>
Subject: reading from odbc
Message-Id: <7rj5qs$pdt$1@nnrp1.deja.com>

I would like to open an odbc source and read all the fieldnames and
values for a single record into a hash.  I want to do this WITHOUT
having to specify the fieldnames i am reading like this:

($id, $pwd, $first, $last) = $db->Data('id', 'pwd', 'first', 'last');

Unfortunately that is the only way i know how to get values out of an
ODBC source at the moment.  I see that there is something called 'tied
variables'.  Maybe this is the way to go, but I am unsure how to
implement it.

Here is how I am setting it up...

$db = new Win32::ODBC("$mdb") || die "Can't open 'user' ODBC source";
	$sql = "select * from freeoffer where secnum = $valnum";
	$err = $db->Sql($sql);
	if ($err){
		print qq(SQL error: ), $db->Error(), qq(\n);
		print "<BR>validation info not found.  Please contact
$techsupport<BR>";
		exit;
	}else{
		$db->FetchRow();
		####NEED HELP HERE####
	}

Any assistance is greatly appreciated!

-Mike


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


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

Date: Mon, 13 Sep 1999 15:32:17 GMT
From: Brad Barnett <bbarnett@nospamhere.L8R.net>
Subject: Re: regexp with variables containing unknown data
Message-Id: <37DD18F9.FD7CE2D1@nospamhere.L8R.net>

Benjamin Franz wrote:
> 
> In article <eZUC3.346$814.20853@typhoon01.swbell.net>,
> Benjamin Franz <snowhare@long-lake.nihongo.org> wrote:
> >In article <37DC17F4.335158B0@nospamhere.L8R.net>,
> >Brad Barnett  <bbarnett@nospamhere.L8R.net> wrote:
> >>
> >>This works well, in as much as I don't get perl barfing at me if
> >>variables end up having any of the above in them, and on top of that it
> >>keeps everything as a unique object.. even though "-" is now
> >>"minussign".  Anyhow, any idea on how to match objects with
> >>metacharacters (or whatever they are called ;) in them?  Without the
> >>pain of the stripn function??
> >
> >perlddoc -f quotemeta
> 
> Correction: perldoc -f quotemeta
> (No 'double d')
> 
> --
> Benjamin Franz
Many thanks, oh god of perl ;)  Heh, even more thanks for perldoc, which
I never even knew existed ;)


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

Date: Mon, 13 Sep 1999 15:58:35 GMT
From: Brad Barnett <bbarnett@nospamhere.L8R.net>
Subject: Re: regexp with variables containing unknown data
Message-Id: <37DD1F23.4978828B@nospamhere.L8R.net>

Benjamin Franz wrote:
> 
> In article <eZUC3.346$814.20853@typhoon01.swbell.net>,
> Benjamin Franz <snowhare@long-lake.nihongo.org> wrote:
> >In article <37DC17F4.335158B0@nospamhere.L8R.net>,
> >Brad Barnett  <bbarnett@nospamhere.L8R.net> wrote:
> >>
> >>This works well, in as much as I don't get perl barfing at me if
> >>variables end up having any of the above in them, and on top of that it
> >>keeps everything as a unique object.. even though "-" is now
> >>"minussign".  Anyhow, any idea on how to match objects with
> >>metacharacters (or whatever they are called ;) in them?  Without the
> >>pain of the stripn function??
> >
> >perlddoc -f quotemeta
> 
> Correction: perldoc -f quotemeta
> (No 'double d')
> 
> --
> Benjamin Franz
Hmm, well, quotemeta seems to rule, except for some reason, it doesn't
;)  I don't know why this is happening, but let me give an example :

$a = "it.some.we[";
$b = "it.some.we[";

$c = quotemeta $a;
$d = quotemeta $b;

Now, at this point 

$c == "it\.some.\we\[" and $d == "it\.some.\we\["

But :

if ($c =~ /$d/) {something();}

Doesn't happen.... er, why??!

Before, if I used that stripn function I wrote :

$c = stripn($a);
$d = stripn($b);

$c == "itperiodsomeperiodweleftbracket" and the same for $d

and

if ($c =~ /$d/) {something();}

Worked perfectly.. help! ;)  I don't understand why.. for the love of
god, WHY!!!


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

Date: Mon, 13 Sep 1999 15:29:55 GMT
From: Ken MacLeod <ken@bitsko.slc.ut.us>
Subject: Re: UNCRAP project proposal
Message-Id: <m31zc2suep.fsf@biff.bitsko.slc.ut.us>

pudge@pobox.com (Chris Nandor) writes:

> In article <m33dwkrqd9.fsf@biff.bitsko.slc.ut.us>, Ken MacLeod
> <ken@bitsko.slc.ut.us> wrote:
> 
> # "Alan J. Flavell" <flavell@mail.cern.ch> writes:
> # 
> # > but still the original assertion remains
> # > untouched.
> # 
> # My apologies, Alan.
> # 
> # Maybe you'd like to take a crack at explaining why requiring closing
> # tags in a version of HTML suddenly makes that version no longer HTML
> # when the HTML specifications and existing parsers both allow them and
> # assume that they are there if they are missing?
> 
> If this "version" of HTML were codified and approved by W3C, then it would
> be HTML.  If it isn't, then ... it isn't HTML.  Only HTML is HTML.  If
> something requires or allows something that HTML does not, then it is not
> HTML.  This isn't hard.  :)
> 
> No one said adding the closing tag makes it not HTML.  Requiring it makes
> it not HTML (for now, anyway).

XHTML became a W3C Proposed Recommendation on 24 August 1999.

  <http://www.w3.org/TR/xhtml1/>

-- 
  Ken MacLeod
  ken@bitsko.slc.ut.us


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

Date: Mon, 13 Sep 1999 11:50:18 -0400
From: "Craig Barkhouse" <craig@ariel.hq.group.com>
Subject: where is Perl for Win32 build 303?
Message-Id: <rtq7675d1iv71@corp.supernews.com>

Could anyone tell me where I could download build 303 of Perl for Win32?  I
realize that this is quite an old version, but I need it specifically.  I
looked around ActiveState's page and a few other pages but I could only find
the latest stuff (builds 500+).  Thanks in advance!





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

Date: Mon, 13 Sep 1999 15:26:03 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Zipping
Message-Id: <fI8D3.7938$N77.628628@typ11.nn.bcandid.com>

In article <7rdqj7$spj$1@gxsn.com>, Martin <martin123@mail.com> wrote:
>I'm looking for a way of starting to output
>the ZIP file and then add to that the jpegs as they become available
>without altering what has already been outputted.

You may discover that this is not useful.  You can't begin to
uncompress a zip file until you receive the end of the zipfile (and
*know* it is the end) because that's where the zipfile directory is.

But it's not a Perl question.

Kragen
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Thu Sep 09 1999
60 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. Due to their sizes, neither the Meta-FAQ nor
the FAQ are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq" from
almanac@ruby.oce.orst.edu. 

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


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