[23804] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6007 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 29 19:31:12 2004

Date: Thu, 29 Jan 2004 16:30:38 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 29 Jan 2004     Volume: 10 Number: 6007

Today's topics:
        generating tables on the fly ? <smrtalec_NO_SPAM@algxmail.com>
    Re: generating tables on the fly ? <tadmc@augustmail.com>
    Re: generating tables on the fly ? <smrtalec_NO_SPAM@algxmail.com>
    Re: generating tables on the fly ? <tadmc@augustmail.com>
    Re: generating tables on the fly ? <sbryce@scottbryce.com>
    Re: generating tables on the fly ? <yanoff@STOP-SPAMMINGyahoo.com>
        get (url) until match is found (Lydia Shawn)
    Re: get (url) until match is found <usenet@morrow.me.uk>
    Re: get (url) until match is found <nobull@mail.com>
        Getting file creation dates... <aunst8_2000@yahoo.com>
    Re: Getting file creation dates... <me@privacy.net>
    Re: Getting file creation dates... (Walter Roberson)
    Re: Getting file creation dates... <aunst8_2000@yahoo.com>
    Re: Getting file creation dates... (Walter Roberson)
    Re: Getting file creation dates... <qumsieh@cim.mcgill.ca>
    Re: Getting file creation dates... <aunst8_2000@yahoo.com>
    Re: Getting file creation dates... <aunst8_2000@yahoo.com>
    Re: Getting file creation dates... <Juha.Laiho@iki.fi>
    Re: Getting file creation dates... (Martin Herrmann)
        grep for text from a postscript file <JM@jm.biz>
    Re: grep for text from a postscript file (Walter Roberson)
    Re: grep for text from a postscript file <ddunham@redwood.taos.com>
        Guardian: open source is a throwback says Jack Schofiel (malcolm)
    Re: hash of hashes <dwall@fastmail.fm>
        Help with a regexp please <nige@zaonce.com>
    Re: Help with a regexp please <nobull@mail.com>
    Re: Help with a regexp please <nige@zaonce.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 26 Jan 2004 04:23:00 GMT
From: "smrtalec" <smrtalec_NO_SPAM@algxmail.com>
Subject: generating tables on the fly ?
Message-Id: <EC0Rb.1246$kg4.1038@nwrddc01.gnilink.net>


I am trying to scavange a example script I found on the web. The aubroutine
is below. Basically I want to extract data from a sql db then generate a
table of values on the fly.  The script below keeps generating a malformed
header error

sub gen_table {
    my $array_ref=query_data('%Ave%');

    my @headings = ('id no.','street no.','street name','city');
    my @rows = th(\@headings);
    foreach my $row_array (@$array_ref) {
        my ($id,$str_no,$str_name,$city) = @$row_array;
        push(@rows,"td([$id,$str_no,$str_name,$city])");
    }
    print table({-border=>undef,-width=>'25%'},
            caption(b('Wow.  I can multiply!')),
            Tr(\@rows)
                );

}





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

Date: Sun, 25 Jan 2004 22:39:23 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: generating tables on the fly ?
Message-Id: <slrnc196fr.mdh.tadmc@magna.augustmail.com>

smrtalec <smrtalec_NO_SPAM@algxmail.com> wrote:

> The script below 


What is below is not a script, merely a fragment of one.


> keeps generating a malformed
> header error


There is no such Perl error.

Must be some other kind of error.


>         push(@rows,"td([$id,$str_no,$str_name,$city])");
                     ^                                 ^
                     ^                                 ^

What's with the quotes?

Don't you want to call some function named td() ?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 26 Jan 2004 05:32:46 GMT
From: "smrtalec" <smrtalec_NO_SPAM@algxmail.com>
Subject: Re: generating tables on the fly ?
Message-Id: <2E1Rb.1552$kg4.1220@nwrddc01.gnilink.net>

