[24601] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6777 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 8 00:05:37 2004

Date: Wed, 7 Jul 2004 21:05:06 -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           Wed, 7 Jul 2004     Volume: 10 Number: 6777

Today's topics:
        Accumulated CACMs (since 1966) Considered Dangerous: yo (David Combs)
    Re: Digest::Base HELP! <ebohlman@omsdev.com>
    Re: how run cgi on my Perl Windows offline? <invalid-email@rochester.rr.com>
    Re: Injecting variables after the import subroutine has <gnari@simnet.is>
    Re: Not sure if Perl or browser problem..... <gnari@simnet.is>
        out of memory <M@linux.ca>
    Re: out of memory <noreply@gunnar.cc>
    Re: out of memory <mritty@gmail.com>
    Re: Regex to extract CSV file <nilram@hotpop.com>
    Re: Regex to extract CSV file <ebohlman@omsdev.com>
    Re: Regular expression to match surrounding parenthesis <abigail@abigail.nl>
    Re: Regular expression to match surrounding parenthesis (Peter J. Acklam)
        what do you call funct ( funct()) <ken_sington@nospam_abcdefg.com>
    Re: what do you call funct ( funct()) <noreply@gunnar.cc>
    Re: what do you call funct ( funct()) <bmb@ginger.libs.uga.edu>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 7 Jul 2004 21:50:03 -0400
From: dkcombs@panix.com (David Combs)
Subject: Accumulated CACMs (since 1966) Considered Dangerous: you want? (free,OfCourse)
Message-Id: <cci98b$j4d$1@panix3.panix.com>

Newsgroups: comp.unix.solaris,comp.unix.shell
Subject: Accumulated CACMs (since 1966) Considered Dangerous: you want?
Summary: 
Followup-To: 
Distribution: 
Organization: PANIX -- Public Access Networks Corp.
Keywords: 
Cc: 

(This is via crosspost -- is faster, easier for me,
this late;  also, all responses visible to me.
  (and, with any luck, you'll see it only ONCE, in ONE
    group -- the *first* one in which you see it)

  BE NICE -- DON'T REPLY VIA THE NEWS-GROUP --
   please do it ONLY via EMAIL --
  
  ie, lets keep this crosspost to a SINGLE-article thread.

  thanks!)



Yes, dangerous -- I've been informed -- dangerous to the
continued existence in house of *other* publications.

Feeling a little queasy about getting rid of these things,
especially the ones up through, say, 1980 (when cacm
went to hell?) -- anyway, tomorrow is recycled-paper
pickup day, at maybe 8am they come by with garbage truck --

Anyone want?

You'd have to come by and pick them up yourself.

This is New Rochelle, NY, right on US 95, exit 16,
maybe 5 miles north of the Bronx.

Interested?

BETTER ACT RIGHT NOW!

If you do reply, please include YOUR PHONE NUMBER.

Thanks,

David Combs





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

Date: 8 Jul 2004 01:24:48 GMT
From: Eric Bohlman <ebohlman@omsdev.com>
Subject: Re: Digest::Base HELP!
Message-Id: <Xns951FD06A8D347ebohlmanomsdevcom@130.133.1.4>

root <root@slate.comm.ad.roke.co.uk> wrote in
news:pan.2004.07.06.09.54.03.959078@slate.comm.ad.roke.co.uk: 

> Anyway, if I run perl -MCPAN -e 'install Digest::Base' I get the
> following message back
> 
> CPAN: Storable loaded ok
> Going to read /root/.cpan/Metadata
>   Database was generated on Mon, 05 Jul 2004 02:05:12 GMT
> Warning: Cannot install Digest::Base, don't know what it is.
> Try the command
>  
>     i /Digest::Base/
>  
> to find objects with matching identifiers.
> 
> Any other recommendations?

i /^Digest::/ brings up a very long list, one of the last entries of which 
shows Digest::Base as being part of the Digest module written by Gisle Aas.  
install Digest installed it for me.

