[24602] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6778 Volume: 10

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

Date: Thu, 8 Jul 2004 08:05:12 -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           Thu, 8 Jul 2004     Volume: 10 Number: 6778

Today's topics:
    Re: Looking for a Formmail script <jns@gellyfish.com>
    Re: Matching of optional parts in regular expressions (Markus Elfring)
    Re: Math::BigFloat oddities (J. Romano)
    Re: Multiple email recipients using NMS Formail <jns@gellyfish.com>
    Re: Not sure if Perl or browser problem..... <scottjou@farnell.ns.ca>
    Re: Not sure if Perl or browser problem..... <spamtrap@dot-app.org>
    Re: out of memory <clydenospamorham@nospamorhamgetofftheline.freeservenospamorham.co.uk>
    Re: out of memory <me@privacy.net>
    Re: Passing args to a running thread... (..:: parizienne ::..)
    Re: Perl IDEs <jussij@zeusedit.com>
    Re: Regex to extract CSV file <clydenospamorham@nospamorhamgetofftheline.freeservenospamorham.co.uk>
    Re: Regex to extract CSV file <clydenospamorham@nospamorhamgetofftheline.freeservenospamorham.co.uk>
    Re: Regular expression to match surrounding parenthesis <josef.moellers@fujitsu-siemens.com>
    Re: Regular expression to match surrounding parenthesis <abigail@abigail.nl>
    Re: Regular expression to match surrounding parenthesis (Anno Siegel)
    Re: Regular expression to match surrounding parenthesis (Anno Siegel)
    Re: Request for comments on a JPEG metadata Perl module <mrmnews@the-meissners.org>
    Re: sorting hash based on keys and  replacing them  in  <dha@panix.com>
    Re: what do you call funct ( funct()) <ken_sington@nospam_abcdefg.com>
    Re: what do you call funct ( funct()) (Malcolm Dew-Jones)
    Re: what do you call funct ( funct()) <josef.moellers@fujitsu-siemens.com>
    Re: what do you call funct ( funct()) <gnari@simnet.is>
        What does this do? (Bob)
    Re: What does this do? <Eugene.Mikheyev@kiev.cms.com.ua>
    Re: What does this do? (Peter J. Acklam)
    Re: What does this do? <gnari@simnet.is>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 08 Jul 2004 13:29:08 GMT
From: Jonathan Stowe <jns@gellyfish.com>
Subject: Re: Looking for a Formmail script
Message-Id: <E_bHc.65$5_.25@newsr2.u-net.net>

Helgi Briem <HelgiBriem_1@hotmail.com> wrote:
> On 27 May 2004 05:22:13 -0700, gchapman1965@msn.com (Greg Chapman)
> wrote:
> 
>>I'm trying to find a script that will allow me to submit the
>>information from a form to an email address. 
> 
> http://nms-cgi.sourceforge.net/scripts.shtml
> 
>>The problem is that I
>>need to format the output that is received in the email. I have it
>>working now, but the email lists each field straight down the page. I
>>need to list a group of four fields across the page and then the next
>>group of four below that and so on.
>>
>>Is this possible?
> 
> Yes.
> 

Specifically the TFmail program which is designed to allow for templated
output.

/J\


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

Date: 8 Jul 2004 07:02:47 -0700
From: Markus.Elfring@web.de (Markus Elfring)
Subject: Re: Matching of optional parts in regular expressions
Message-Id: <40ed1d8f.0407080602.bd6de25@posting.google.com>

Does this example show an error in the implementation?

% regexp {\s*(\d+)(?:%(\w+))?} {   !123!} z a b
1
% foreach X {a b} {puts "$X=|[set $X]|"}
a=|123|
b=||
% regexp {\s*(\d+)(?:%(\w+))?$} {   !123!} z a b
0
% regexp {\s*(\d+)(?:%(\w+))?} {   456%} z a b
1
% foreach X {a b} {puts "$X=|[set $X]|"}
a=|456|
b=||

I think that the specified strings must not match to the pattern.
How do you think about it?


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

Date: 8 Jul 2004 07:59:59 -0700
From: jl_post@hotmail.com (J. Romano)
Subject: Re: Math::BigFloat oddities
Message-Id: <b893f5d4.0407080659.ebd4f60@posting.google.com>