> >         push(@rows,"td([$id,$str_no,$str_name,$city])");
>                      ^                                 ^
>                      ^                                 ^
>
> What's with the quotes?
>
> Don't you want to call some function named td() ?
>
 actually I put the quotes in hoping it would help. the error generated is
taken from my apache error_log




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

Date: Mon, 26 Jan 2004 06:41:00 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: generating tables on the fly ?
Message-Id: <slrnc1a2ms.na7.tadmc@magna.augustmail.com>

smrtalec <smrtalec_NO_SPAM@algxmail.com> wrote:
>> >         push(@rows,"td([$id,$str_no,$str_name,$city])");
>>                      ^                                 ^
>>                      ^                                 ^
>>
>> What's with the quotes?
>>
>> Don't you want to call some function named td() ?
>>
>  actually I put the quotes in hoping it would help.


It didn't help, so take them back out.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 26 Jan 2004 11:03:23 -0700
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: generating tables on the fly ?
Message-Id: <101aljb9b7u3h79@corp.supernews.com>

smrtalec wrote:
> I am trying to scavange a example script I found on the web.

Which is not always a good idea.


 > The script below

 ...is not a complete script. Do you know for sure that the error is in 
this subroutine? Please read the posting guidelines for this newsgroup 
and then post a small, but complete script that demonstrates the problem 
you are having.


> keeps generating a malformed header error

Which sounds like you are not sending the correct HTTP headers to the 
browser.



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

Date: Mon, 26 Jan 2004 12:36:49 -0600
From: Scott Yanoff <yanoff@STOP-SPAMMINGyahoo.com>
Subject: Re: generating tables on the fly ?
Message-Id: <40155e41$0$40210$39cecf19@news.twtelecom.net>

smrtalec wrote:
> I am trying to scavange a example script I found on the web. The aubroutine
> is below. Basically I want to extract data from a sql db then generate a
> table of values on the fly.  The script below keeps generating a malformed
> header error

Are you printing a content-type header in your script?
Something akin to
print "Content-type: text/html\n\r\n\r";

-Scott

-- 
yanoff@STOP-SPAMMINGyahoo.com | http://www.yanoff.org | AOL IM: SAY KJY


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

Date: 26 Jan 2004 06:00:07 -0800
From: apfeloma@hotmail.com (Lydia Shawn)
Subject: get (url) until match is found
Message-Id: <1240b4dc.0401260600.686efac@posting.google.com>

hi,
i need someones good advice solving the following problem:
i am matching a html page for certain triggers and want to grep only
the text in between two triggers.
as soon as the last trigger has been matched, the html page should not
be downloaded any further

here is what i got, which works well, but it requires the entire html
page do be downloaded before it starts matching:

input: test.htm
 bla1
 trigger1 bla2 trigger2
 bla3

output: 
 bla2

assuming bla3 is a long text, i do not wish to was bandwith
downloading it, if the match has already been found.

the script i wrote:

 require 5.004;
 use LWP::Simple;

 $return = get("http://test/test.htm");
 $before = 'trigger1';
 $after = 'trigger2';
 ($match) = $return =~ /$before(.*?)$after/si;  
 print $match;


is there a way i can combine the get command with something like
"until match = anything" ?

any help would be greatly appreciated!
thanks in advance!
lydia


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

Date: Mon, 26 Jan 2004 14:14:10 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: get (url) until match is found
Message-Id: <bv37bi$t1o$1@wisteria.csv.warwick.ac.uk>


apfeloma@hotmail.com (Lydia Shawn) wrote:
> i am matching a html page for certain triggers and want to grep only
> the text in between two triggers.
> as soon as the last trigger has been matched, the html page should not
> be downloaded any further

Read perldoc lwpcook "LARGE DOCUMENTS".

Ben

-- 
Every twenty-four hours about 34k children die from the effects of poverty.
Meanwhile, the latest estimate is that 2800 people died on 9/11, so it's like
that image, that ghastly, grey-billowing, double-barrelled fall, repeated
twelve times every day. Full of children. [Iain Banks]         ben@morrow.me.uk


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

