[25913] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8138 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 1 09:05:32 2005

Date: Wed, 1 Jun 2005 06: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, 1 Jun 2005     Volume: 10 Number: 8138

Today's topics:
        Can I use OODoc to create a paragraph with a mix of bol <daveandniki@ntlworld.com>
        Editors that use Perl as their macro language <dhannotte@nyc.rr.com>
    Re: Editors that use Perl as their macro language <spamtrap@dot-app.org>
    Re: Editors that use Perl as their macro language <tadmc@augustmail.com>
    Re: File::Find and tree copying (Anno Siegel)
    Re: numbers and strings and regex? <geoff.cox@notquitecorrectfreeuk.com>
    Re: writing to file <josef.moellers@fujitsu-siemens.com>
    Re: writing to file <bart.lateur@pandora.be>
    Re: writing to file <mark.clementsREMOVETHIS@wanadoo.fr>
    Re: writing to file <josef.moellers@fujitsu-siemens.com>
    Re: writing to file <mark.clementsREMOVETHIS@wanadoo.fr>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 01 Jun 2005 10:46:45 GMT
From: "Dave" <daveandniki@ntlworld.com>
Subject: Can I use OODoc to create a paragraph with a mix of bold and normal text?
Message-Id: <pmgne.4457$%21.2207@newsfe2-gui.ntli.net>

I have a fairly complex Perl script that reads in data from an XML file 
processes it and writes it to a text file. This works well. I now wish to 
make some words bold, italic, superscript etc. On a Win32 platform I could 
automate MSWord to do this but I would like it to be portable, so I would 
prefer to produce an OOo document.

I have installed the OODoc module tested it. All fine

I have found the documentation sparse and confusing and cannot fathom how to 
make it append formatted text to a paragraph. I want to say 'append this 
string in bold', 'append this string in italics', 'append this string as a 
superscript' etc. I assume I need to use the 'appendText' method with 
appropriate options but I can't see an example of its usage.

Can suggest the syntax I need?

Would I be better off using RTF::Writer?

Dave






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

Date: Wed, 01 Jun 2005 10:38:34 GMT
From: "Dean Hannotte" <dhannotte@nyc.rr.com>
Subject: Editors that use Perl as their macro language
Message-Id: <Kegne.15014$IX4.11673@twister.nyc.rr.com>
Keywords: macro language

I have been using Mansfield Software's KEDIT, which was based on IBM's
XEDIT, every day for 25 years. I love it, but the macro language is a
lifeless subset of Rexx. Does anyone know if any serious text editors use
embedded Perl as their macro language? That would be insanely great.

--

Dean Hannotte
http://www.hannotte.net




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

Date: Wed, 01 Jun 2005 06:54:53 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Editors that use Perl as their macro language
Message-Id: <I5KdnRgJKdNjDgDfRVn-sw@adelphia.com>

Dean Hannotte wrote:
> I have been using Mansfield Software's KEDIT, which was based on IBM's
> XEDIT, every day for 25 years. I love it, but the macro language is a
> lifeless subset of Rexx. Does anyone know if any serious text editors use
> embedded Perl as their macro language? That would be insanely great.

We heard you the first time.

sherm--

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


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

Date: Wed, 1 Jun 2005 07:52:07 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Editors that use Perl as their macro language
Message-Id: <slrnd9rbrn.qbn.tadmc@magna.augustmail.com>

Sherm Pendley <spamtrap@dot-app.org> wrote:
> Dean Hannotte wrote:
>> I have been using Mansfield Software's KEDIT, which was based on IBM's
>> XEDIT, every day for 25 years. I love it, but the macro language is a
>> lifeless subset of Rexx. Does anyone know if any serious text editors use
>> embedded Perl as their macro language? That would be insanely great.
> 
> We heard you the first time.


But the headers have been corrected this time.   :-)


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


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

Date: 1 Jun 2005 10:19:37 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: File::Find and tree copying
Message-Id: <d7k23p$fe9$1@mamenchi.zrz.TU-Berlin.DE>

Anonymous <dot.dot@dot.dot.dot> wrote in comp.lang.perl.misc:
> As usually, my apologies for the newbie type question from an infrequent
> user.
> 
> I have a directory tree (path is $tree0), and I would like to duplicate the
> tree structure into two other tree roots ($tree1 and $tree2). I want to
> process the files in the original tree with two different subroutines, call
> them Process1 and Process2 so that the files in the duplicated trees are not
> really exact copies but versions produces by Process1(individualFile) and
> Process2(individualFile).