Doing a partial search using i is a very powerful technique for tracking 
down "missing" modules.



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

Date: Wed, 07 Jul 2004 23:10:51 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: how run cgi on my Perl Windows offline?
Message-Id: <40EC82CB.9020502@rochester.rr.com>

Ken Sington wrote:

> Gunnar Hjalmarsson wrote:
> 
>> PHP2 wrote:
>>
 ...


> I thought I saw something in the CGI module that allows you to enter 
> params at the shell prompt?
> and I didn't install anything.
> I forgot the spacifics. someone else know?
> 

Yeah.  They're in:

    perldoc CGI

in the section titled "debugging".
-- 
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl



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

Date: Wed, 7 Jul 2004 22:48:45 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Injecting variables after the import subroutine has been called?
Message-Id: <cchugu$k5q$1@news.simnet.is>

"Daniel S." <lachinois@hotmail.com> wrote in message
news:bdcf9711.0407071154.4298c5d4@posting.google.com...
> Paul Lalli <mritty@gmail.com> wrote in message
news:<20040707102738.N22150@barbara.cs.rpi.edu>...
> > On Wed, 7 Jul 2004, Daniel S. wrote:
> >

[dynamic export of symbols from module to caller under strict]

did you look at the Exporter code

(untested)
  my $pgk='Yourpgk';
  my $callpkg = caller();
  my $sym='somevar';
  *{"${callpkg}::$sym"} = \${"${pkg}::$sym"};

this is just grossly taken from Exporter.pm, and I
may have mangled it.

gnari









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

Date: Wed, 7 Jul 2004 22:15:43 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Not sure if Perl or browser problem.....
Message-Id: <cchsj0$k07$1@news.simnet.is>

"Scott J" <scottjou@farnell.ns.ca> wrote in message
news:t9joe0p530kt5g2emeabep0u1nftijv22a@4ax.com...
>
> print qq($lastName $firstName);
>
> If this script is running on a windows machine, I remember reading how
> using the qq() operator wont work, fyi.

do not believe everything you read.

gnari







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

Date: Wed, 7 Jul 2004 22:30:36 -0400
From: marathon <M@linux.ca>
Subject: out of memory
Message-Id: <slrncepcec.qtd.M@barnyard.sweetpig.dyndns.org>

Folks:

I'm attempting to run a script that converts dmg2iso. Each attempt to
run, it terminates with an out of memory error.

Is this a fault of the script or something else? 

FWIW, I get the same result, when I run the application as a script on Debian,
or as an executable binary on Windoze.


-- 
S.Allen
-----------------------------------------------
barnyard  Wednesday Jul 07 2004 10:25:01 PM EDT
-----------------------------------------------
He thinks the Gettysburg Address is where Lincoln lived.
		-- Wanda, "A Fish Called Wanda"


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

Date: Thu, 08 Jul 2004 05:15:23 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: out of memory
Message-Id: <2l3sksF84tjkU1@uni-berlin.de>

marathon wrote:
> I'm attempting to run a script that converts dmg2iso. Each attempt
> to run, it terminates with an out of memory error.
> 
> Is this a fault of the script or something else?

It's the script. The problem is caused by the bug on line 679.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Wed, 7 Jul 2004 23:27:07 -0400
From: Paul Lalli <mritty@gmail.com>
Subject: Re: out of memory
Message-Id: <20040707232609.N22150@barbara.cs.rpi.edu>

On Wed, 7 Jul 2004, marathon wrote:

> Folks:
>
> I'm attempting to run a script that converts dmg2iso. Each attempt to
> run, it terminates with an out of memory error.
>
> Is this a fault of the script or something else?
>
> FWIW, I get the same result, when I run the application as a script on Debian,
> or as an executable binary on Windoze.

Exactly how do you expect anyone to answer this question?   You want us to
tell you if there's a problem with a script we can't see?