Date: 26 Jan 2004 17:54:38 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: get (url) until match is found
Message-Id: <u9ad4a7fz5.fsf@wcl-l.bham.ac.uk>

apfeloma@hotmail.com (Lydia Shawn) writes:

> i need someones good advice solving the following problem:

Others have given you a fish, but I would like to show you how you
could have caught it yourself...

>  $return = get("http://test/test.htm");
>  $before = 'trigger1';
>  $after = 'trigger2';
>  ($match) = $return =~ /$before(.*?)$after/si;  
>  print $match;
> 
> 
> is there a way i can combine the get command with something like
> "until match = anything" ?

So what you are saying is that you are using LWP::Simple and you need 
more control.

So let's take a look at the fisrt paragraph of the DESCRIPTION perldoc
of LWP::Simple.


       This interface is intended for those who want a simplified view
       of the libwww-perl library.  It should also be suit- able for
       one-liners.  If you need more control [...]  you should use the
       full object oriented interface provided by the "LWP::UserAgent"
       module.

If you now look at the SYNOPSIS of LWP::UserAgent you'll find an
example like...

        $response = $ua->request($request, \&callback, 4096);

        sub callback { my($data, $response, $protocol) = @_; .... }

Well that looks like what you were after.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Sun, 25 Jan 2004 05:33:40 GMT
From: "Ed Landau" <aunst8_2000@yahoo.com>
Subject: Getting file creation dates...
Message-Id: <UyIQb.17042$CY7.15244@newssvr25.news.prodigy.com>

Can someone tell me how to get all the file names and their creation dates
from a directory?
I have the following which only gives me file names:


 opendir(DIR, ".") or die "Cannot open current directory\n";
 my @files = readdir DIR;
 closedir DIR;


Thanks
-Ed




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

Date: Sun, 25 Jan 2004 18:37:10 +1300
From: "Tintin" <me@privacy.net>
Subject: Re: Getting file creation dates...
Message-Id: <buvkog$m7aeu$1@ID-172104.news.uni-berlin.de>


"Ed Landau" <aunst8_2000@yahoo.com> wrote in message
news:UyIQb.17042$CY7.15244@newssvr25.news.prodigy.com...
> Can someone tell me how to get all the file names and their creation dates
> from a directory?
> I have the following which only gives me file names:
>
>
>  opendir(DIR, ".") or die "Cannot open current directory\n";
>  my @files = readdir DIR;
>  closedir DIR;

Depends which OS you are running on.

If it's a Unix system, you can not get the creation date of a file unless
you have stored the information elsewhere.




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

Date: 25 Jan 2004 06:24:25 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: Getting file creation dates...
Message-Id: <buvnep$rq9$1@canopus.cc.umanitoba.ca>

In article <buvkog$m7aeu$1@ID-172104.news.uni-berlin.de>,
Tintin <me@privacy.net> wrote:

:"Ed Landau" <aunst8_2000@yahoo.com> wrote in message
:news:UyIQb.17042$CY7.15244@newssvr25.news.prodigy.com...
:> Can someone tell me how to get all the file names and their creation dates
:> from a directory?

:Depends which OS you are running on.

:If it's a Unix system, you can not get the creation date of a file unless
:you have stored the information elsewhere.

Quite true, at least in traditional unix filesystems. The field
that many people think of as "creation time" is really the time
of the last status change:

     st_mtim   Time when data was last modified.  Changed by the following
               system calls:  creat, mknod, pipe, utime, and write.  The
               seconds portion of st_mtim is available as st_mtime.

     st_ctim   Time when file status was last changed.  Changed by the
               following system calls:  chmod, chown, creat, link, mknod,
               pipe, unlink, utime, and write.  The seconds portion of st_ctim
               is available as st_ctime.


It looks to me, though, that the original poster could use a nudge
towards the perl 'stat' function.
-- 
Usenet is one of those "Good News/Bad News" comedy routines.


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