pjacklam@online.no (Peter J. Acklam) wrote in message news:<4qokgq16.fsf@online.no>...
> jl_post@hotmail.com (J. Romano) wrote:
> 
> >    To sum up, Peter, it looks like you found the only instance where
> > the '-=' fails.  And since lines like "$x -= $x" were never expected
> > to be used, that special situation was never handled (causing a
> > classic bug).
> 
> I am overwhelmed by you having put so much effort into this.
> Thank you!

   You're very welcome!  Comments in the code make finding bugs easier
(that's why I advise every coder to add in-code comments). 
Fortunately, the Math::BigInt module is fairly commented (but, as
always, I wish there were more comments).

> I didn't have the latest version from CPAN
> 
>     T/TE/TELS/math/Math-BigInt-1.70.tar.gz
> 
> I installed it and the bug is still there.

   Oh, sorry... I forgot to mention that the version I used that
didn't have the bug was a very old version.  Let me check real
quick... the old version (without the bug) is $VERSION='0.01' (that's
quite an old version) whereas the more recent version (the one with
the bug) is $VERSION='1.60'.

   The old version's Math::BigInt objects were simply references to
scalar strings, but the newer versions of Math::BigInt have objects
that are references to hashes, with "value" and "sign" as attributes.

   I've been tinkering around a bit more with the Math::BigInt and
Math::BigFloat modules, and I discovered more things related to the
bug:

Here's another quick fix:  Use a text editor to comment out the:

      '-='    =>      sub { $_[0]->bsub($_[1]); },
      '/='    =>      sub { scalar $_[0]->bdiv($_[1]); },

lines in the "use overload" pragma in the Math/BigInt.pm module.  This
will prevent the '-=' and '/=' operators from being overloaded. 
Instead they will be autogenerated from the '-' and the '/' operators.
 Perl is smart enough to do this correctly, avoiding the bug found in
Math::BigInt::bsub().

In fact, the old version of Math::BigInt didn't overload any
assignment mutators (like '+=', '-=', '*=', '/=', etc.) because Perl
automagically autogenerated them.

(I originally found this confusing, even after reading "perldoc
overload".  Therefore, two weeks ago I decided to study this a bit.  I
posted a write-up of my findings on comp.lang.perl.misc on June 26,
2004 with the subject "Regarding copy constructors and mutators".  I
expected to get some replies correcting me, suggesting advice, or
maybe even an occasional flame, but nobody replied.  Maybe nobody
replied because there weren't any errors, or maybe because nobody
bothered to read it...  Either way, studying this helped me find the
source of your bug.)

   Anyway, removing (or commenting out) the '-=' and '/=' lines in the
"use overload" pragma of Math::BigInt will fix the problem in both
Math::BigInt and in Math::BigFloat (due to the fact that
Math::BigFloat inherits from Math::BigInt, as Anno said).  This is
just a temporary fix, of course, since a comment near the top of the
BigInt.pm module explains that the assignment mutators are overloaded
as shortcuts for speed.  In other words, they don't have to be
overloaded, but they are for efficiency.  Unfortunately, this allowed
for the bug you found, Peter.  The optimal fix would be to fix the bug
inside Math::BigInt::bsub() (and the one probably in
Math::BigInt::bdiv()).

   I don't know if this reply explained anything more clearly or just
made things more confusing, but I'm posting it nevertheless.

   Happy Perling,

   -- Jean-Luc Romano


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

Date: Thu, 08 Jul 2004 13:21:14 GMT
From: Jonathan Stowe <jns@gellyfish.com>
Subject: Re: Multiple email recipients using NMS Formail
Message-Id: <eTbHc.64$5_.41@newsr2.u-net.net>

Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> Adam wrote:
>> I am using Version 3.12c1 of NMS FormMail.
> Note that this group is not the right place to seek help with 
> configuring a script. If the docs isn't sufficient, 

The EXAMPLES file has a section entitled:

    EXAMPLE 3: Copies to multiple recipients

which explains how to do this.

>                                                     asking the authors 
> is the natural next step.
> 

The appropriate place to get support for any NMS programs is at the
mailling list at:

     nms-cgi-support@lists.sourceforge.net

/J\


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

Date: Thu, 08 Jul 2004 09:02:22 -0300
From: Scott J <scottjou@farnell.ns.ca>
Subject: Re: Not sure if Perl or browser problem.....
Message-Id: <ftdqe0t7eko5koka7m8l7i0hgumhvvodhr@4ax.com>

On Wed, 7 Jul 2004 22:15:43 -0000, "gnari" <gnari@simnet.is> wrote:

Things have been known to change in this industry, from time to time,
haha.

Scott

>"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: Thu, 08 Jul 2004 10:53:33 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Not sure if Perl or browser problem.....
Message-Id: <Y9-dnc6Zef5zwnDd4p2dnA@adelphia.com>

Scott J wrote:

> You have loaded the CGI module, but you have not initialized it.

Have you ever actually looked at the CGI.pm docs? The function-based style
is perfectly valid; an example of it is given as the very first thing in
the CGI.pm man page, in the synopsis section.

There is a thorough discussion of the two styles in the "Programming Style"
section as well - the very first section in the full docs.

> $query = new CGI;

This does not "initialize" the CGI.pm module. It creates a new instance of
class CGI, which has the param() method you use later.

> print "Content-type: text/html\n\n";

If you're going to criticize how others use CGI.pm, you'd better use it
correctly yourself:

print header("text/html");

Or, with the OOP style:

print $query->header("text/html");

> If this script is running on a windows machine, I remember reading how
> using the qq() operator wont work, fyi.

Do you have any supporting evidence for this? I haven't heard about this bug
before, and Google didn't turn up anything. Given the error-riddled nature
of the rest of your post, I'm sceptical.

>>Is there something with IE6 on WinXP that would stop my HTML forms
>>from processing the entered information to my perl script. I just
>>switched
>>systems from Win95 / IE5.5 (where the form and script worked fine), to
>>XP Pro with IE6.

>>FORM:
>><form action="cgi-bin/Home.pl" method=post>
>>First Name: <input type=text name="firstName"><br>
>>Last Name: <input type=text name="lastName">
>><p align=center><input type=submit value="Continue"><br><br></p>
>></form>

This is not valid HTML 4.01/Strict. Using that DTD, input elements cannot
"float" loose inside a form; they have to be contained in a block element,
which in turn is contained by the form. Try this instead:

<form action="cgi-bin/Home.pl" method=post>
    <p>First Name: <input type=text name="firstName"><br>
    Last Name: <input type=text name="lastName"></p>

    <p align=center><input type=submit value="Continue"><br><br></p>
</form>

While it might seem like nit-picking, this might actually make a difference
in IE6, which has so-called "strict" and "quirks" modes that are triggered
by the DTD declaration. If it's working in "strict" mode, IE6 could be
ignoring the invalid inputs.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Thu, 08 Jul 2004 08:20:37 GMT
From: "Clyde Ingram" <clydenospamorham@nospamorhamgetofftheline.freeservenospamorham.co.uk>
Subject: Re: out of memory
Message-Id: <pt7Hc.76$Pu1.7@newsfe5-gui.ntli.net>

Paul,

"Paul Lalli" <mritty@gmail.com> wrote in message
news:20040707232609.N22150@barbara.cs.rpi.edu...
> On Wed, 7 Jul 2004, marathon wrote:
> >
> > Is this a fault of the script or something else?
> >
>
> 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?
>

Whoa, there!
It's not Marathon Man's fault, you know.

Google's first result on "dmg2iso" throws up:
http://www.emaculation.com/modules.php?name=News&file=article&sid=213
This is a News forum discussing conversion of DMG images to ISO format.
But look at that beautifully crafted banner proclaiming "Emasculation.com".

That's it -- the sample code snippets part of his posting got
auto-emasculated.
Check your Recycle Bin -- it'll all be there...

Regards,
Clyde




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

Date: Thu, 8 Jul 2004 19:23:33 +1200
From: "Tintin" <me@privacy.net>
Subject: Re: out of memory
Message-Id: <2l4b3cF7sir3U1@uni-berlin.de>


"marathon" <M@linux.ca> wrote in message
news: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.

Your while loop is incorrect.  You shouldn't be recursively opening the
files.




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

Date: 8 Jul 2004 00:22:03 -0700
From: parizienne@parizienne.ch (..:: parizienne ::..)
Subject: Re: Passing args to a running thread...
Message-Id: <e45ae533.0407072322.1d35d254@posting.google.com>

Michal Wojciechowski <odyniec-usenet@odyniec.net> wrote :

> I suppose you'll find all the answers you need in the tutorial on
> threads in Perl - see 'perldoc perlthrtut'.

Yep, sorry, I already read it. Thanks...

Could maybe someone give me an advice...

Is it better to use Thread ? Or fork () ? 

If I want an inter-thread communication ?

Thanks

Dan


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

Date: Fri, 09 Jul 2004 00:55:48 +1000
From: Jussi Jumppanen <jussij@zeusedit.com>
Subject: Re: Perl IDEs
Message-Id: <40ED6074.5FC8@zeusedit.com>

Someone wrote:

> Is there an IDE or Windows Perl Editor?

The Zeus Programmer's Editor Version 3.93 now with perl:

   http://www.zeusedit.com/perl.html

Jussi Jumppanen
Author of: Zeus for Windows, Win32 (Brief, WordStar, Emacs) Text Editor
"The C/C++, Java, HTML, FTP, Python, PHP, Perl programmer's editor"
http://www.zeusedit.com


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

Date: Thu, 08 Jul 2004 08:33:45 GMT
From: "Clyde Ingram" <clydenospamorham@nospamorhamgetofftheline.freeservenospamorham.co.uk>
Subject: Re: Regex to extract CSV file
Message-Id: <JF7Hc.80$Pu1.53@newsfe5-gui.ntli.net>

Vito,

>     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?

perldoc Text::ParseWords

Perhaps:
    @words = quotewords( ',', 0, $line );

Regards,
Clyde




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

Date: Thu, 08 Jul 2004 09:06:58 GMT
From: "Clyde Ingram" <clydenospamorham@nospamorhamgetofftheline.freeservenospamorham.co.uk>
Subject: Re: Regex to extract CSV file
Message-Id: <S88Hc.90$Pu1.72@newsfe5-gui.ntli.net>

Eric,

"Eric Bohlman" <ebohlman@omsdev.com> wrote in message
news: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?

Interesting ... Isn't DBD::CSV trustworthy?

It may be a bit heavy handed, of course.
But for fun, I once knocked up this (on Windoze XPee):

#!e:/bin/perl.exe -w

use strict;
use Data::Dumper;
local $Data::Dumper::Terse      = 0;
local $Data::Dumper::Indent     = 1;

use DBI;

my $CSV_DIR="D:/Clyde/perldev/Trial";

my $dbh = DBI->connect("DBI:CSV:f_dir=$CSV_DIR")
        or die "Cannot connect: " . $DBI::errstr;
$dbh->{'csv_tables'}->{'fractions'} = { 'file' => 'fractions.csv'};

$dbh->{'RaiseError'} = 1;
$@ = '';
eval {
    my $sth = $dbh->prepare("SELECT * FROM fractions")
            or die "Cannot prepare: " . $dbh->errstr();
    $sth->execute() or die "Cannot execute: " . $sth->errstr();

    while (my $row = $sth->fetchrow_hashref) {
        print("Found result row:\n" . Data::Dumper->Dump( [$row] ) . "\n");
    }
    $sth->finish();
    $dbh->disconnect();

};
if ($@) { die "SQL database error: $@"; }

The data file "fractions.csv" starts:

Numerator,Denominator,Decimal,Percentage,Total
5,6,0.833333333,83.33333333,84.16666667
8,3,2.666666667,266.6666667,269.3333333


And the output starts:
Found result row:
$VAR1 = {
  'Total' => '84.16666667',
  'Numerator' => '5',
  'Denominator' => '6',
  'Percentage' => '83.33333333',
  'Decimal' => '0.833333333'
};

Found result row:
$VAR1 = {
  'Total' => '269.3333333',
  'Numerator' => '8',
  'Denominator' => '3',
  'Percentage' => '266.6666667',
  'Decimal' => '2.666666667'
};

(I don't recall having to register the database with XP)

Regards,
Clyde




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

Date: Thu, 08 Jul 2004 08:35:19 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Regular expression to match surrounding parenthesis
Message-Id: <ccipqq$2gp$1@nntp.fujitsu-siemens.com>

Bob wrote:
> Hi,
>=20
> 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.
>=20
> For example: if 'a' was the expression I was trying to match then a,
> (a), ((a)), (((a)))... (((((((a))))))) would all be valid.
>=20
> 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.
>=20
> Is this possible and if so any help would be appreciated?

In a nutshell: no, this is impossible. (<- that is a definite period!)

Regular expressions cannot parse this kind of things since finite state=20
automata, which implement the matching of strings to regular=20
expressions, cannot count and have no storage (that's why they are=20
called "finite state") and you need to count the number of opening=20
parens before you can validate that there are as many closing parens.

This is from the theory of automata. Practical implementations may allow =

this but the question was whether regular expressions can do this.
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett



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

Date: 08 Jul 2004 07:48:52 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Regular expression to match surrounding parenthesis
Message-Id: <slrncepv34.4g9.abigail@alexandra.abigail.nl>

Josef Moellers (josef.moellers@fujitsu-siemens.com) wrote on MMMCMLXIV
September MCMXCIII in <URL:news:ccipqq$2gp$1@nntp.fujitsu-siemens.com>:
--  Bob wrote:
-- > Hi,
-- > 
-- > 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.
-- > 
-- > Is this possible and if so any help would be appreciated?
--  
--  In a nutshell: no, this is impossible. (<- that is a definite period!)
--  
--  Regular expressions cannot parse this kind of things since finite state 
--  automata, which implement the matching of strings to regular 
--  expressions, cannot count and have no storage (that's why they are 
--  called "finite state") and you need to count the number of opening 
--  parens before you can validate that there are as many closing parens.
--  
--  This is from the theory of automata. Practical implementations may allow 
--  this but the question was whether regular expressions can do this.


It all depends on your definition of 'regular expressions'. In the context
of Perl, a 'regular expression' is something that can be grokked by Perls
regular expression engine. And with those regular expressions, you *can*
matched strings with balanced parenthesis.

It would be very inpractical if discussion on the forum would refer to
"expressions that can be grokked by Perl's regular expression engine"
instead of what's understood by everyone but a few pedants, "regular
expressions".


Abigail
-- 
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"


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

Date: 8 Jul 2004 09:48:06 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Regular expression to match surrounding parenthesis
Message-Id: <ccj58m$e1n$1@mamenchi.zrz.TU-Berlin.DE>

Peter J. Acklam <pjacklam@online.no> wrote in comp.lang.perl.misc:

[checking paren balance]

> 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;
>     }

Instead of consuming the string bit by bit you could extract just the
parens and loop over them.  That simplifies things a bit:

    sub isvalid {
        my $level = 0;
        ( $level += $_ eq '(' ? 1 : -1 ) >= 0 or return !!0 for
            shift =~ /([()])/g;
        $level == 0;
    }

Anno


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

Date: 8 Jul 2004 10:13:02 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Regular expression to match surrounding parenthesis
Message-Id: <ccj6ne$f4b$1@mamenchi.zrz.TU-Berlin.DE>

Abigail  <abigail@abigail.nl> wrote in comp.lang.perl.misc:
> Josef Moellers (josef.moellers@fujitsu-siemens.com) wrote on MMMCMLXIV
> September MCMXCIII in <URL:news:ccipqq$2gp$1@nntp.fujitsu-siemens.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.

[...]

> --  In a nutshell: no, this is impossible. (<- that is a definite period!)
> --  
> --  Regular expressions cannot parse this kind of things since finite state 
> --  automata, which implement the matching of strings to regular 
> --  expressions, cannot count and have no storage (that's why they are 
> --  called "finite state") and you need to count the number of opening 
> --  parens before you can validate that there are as many closing parens.
> --  
> --  This is from the theory of automata. Practical implementations may allow 
> --  this but the question was whether regular expressions can do this.
> 
> 
> It all depends on your definition of 'regular expressions'. In the context
> of Perl, a 'regular expression' is something that can be grokked by Perls
> regular expression engine. And with those regular expressions, you *can*
> matched strings with balanced parenthesis.
> 
> It would be very inpractical if discussion on the forum would refer to
> "expressions that can be grokked by Perl's regular expression engine"
> instead of what's understood by everyone but a few pedants, "regular
> expressions".

The mathematicians who work with regular expressions are just a club of
pedants?

"Regular expression" has two significantly different definitions in
mathematics and in CS.  Of course, the CS meaning is the primary one
on clpm, but pointing out the difference is not merely pedantry.

Anno


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

Date: 08 Jul 2004 10:12:36 -0400
From: Michael Meissner <mrmnews@the-meissners.org>
Subject: Re: Request for comments on a JPEG metadata Perl module
Message-Id: <m34qoik2p7.fsf@glinda.the-meissners.org>

l v <lv@aol.com> writes:

> Stefano Bettelli wrote:
> > Hi,
> > Il giorno Thu, 01 Jul 2004 06:34:25 -0700, GreenLight scrisse:
> >
> >>I have been wanting to create a catalog of my photos
> >>for quite some time.
> > this is exactly my problem :-). I believe that in order to manage a catalogue
> > with little complication, one should be
> > able to enter his comments/additional info directly into the
> > image, and then use a perl script to generate dynamic web
> > pages with the required fields.
> > For the first task, I think that a winning combination is a
> > specialised library capable of parsing/modifying the JPEG
> > structure together with a GUI program allowing you to interact
> > with your photos more easily. Maybe you could have a look at
> > the following program:
> > 	http://herrmanns-stern.de/software/mapivi/mapivi.shtml
> > Bye,
> > 			Stefano
> >
> 
> The closest I could get was using the Image::IPTCInfo module's SetAttribute,
> AddKeyword, and Keywords functions to build my catalog. Although I would much
> rather save the information in EXIF vs IPTC.  I then use jhead (
> http://www.sentex.net/~mwandel/jhead ) to autorotate the image which
> automatically updates the EXIF orientation flag for me. ImageMagick is also
> used to create my thumbnails (convert) and a contact sheet (montage)

If you are using jhead already, check out the -cl string option which allows
you to update the comment field.  I use that for storing my copyright string in
all of my photos.  I suspect there may be a way to set this under perl.

-- 
Michael Meissner
email: mrmnews@the-meissners.org
http://www.the-meissners.org


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

Date: Thu, 8 Jul 2004 06:31:07 +0000 (UTC)
From: "David H. Adler" <dha@panix.com>
Subject: Re: sorting hash based on keys and  replacing them  in the same hash
Message-Id: <slrncepqhb.bf.dha@panix2.panix.com>

On 2004-07-07, Scott J <scottjou@farnell.ns.ca> wrote:
> On Wed, 17 Mar 2004 08:12:04 -0600, "yamini" <yamini_rajan@nospam.com>
> wrote:
>
>>hi,
>>
>>%h=("z","zebra","a","alive","y","yahoo");
>> foreach $key (sort(keys %h)) {
>>        print $key, '=', $h{$key}, "\n";
>>}
>>now it prints in the sorted order.But i want to replace the old keys with sorted keys, in the hash named %h ,with their respective values.
>>Is there any way?
>>
>
> So in other words you want to sort your hash and keep it sorted??
>
> This is redundant and as far as I know, not possible. Hash variables
> are unsorted by definition.

On the other hand, it's a FAQ:
	How can I always keep my hash sorted?

 ...so there must be *some* use for it. :-)

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
perl -e '$"=q-Just Another Perl Hacker-; push @x, $_ for (qw+* *+);
print "@x\n"' #requires perl 5.004_05 or later


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