Paul Lalli


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

Date: 07 Jul 2004 17:29:04 -0500
From: Dale Henderson <nilram@hotpop.com>
Subject: Re: Regex to extract CSV file
Message-Id: <87u0wjzc27.fsf@camel.tamu-commerce.edu>

>>>>> "VC" == Vito Corleone <corleone@godfather.com> writes:

    VC> Hi, I have CSV file that looks like this: 1,this is the
    VC> title,2004/03/05,this is details 2,another
    VC> title,2004/05/05,another details

    VC> And I extract it using split like this: @row = split(",",
    VC> $line);

    VC> The problem is, if there is coma in text, it will turn to
    VC> this: 1,"title , with coma",2004/03/05,and the details 2,title
    VC> without coma,2004/05/09,"but details, has coma"

    VC> Is there any efficient way to extract this?


     This is ironic. Just the other night I was flipping through
     "Mastering Regular Expressions" 1st ed and found this example

     @fields=();
     while ($text =~ m/"([^"\\]*(\\.[^"\\]*)*)",?|([^,]+),?|,/g){
          push (@fields, defined($1)?$1:$3);
     }
     push (@fields,undef) if $text =~ m/,$/;


     Of course the text doesn't say anything about its efficiency. The
     most efficient solution is probably to use Text::CSV as others
     have pointed out.

     If you're interested in a super overkill solution, you can use
     the DBI module with the csv DBD (can't remember what its called)
     and access your csv file like a database. :)
 

-- 
Dale Henderson 

"Imaginary universes are so much more beautiful than this stupidly-
constructed 'real' one..."  -- G. H. Hardy


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

Date: 8 Jul 2004 01:49:45 GMT
From: Eric Bohlman <ebohlman@omsdev.com>
Subject: Re: Regex to extract CSV file
Message-Id: <Xns951FD4A541E8Cebohlmanomsdevcom@130.133.1.4>

Dale Henderson <nilram@hotpop.com> wrote in news:87u0wjzc27.fsf@camel.tamu-
commerce.edu:

>      If you're interested in a super overkill solution, you can use
>      the DBI module with the csv DBD (can't remember what its called)

Would you believe DBD::CSV?

>      and access your csv file like a database. :)


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

Date: 07 Jul 2004 22:42:13 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Regular expression to match surrounding parenthesis
Message-Id: <slrnceov24.4g9.abigail@alexandra.abigail.nl>

Peter J. Acklam (pjacklam@online.no) wrote on MMMCMLXIII September
MCMXCIII in <URL:news:llhvbp61.fsf@online.no>:
``  bob_nf@hotmail.com (Bob) wrote:
``  
`` > I am trying to create a regular expression to verify that user entered
`` > data is surrounded by the same number of open and closed parenthesis.
`` > 
`` > For example: if 'a' was the expression I was trying to match then a,
`` > (a), ((a)), (((a)))... (((((((a))))))) would all be valid.
`` > 
`` > I am not new to regular expressions but I am also not an expert.  I
`` > have spent hours searching for a solution but no luck.
``  
``  In stead of verifying directly that the input is correct, it it
``  probably simpler to remove everything you know is correct and see
``  if there is anything left:
``  
``      1 while $input =~ s/\([^()]*\)//g;
``      print $input =~ /[()]/ ? "bad" : "ok";
``  
``  The first line removes all matching, possibly nested, parantheses
``  and the second line checks to see if there are any parentheses
``  left.


The algorithm may be 'simpler' by some standard, it's not efficient.
Worst case, the algorithm takes time quadratic in the length of the
input.


Abigail
-- 
   my $qr =  qr/^.+?(;).+?\1|;Just another Perl Hacker;|;.+$/;
      $qr =~  s/$qr//g;
print $qr, "\n";


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

Date: 08 Jul 2004 01:05:08 +0200
From: pjacklam@online.no (Peter J. Acklam)
Subject: Re: Regular expression to match surrounding parenthesis
Message-Id: <u0wj8lln.fsf@online.no>

Abigail <abigail@abigail.nl> wrote:

> Peter J. Acklam (pjacklam@online.no) wrote:
> ``  
> ``  In stead of verifying directly that the input is correct, it it
> ``  probably simpler to remove everything you know is correct and see
> ``  if there is anything left:
> ``  
> ``      1 while $input =~ s/\([^()]*\)//g;
> ``      print $input =~ /[()]/ ? "bad" : "ok";
> ``  
> ``  The first line removes all matching, possibly nested, parantheses
> ``  and the second line checks to see if there are any parentheses
> ``  left.
> 
> The algorithm may be 'simpler' by some standard, it's not
> efficient.  Worst case, the algorithm takes time quadratic in
> the length of the input.

True, but the context here was validating user input, suggesting
interactive use, which in turn means that this is probably going
to be run relatively rarely and not thousands of time inside a
loop.

Of course, a better regex or a module could be used, or...

    sub isvalid {
        local $_ = shift;
        my $level = 0;
        while (length) {
            s/^[^()]+//;         # non-parantheses
            if (s/^\(//) {       # opening parenthesis
                ++$level;
                next;
            }
            if (s/^\)//) {       # closing parenthesis
                return '' if --$level < 0;
                next;
            }
        }
        return $level == 0;
    }

Peter

-- 
#!/local/bin/perl5 -wp -*- mode: cperl; coding: iso-8859-1; -*-
# matlab comment stripper (strips comments from Matlab m-files)
s/^((?:(?:[])}\w.]'+|[^'%])+|'[^'\n]*(?:''[^'\n]*)*')*).*/$1/x;


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