Date: Sun, 25 Jan 2004 07:05:59 GMT
From: "Ed Landau" <aunst8_2000@yahoo.com>
Subject: Re: Getting file creation dates...
Message-Id: <rVJQb.17070$wJ.11018@newssvr25.news.prodigy.com>

I'm actually running WindowsXP (Active Perl).
I've found the following:

my $FileModifyDate= (stat($fileName))[9];

But what I'm really interested in is the following:

Some directories have files which are JPGs downloaded from my digital
camera. Windows has information called: "Date picture was taken".  I don't
know if this is just the creation date renamed or what... but I'd love to
get a hold of it.

-Ed




"Walter Roberson" <roberson@ibd.nrc-cnrc.gc.ca> wrote in message
news:buvnep$rq9$1@canopus.cc.umanitoba.ca...
> In article <buvkog$m7aeu$1@ID-172104.news.uni-berlin.de>,
> Tintin <me@privacy.net> wrote:
>
> :"Ed Landau" <aunst8_2000@yahoo.com> wrote in message
> :news:UyIQb.17042$CY7.15244@newssvr25.news.prodigy.com...
> :> Can someone tell me how to get all the file names and their creation
dates
> :> from a directory?
>
> :Depends which OS you are running on.
>
> :If it's a Unix system, you can not get the creation date of a file unless
> :you have stored the information elsewhere.
>
> Quite true, at least in traditional unix filesystems. The field
> that many people think of as "creation time" is really the time
> of the last status change:
>
>      st_mtim   Time when data was last modified.  Changed by the following
>                system calls:  creat, mknod, pipe, utime, and write.  The
>                seconds portion of st_mtim is available as st_mtime.
>
>      st_ctim   Time when file status was last changed.  Changed by the
>                following system calls:  chmod, chown, creat, link, mknod,
>                pipe, unlink, utime, and write.  The seconds portion of
st_ctim
>                is available as st_ctime.
>
>
> It looks to me, though, that the original poster could use a nudge
> towards the perl 'stat' function.
> -- 
> Usenet is one of those "Good News/Bad News" comedy routines.




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

Date: 25 Jan 2004 07:21:49 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: Getting file creation dates...
Message-Id: <buvqqd$11$1@canopus.cc.umanitoba.ca>

In article <rVJQb.17070$wJ.11018@newssvr25.news.prodigy.com>,
Ed Landau <aunst8_2000@yahoo.com> wrote:
:But what I'm really interested in is the following:

:Some directories have files which are JPGs downloaded from my digital
:camera. Windows has information called: "Date picture was taken".  I don't
:know if this is just the creation date renamed or what... but I'd love to
:get a hold of it.

Ah, that's completely different. There is a standard for embedding
creation information in picture files, calle Exif . 
Looks like you should be able to use the Image::EXIF module to
get at it.
-- 
Strange but true: there are entire WWW pages devoted to listing
programs designed to obfuscate HTML.


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

Date: Sun, 25 Jan 2004 07:30:23 GMT
From: Ala Qumsieh <qumsieh@cim.mcgill.ca>
Subject: Re: Getting file creation dates...
Message-Id: <40137130.7050900@cim.mcgill.ca>

Ed Landau wrote:

> Some directories have files which are JPGs downloaded from my digital
> camera. Windows has information called: "Date picture was taken".  I don't
> know if this is just the creation date renamed or what... but I'd love to
> get a hold of it.

It's encoded in the header of the jpeg file itself. Fortunately, there 
are modules to help you extract it. Check out JPEG::JFIF on CPAN.

--Ala



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

Date: Sun, 25 Jan 2004 07:31:15 GMT
From: "Ed Landau" <aunst8_2000@yahoo.com>
Subject: Re: Getting file creation dates...
Message-Id: <7hKQb.17075$CV.1101@newssvr25.news.prodigy.com>

I love newgroups.  I love you :).

Thanks.. no Really !

-Ed