Date: Thu, 08 Jul 2004 01:48:32 -0400
From: Ken Sington <ken_sington@nospam_abcdefg.com>
Subject: Re: what do you call funct ( funct())
Message-Id: <O9-dnb-iTs6GfXHdRVn-jg@speakeasy.net>

Brad Baxter wrote:

> On Wed, 7 Jul 2004, Ken Sington wrote:
> 
 ...
> 
> But what are you asking?
> 

I mean, the fact that you can run a function inside that ternary, inside
that if. the fact that you can run a function inside a control structure.

is there a name for the concept?
If I wanted to explain to someone that you can do those things, what would I call this topic?

> Regards,
> 
> Brad


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

Date: 7 Jul 2004 23:12:19 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: what do you call funct ( funct())
Message-Id: <40ece5c3@news.victoria.tc.ca>

Ken Sington (ken_sington@nospam_abcdefg.com) wrote:
: Brad Baxter wrote:

: > On Wed, 7 Jul 2004, Ken Sington wrote:
: > 
: ...
: > 
: > But what are you asking?
: > 

: I mean, the fact that you can run a function inside that ternary, inside
: that if. the fact that you can run a function inside a control structure.

: is there a name for the concept? : If I wanted to explain to someone
that you can do those things, what would I call this topic?

perhaps you want words like

	grammar

	syntax 

	semantics

	expressions

	operators

	operator precedence

	LL(1) LALR(1) (and some other similar acronyms)
	
	parsers


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