Calling the operations Process1 and Process2 adds nothing to help us
understand your problem.  What do Process1 and Process2 expect as an
argument (individualFile)?  An open filehandle?  A file name? File content
as a single multiline string?  A list of strings?  And how do they deliver
the modified file?  As a string?  A list of lines?  Does it write it to
disk somewhere?  Without that information, "Process1(individualFile)" is
nothing but claptrap (and not even Perl claptrap at that).

I'll assume that Process1() has two arguments, one the name of the
original file and the other the name of the new file to write, so a
call would look like

    Process1( $original, $new);

> I can find my way down the original tree OK using File::Find, get the name
> ($File::Find::name) (.... this is progress for a novice, so don't laugh) and
> do something with the file. But duplicating the structure has me completely
> baffled.
> 
> #!/bin/perl

No strict, no warnings!

> use File::Find;
> my $tree0="c:\\k\\origtree";
> 
> # Find the original files
>   find(\&processAllFiles, $tree0);
> 
> # Subroutine that decends the tree.
> sub processAllFiles{
>     print "$File::Find::name\n";
> 
>     # HELP HELP
> }

I'll pretend you have only one target tree $root1 and only one file-
modifying process.

You'll have to do different things depending on whether the file in
$File::Find::name is a directory or a normal file.  If it is a directory,
crate the "parallel" directory in $tree1.  If it is a file, the target
directory will already have been created, just call Process1 with the
original and new names.

For both actions you'll want to change (the initial) part of a path
name to something else.  This applies to directories as well as files,
so it's a candidate for a subroutine.  Untested:

    #!/usr/bin/perl
    use strict; use warnings;
    use File::Find;
    use Errno qw( EEXIST);  # perldoc Errno for more

    my $tree0 = '...'; # substitute your...
    my $tree1 = '...'; # ...actual locations

    find sub {
        if ( -d ) {
            my $dir = change_path( $File::Find::Name, $tree0, $tree1);
            mkdir $dir or $!{ EEXIST} or die "Can't create directory $dir: $!";
        } else {
            my $out = change_path( $File::Find::Name, $tree0, $tree1);
            Process1( $File::Find::name, $out);
        }
    }, $tree0;

    sub change_path {
        my ( $path, $old_prefix, $new_prefix) = @_;
        die "'$path' doesn't begin with '$old_prefix'" if
            index( $path, $old_path) != 0;
        substr( $path, 0, length $old_prefix) = $new_prefix;
        $path;
    }

Anno


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

Date: Wed, 01 Jun 2005 07:59:36 GMT
From: Geoff Cox <geoff.cox@notquitecorrectfreeuk.com>
Subject: Re: numbers and strings and regex?
Message-Id: <pjqq91hhq00te4udbj952gtit24s0cc1s0@4ax.com>

On Tue, 31 May 2005 22:05:52 +0100, Brian McCauley <nobull@mail.com>
wrote:

>OK, let's break if down...
>
>0 is the number zero.
>
>+ is the numeric addition operator.
>
>$1 is the captured string and since the capture was (\d{2}) it will be 
>string like '01' or '07' or '42' or something like that.
>
>Adding zero to a number does not change it.
>
>But Perl has automatic type coercion so adding zero to a string tells 
>Perl to coerce the string into a number.
>
>Hense 0+'42' is the number 42 and 0+'07' is the number 7.

Thanks Brian - I understand ..

Cheers

Geoff










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

Date: Wed, 01 Jun 2005 09:28:03 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: writing to file
Message-Id: <d7jnt7$n9c$1@nntp.fujitsu-siemens.com>

Huub wrote:
> Hi,
>=20
>  From what I've read I should be able to write to a file by just this:
>=20
> $OUTPUT_FILE =3D UITBESTAND;
> open($OUTPUT_FILE, ">UITBESTAND");

Auto-vivifying of filehandles only works if the variable is undefined:

my $OUTPUT_FILE =3D undef;
open($OUTPUT_FILE, ">UITBESTAND");
print $OUTPUT_FILE "Hallo, beste mensen\n";
close $OUTPUT_FILE;

Also note that your code definitely doesn't compile under strict=20
(Bareword "UITBESTAND" not allowed while "strict subs"), so your posting =

violates a major rule of this ng.

> close($OUTPUT_FILE);
>=20
> Yet, nothing is written so I assume I do something wrong. I just can't =

> make out what.

You don't write anything!

Please post a minimal non-working code sequence that compiles and shows=20
your problem.

--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett



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

Date: Wed, 01 Jun 2005 08:56:10 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: writing to file
Message-Id: <2stq91pp64ls49tia9hm46666po9v6o8qa@4ax.com>

Josef Moellers wrote:


>>  From what I've read I should be able to write to a file by just this:
>> 
>> $OUTPUT_FILE = UITBESTAND;
>> open($OUTPUT_FILE, ">UITBESTAND");
>
>Auto-vivifying of filehandles only works if the variable is undefined:
>
>my $OUTPUT_FILE = undef;
>open($OUTPUT_FILE, ">UITBESTAND");

Eh, right. Now the OP's code will use a global variable with the name of
"UITBESTAND" (in the current package) as a handle. It actually counts as
a symbolic reference.

-- 
	Bart.


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

Date: 01 Jun 2005 09:25:30 GMT
From: "Mark Clements" <mark.clementsREMOVETHIS@wanadoo.fr>
Subject: Re: writing to file
Message-Id: <429d7f0a$0$1255$8fcfb975@news.wanadoo.fr>

Bart Lateur wrote:

> Josef Moellers wrote:
> 
> 
> >>  From what I've read I should be able to write to a file by just this:
> >> 
> >> $OUTPUT_FILE = UITBESTAND;
> >> open($OUTPUT_FILE, ">UITBESTAND");
> > 
> > Auto-vivifying of filehandles only works if the variable is undefined:
> > 
> > my $OUTPUT_FILE = undef;
> > open($OUTPUT_FILE, ">UITBESTAND");
> 
> Eh, right. Now the OP's code will use a global variable with the name of
> "UITBESTAND" (in the current package) as a handle. It actually counts as
> a symbolic reference.

It's a lexical variable, not a global. This is a common way of opening a 
file, though setting it to undef in the declaration is unneccessary.

Mark


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

Date: Wed, 01 Jun 2005 11:34:58 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: writing to file
Message-Id: <d7jva2$4ar$1@nntp.fujitsu-siemens.com>

Mark Clements wrote:
> Bart Lateur wrote:
>=20
>=20
>>Josef Moellers wrote:
>>
>>
>>
>>>> From what I've read I should be able to write to a file by just this=
:
>>>>
>>>>$OUTPUT_FILE =3D UITBESTAND;
>>>>open($OUTPUT_FILE, ">UITBESTAND");
>>>
>>>Auto-vivifying of filehandles only works if the variable is undefined:=

>>>
>>>my $OUTPUT_FILE =3D undef;
>>>open($OUTPUT_FILE, ">UITBESTAND");
>>
>>Eh, right. Now the OP's code will use a global variable with the name o=
f
>>"UITBESTAND" (in the current package) as a handle. It actually counts a=
s
>>a symbolic reference.
>=20
>=20
> It's a lexical variable, not a global. This is a common way of opening =
a=20
> file, though setting it to undef in the declaration is unneccessary.

ACK, but
1. one never knows,
2. I have set it to undef explicitly to document the fact
3. see 1.

Josef
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett



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

Date: 01 Jun 2005 10:04:38 GMT
From: "Mark Clements" <mark.clementsREMOVETHIS@wanadoo.fr>
Subject: Re: writing to file
Message-Id: <429d8835$0$3138$8fcfb975@news.wanadoo.fr>

Josef Moellers wrote:

> Mark Clements wrote:
> > Bart Lateur wrote:
> > 
> > 
> > > Josef Moellers wrote:
> > > 
> > > 
> > > 
> >>>> From what I've read I should be able to write to a file by just this:
> > > > > 
> > > > > $OUTPUT_FILE = UITBESTAND;
> > > > > open($OUTPUT_FILE, ">UITBESTAND");
> > > > 
> > > > Auto-vivifying of filehandles only works if the variable is undefined:
> > > > 
> > > > my $OUTPUT_FILE = undef;
> > > > open($OUTPUT_FILE, ">UITBESTAND");
> > > 
> > > Eh, right. Now the OP's code will use a global variable with the name of
> > > "UITBESTAND" (in the current package) as a handle. It actually counts as
> > > a symbolic reference.
> > 
> > 
> > It's a lexical variable, not a global. This is a common way of opening a 
> > file, though setting it to undef in the declaration is unneccessary.
> 
> ACK, but
> 1. one never knows,
> 2. I have set it to undef explicitly to document the fact
> 3. see 1.
> 
Understood :), though I also neglected to mention that it's not 
a symbolic reference.

Mark


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

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


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