"Walter Roberson" <roberson@ibd.nrc-cnrc.gc.ca> wrote in message
news:buvqqd$11$1@canopus.cc.umanitoba.ca...
> In article <rVJQb.17070$wJ.11018@newssvr25.news.prodigy.com>,
> Ed Landau <aunst8_2000@yahoo.com> wrote:
> :But what I'm really interested in is the following:
>
> :Some directories have files which are JPGs downloaded from my digital
> :camera. Windows has information called: "Date picture was taken".  I
don't
> :know if this is just the creation date renamed or what... but I'd love to
> :get a hold of it.
>
> Ah, that's completely different. There is a standard for embedding
> creation information in picture files, calle Exif .
> Looks like you should be able to use the Image::EXIF module to
> get at it.
> -- 
> Strange but true: there are entire WWW pages devoted to listing
> programs designed to obfuscate HTML.




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

Date: Sun, 25 Jan 2004 07:39:07 GMT
From: "Ed Landau" <aunst8_2000@yahoo.com>
Subject: Re: Getting file creation dates...
Message-Id: <voKQb.17076$c_.11023@newssvr25.news.prodigy.com>

Any clue where to get this? Sourceforge doesn't and ActiveState.com doesn't
mention it either.  Google didn't do much better....

-Ed
"Walter Roberson" <roberson@ibd.nrc-cnrc.gc.ca> wrote in message
news:buvqqd$11$1@canopus.cc.umanitoba.ca...
> In article <rVJQb.17070$wJ.11018@newssvr25.news.prodigy.com>,
> Ed Landau <aunst8_2000@yahoo.com> wrote:
> :But what I'm really interested in is the following:
>
> :Some directories have files which are JPGs downloaded from my digital
> :camera. Windows has information called: "Date picture was taken".  I
don't
> :know if this is just the creation date renamed or what... but I'd love to
> :get a hold of it.
>
> Ah, that's completely different. There is a standard for embedding
> creation information in picture files, calle Exif .
> Looks like you should be able to use the Image::EXIF module to
> get at it.
> -- 
> Strange but true: there are entire WWW pages devoted to listing
> programs designed to obfuscate HTML.




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

Date: Sun, 25 Jan 2004 09:27:01 GMT
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: Getting file creation dates...
Message-Id: <bv01vq$tk2$2@ichaos.ichaos-int>

"Ed Landau" <aunst8_2000@yahoo.com> said:
>"Walter Roberson" <roberson@ibd.nrc-cnrc.gc.ca> wrote in message
>news:buvqqd$11$1@canopus.cc.umanitoba.ca...
>> Looks like you should be able to use the Image::EXIF module to
>> get at it.

>Any clue where to get this? Sourceforge doesn't and ActiveState.com
>doesn't mention it either. Google didn't do much better....

Seems to be available on CPAN.
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)


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

Date: 28 Jan 2004 05:35:45 -0800
From: mrh1@gmx.net (Martin Herrmann)
Subject: Re: Getting file creation dates...
Message-Id: <350918ef.0401280535.2591fca0@posting.google.com>

roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in message news:<buvqqd$11$1@canopus.cc.umanitoba.ca>...
> In article <rVJQb.17070$wJ.11018@newssvr25.news.prodigy.com>,
> Ed Landau <aunst8_2000@yahoo.com> wrote:
> :But what I'm really interested in is the following:
>  
> :Some directories have files which are JPGs downloaded from my digital
> :camera. Windows has information called: "Date picture was taken".  I don't
> :know if this is just the creation date renamed or what... but I'd love to
> :get a hold of it.
> 
> Ah, that's completely different. There is a standard for embedding
> creation information in picture files, calle Exif . 
> Looks like you should be able to use the Image::EXIF module to
> get at it.

I recommend Image::Info to get the EXIF info, because it needs no external libs etc.

Regards
     Martin

-- 
Mapivi - Perl/Tk image viewer with EXIF support
http://mapivi.de.vu


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