Date: Thu, 08 Jul 2004 08:38:53 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: what do you call funct ( funct())
Message-Id: <cciq1e$2gp$2@nntp.fujitsu-siemens.com>

Ken Sington wrote:
> Brad Baxter wrote:
>=20
>> On Wed, 7 Jul 2004, Ken Sington wrote:
>>
> ...
>=20
>>
>> But what are you asking?
>>
>=20
> I mean, the fact that you can run a function inside that ternary, insid=
e
> that if. the fact that you can run a function inside a control structur=
e.
>=20
> is there a name for the concept?
> If I wanted to explain to someone that you can do those things, what=20
> would I call this topic?

orthogonality?

This means that there are rules that describe what you can do and there=20
are very few (down to "no") exceptions to these rules.
Like: "a function can return a value and this value can be used in an=20
expression" and "the condition of a conditional operator is an expression=
".
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett



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

Date: Thu, 8 Jul 2004 09:39:59 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: what do you call funct ( funct())
Message-Id: <ccj4m1$p2e$1@news.simnet.is>

"Ken Sington" <ken_sington@nospam_abcdefg.com> wrote in message
news:O9-dnb-iTs6GfXHdRVn-jg@speakeasy.net...
> Brad Baxter wrote:
>
> > On Wed, 7 Jul 2004, Ken Sington wrote:
> >
> ...
> >
> > But what are you asking?
> >
>
> I mean, the fact that you can run a function inside that ternary, inside
> that if. the fact that you can run a function inside a control structure.
>
> is there a name for the concept?
> If I wanted to explain to someone that you can do those things, what would
I call this topic?