Date: Wed, 07 Jul 2004 21:20:30 -0400
From: Ken Sington <ken_sington@nospam_abcdefg.com>
Subject: what do you call funct ( funct())
Message-Id: <BdudnaGC5uDUPHHd4p2dnA@speakeasy.net>

ok it works, but what do you call this:

the eq test in this ternary op.
$answer = $test eq "value" ? "true" : "false";

or 

the function in this if:
if ( myFnct("blah") ){
   # it works
}




or 


the uc($a) in the split. or squeezing all that inside 
the sort

     @temp = sort {
            my $aa=(split '\|',uc($a), $colW)[$colZ];
            my $bb=(split '\|',uc($b), $colW)[$colZ];
            $aa=~ s/\W+//g;
            $bb=~ s/\W+//g;
            $aa cmp $bb;
        } @db;



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

Date: Thu, 08 Jul 2004 03:32:46 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: what do you call funct ( funct())
Message-Id: <2l3mjnF856nkU1@uni-berlin.de>

Ken Sington wrote:
> ok it works,

Excuse me, but exactly *what* is it that works? You may not have 
noticed, but there are more than one thread going on in this group...

> but what do you call this:

<various code snippets out of context snipped>

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Wed, 7 Jul 2004 22:11:05 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: what do you call funct ( funct())
Message-Id: <Pine.A41.4.58.0407072204190.11798@ginger.libs.uga.edu>

On Wed, 7 Jul 2004, Ken Sington wrote:

> ok it works, but what do you call this:
>
> the eq test in this ternary op.
> $answer = $test eq "value" ? "true" : "false";

A test for equality.


> or
>
> the function in this if:
> if ( myFnct("blah") ){
>    # it works
> }

A function call.


> or
>
>
> the uc($a) in the split.

A builtin function call.


> [ ... ] or squeezing all that inside
> the sort

A code block.


>      @temp = sort {
>             my $aa=(split '\|',uc($a), $colW)[$colZ];
>             my $bb=(split '\|',uc($b), $colW)[$colZ];
>             $aa=~ s/\W+//g;
>             $bb=~ s/\W+//g;
>             $aa cmp $bb;
>         } @db;


But what are you asking?

Regards,

Brad


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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