Date: Fri, 23 Jan 2004 00:12:09 GMT
From: "J M" <JM@jm.biz>
Subject: grep for text from a postscript file
Message-Id: <tFZPb.7698$3s3.4762@newssvr24.news.prodigy.com>

How can I grep for each record in array of text filter against postscript
files?

ArrayF
aaaa
bbbb
abcd
ABcd

I needs to run each record against postscript file and see if there is any
filter matches?

TIA!




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

Date: 23 Jan 2004 00:55:26 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: grep for text from a postscript file
Message-Id: <buprdu$7hi$1@canopus.cc.umanitoba.ca>

In article <tFZPb.7698$3s3.4762@newssvr24.news.prodigy.com>,
J M <JM@jm.biz> wrote:
:How can I grep for each record in array of text filter against postscript
:files?

:ArrayF
:aaaa
:bbbb
:abcd
:ABcd

:I needs to run each record against postscript file and see if there is any
:filter matches?

Tricky. Postscript is a complete programming language in itself.
There is no possible [finite] general mechanism to determine whether
arbitrary Postscript programs wil produce particular outputs.

Consider for example that a Postscript driver might choose to use
absolute positioning to place the AB and then relative positioning
for the following cd. Absolute positioning of an uppercase letter
introducing a word happens quite a bit in Postscript drivers, in
my experience.


What happens if the driver choses to define producing cd as a function,

  /frotz1733 (cd) def
  [.... thousands of lines of postscript here]
  (AB) 12 timesnewroman
  frotz1733

?


If you know that the target might appear *as code* then you just
have a traditional matching problem

use strict;
use warnings;
my @ArrayF = qw(aaaa bbbb abcd ABcd);
my $matchstring = join '|', @ArrayF;
print grep { m/$matchstring/o } (<>)


Note 1: as @ArrayF gets big, the backtracking involved in the matching
can really slow you down.

Note 2: Watch out for metacharacters in @ArrayF

Note 3: Your target list suggests you'd be better off doing a case-
insensitive search such as m/aaaa|bbbb|abcd/i .


-- 
Inevitably, someone will flame me about this .signature.


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

Date: Mon, 26 Jan 2004 19:29:20 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: grep for text from a postscript file
Message-Id: <kUdRb.17460$Bi.8416@newssvr25.news.prodigy.com>

Walter Roberson <roberson@ibd.nrc-cnrc.gc.ca> wrote:
> have a traditional matching problem

> use strict;
> use warnings;
> my @ArrayF = qw(aaaa bbbb abcd ABcd);
> my $matchstring = join '|', @ArrayF;
> print grep { m/$matchstring/o } (<>)

> Note 1: as @ArrayF gets big, the backtracking involved in the matching
> can really slow you down.

If you can guarantee surrounding context, then this can be much faster..

for instance..
m/^$matchstring$/o  or
m/\($matchstring\)/o

If you can't, *and* you care which one it matched, you might want to
sort the list by length first (so the longest matches are tried first).

join '|', sort {length $b <=> length $a} @ArrayF;

-- 
Darren Dunham                                           ddunham@taos.com
Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >


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

Date: 25 Jan 2004 11:44:38 -0800
From: malcolmny_1@lycos.com (malcolm)
Subject: Guardian: open source is a throwback says Jack Schofield
Message-Id: <64cff82f.0401251144.7c71a2d3@posting.google.com>

Why you can't get something for nothing
Jack Schofield Jan 22 2004

[..]

"There are also undoubted benefits from running open source software,
though the financial ones can be small or even negative. Companies are
bound to be tempted by the idea of getting something for nothing .."

"The facility to fix bugs yourself and to modify programs also sounds
attractive. However, fixing bugs is not practical for most companies,
and modifications can be positively dangerous.

If you are really going to do these things, you need to hire several
reliable programmers with kernel-level skills"

"Indeed, the whole progress of commercial computing has been from
expensive hand-written, bug-ridden, company-specific programs to
cheaper but more powerful off-the-shelf packages. From that point of
view, open source is a throwback."