you are thinking on expressions.

the if() test is a boolean expression. funtion calls are allowed
in expressions. some languages differentiate between procedures and
functions. the difference is that the functions return a value and
can thus be used in expressions.

gnari







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

Date: 8 Jul 2004 07:16:31 -0700
From: bobx@linuxmail.org (Bob)
Subject: What does this do?
Message-Id: <1001ff04.0407080616.626e95b1@posting.google.com>

$|++;

I see that in code but my searches have come up with nothing.

Robert


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

Date: Thu, 8 Jul 2004 17:22:30 +0300
From: "Eugene Mikheyev" <Eugene.Mikheyev@kiev.cms.com.ua>
Subject: Re: What does this do?
Message-Id: <ccjle7$33h$1@news.univ.kiev.ua>

> $|++;
> I see that in code but my searches have come up with nothing.
As $| is a boolean variable, I suspect the one who wrote this thought
incrementing is faster than assigning, i.e. when $x is 0, $x++ is faster
than $x = 1. Maybe I am wrong, this is just an assumption.




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

Date: 08 Jul 2004 16:36:33 +0200
From: pjacklam@online.no (Peter J. Acklam)
Subject: Re: What does this do?
Message-Id: <iscy36ry.fsf@online.no>

bobx@linuxmail.org (Bob) wrote:

> $|++;
> 
> I see that in code but my searches have come up with nothing.

    perldoc perlvar

It is a slightly obscure way of disable output buffering.  The
recommended way is

    $| = 1;

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: Thu, 8 Jul 2004 14:25:24 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: What does this do?
Message-Id: <ccjld5$qt0$1@news.simnet.is>

"Bob" <bobx@linuxmail.org> wrote in message
news:1001ff04.0407080616.626e95b1@posting.google.com...
> $|++;
>
> I see that in code but my searches have come up with nothing.

$| is explained in
    perldoc perlvar

the ++ is just a cute way to set it to a true value. if assumes
the value is not -1

gnari





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

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


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