- http://www.guardian.co.uk/online/story/0,3605,1127802,00.html


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

Date: Wed, 21 Jan 2004 15:12:21 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: hash of hashes
Message-Id: <Xns947767D1992DEdkwwashere@216.168.3.30>

Imre <google.com@saling.ch> wrote:

> Hello Community,
> 
> can someone tell me how to traverse a hash of hashes to e.g. print out
> all elements? 

Besides the useful Data::Dumper already recomended, there are examples in 
'perldoc perldsc', the data structures "cookbook".

-- 
David Wall


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

Date: Thu, 29 Jan 2004 16:41:54 +0000
From: Nigel Scott <nige@zaonce.com>
Subject: Help with a regexp please
Message-Id: <bvbd4a$q3asc$1@ID-222458.news.uni-berlin.de>

Hi

I am writing a piece of perl for processing emails and part of the 
process involves finding the boundaries of multiple MIME parts.

I am trying to extract the boundary from the headers using a pattern
like this:

	my $pattern = ".*boundary *= *[\'\"]*(.*)[\'\"]*.*";

This is to cover the cases where the boundary itself may be contained in 
double quotes, single quotes or no quotes at all. For some reason 
though, if the boundary is contained double quotes, eg.

Content-Type: multipart/mixed;
	boundary="----=_Part_174034_7372797.1070374686532"

and I use:
	my $boundary =~ s/$pattern/$1/is;

$boundary becomes ----=_Part_174034_7372797.1070374686532'
with an extra single quote on the end.

I have tried looking at various perl and regexp tutorials, but I can't 
work out what is wrong with my pattern.

Any help appreciated,
Nige.


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

Date: 29 Jan 2004 17:41:20 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Help with a regexp please
Message-Id: <u9r7xihcu7.fsf@wcl-l.bham.ac.uk>

Nigel Scott <nige@zaonce.com> writes:

> I am writing a piece of perl for processing emails and part of the
> process involves finding the boundaries of multiple MIME parts.

There are modules to do that, you know.

> 	my $pattern = ".*boundary *= *[\'\"]*(.*)[\'\"]*.*";
                                             ^^^^^^^^^^^

Firstly it's easier to see what's what if you qute regex using qr//
not qq().

   my $pattern = qr/.*boundary *= *['"]*(.*)['"]*.*/;

Now let's focus on just one bit of that 

  /['"]*(.*)['"]*/

If you have two greedy subexpressions in a regex the first one gets
first bite and the character class ['"] is a subset of the character
class . so the above is equivalent to:

  /['"]*(.*)/

Perhaps you meant

 /(['"]?)(.*)\1/

For real examples of parsing MIME headers see the source code of the
modules you should be using anyhow.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 29 Jan 2004 19:15:27 +0000
From: Nige <nige@zaonce.com>
Subject: Re: Help with a regexp please
Message-Id: <bvbm4m$qde78$1@ID-222458.news.uni-berlin.de>

Brian McCauley wrote:

> If you have two greedy subexpressions in a regex the first one gets
> first bite and the character class ['"] is a subset of the character
> class . so the above is equivalent to:
> 
>   /['"]*(.*)/
> 
> Perhaps you meant
> 
>  /(['"]?)(.*)\1/
> 
> For real examples of parsing MIME headers see the source code of the
> modules you should be using anyhow.
> 

Hi Brian - thanks for the reply.

I have actually installed the MIME::Parser modules and attempted to use 
them, however I end up with empty files for each part of the message, 
and only certain parts are written. The debug from the module simple 
says something along the lines of "writing to file" and then finishes 
with some timing stats. I don't have the exact output as I am now at 
home. Also, I don't really need the full MIME parsing functionality - 
all I need is to extract the inline text/plain parts from the message, 
hence my attempts you see above.

I've had a read up about greedy expressions and understand that my 
pattern is wrong, so I'll give it another with a ? instead, tomorrow at 
work.

Thanks again,
Nige


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

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


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