[16740] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4152 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 28 14:06:51 2000

Date: Mon, 28 Aug 2000 11:05:32 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <967485931-v9-i4152@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 28 Aug 2000     Volume: 9 Number: 4152

Today's topics:
        [ANNOUNCE] XML::XPath 0.99 <matt@sergeant.org>
    Re: A Proposal for BaseLib module <mischief@motion.thispartfake.net>
        A view from their side(was: selling perl to management) <smerr612@mailandnews.com>
    Re: A view from their side(was: selling perl to managem (Marcel Grunauer)
    Re: A view from their side(was: selling perl to managem <bart.lateur@skynet.be>
    Re: A view from their side(was: selling perl to managem <smerr612@mailandnews.com>
    Re: Bulk add to a hash.. Any ideas? (brian d foy)
    Re: Bulk add to a hash.. Any ideas? <bart.lateur@skynet.be>
        cgi.pm script fine under 98, but hidden values not retu (Eric White)
    Re: Debugging tools <gellyfish@gellyfish.com>
    Re: directory where perl script is <mtaylorlrim@my-deja.com>
    Re: directory where perl script is <Peter.Dintelmann@dresdner-bank.com>
    Re: directory where perl script is (Martien Verbruggen)
    Re: directory where perl script is (Martien Verbruggen)
    Re: Evenlog module <amonotod@netscape.net>
    Re: format and padding <gellyfish@gellyfish.com>
    Re: format and padding <sariq@texas.net>
    Re: Formatting text (CGI) <brock_johnson@my-deja.com>
    Re: Golf: Date of Easter (Keith Calvert Ivey)
    Re: Golf: Date of Easter (Marcel Grunauer)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 28 Aug 2000 15:49:01 +0100
From: Matt Sergeant <matt@sergeant.org>
Subject: [ANNOUNCE] XML::XPath 0.99
Message-Id: <sql20am9t9159@corp.supernews.com>

This release fixes bugs associated with running under Perl 5.6. See the
recent 0.98 announcement for details of what XML::XPath does.

-- 
<Matt/>

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org




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

Date: Mon, 28 Aug 2000 11:43:06 -0500
From: "Chris Stith" <mischief@motion.thispartfake.net>
Subject: Re: A Proposal for BaseLib module
Message-Id: <sql5jv7st9127@corp.supernews.com>


"Hasanuddin Tamir" <hasant@trabas.co.id> wrote in message
news:slrn8qdmj0.oao.hasant@borg.intern.trabas.co.id...
> On 25 Aug 2000 14:20:58 -0400, mthurn@tasc.com wrote:

> But I can't use `use lib LIST;' in BaseLib since it will defeat
> the previous steps. Instead, I simply unshift the full path to
> libdir to @INC manually. So, in your words, I do,

push, unshift, whatever. depends upon where you want it in the
array. The pragma use list does put it at the beginning, BTW.

>     use lib '/full/path/to/mail2sms/libdir';
>
> but not,
>
>     use lib '/full/path/to/mail2sms';

So what you're saying is you want to concatenate the $baselib and
the $libdir. That's easy enough. (BTW, I did leave chop()ping the
newline out of the configuration file as an exercise to the reader in
my last post. I considered it a bit trivial, and should have included
it for clarity's sake.)

> The script provides the base and lib directories, BaseLib
> takes care the rest.
>
> Let's take a look at the implementation a bit. Please consider
> the following picture (if we may call it so.)
>
>       -.-    [/ROOTDIR] <--+ C         -.-
>        |     `--+          |     B      | D
>        |        `-[/BASEDIR] <---+      |
>        |          `-+            |      |
>        |            `-[/LIBDIR]  |     -.-
>      A |            |            |
>       -.-           `-[/SCRIPTDIR]
>                       |
>                       `--[/SCRIPT.pl]
>
> SCRIPT.pl passes in what to look for (BASEDIR and LIBDIR)
> to BaseLib. If any or both of arguments missing, BaseLib
> will assume `appl_root' and `lib' respectively. So,
>
>     use BaseLib qw(BASEDIR LIBDIR);
>
> will instruct BaseLib to do its job, which is,
>
> 1. Borrowing the full path to SCRIPTDIR (line A) from the
>    standard FindBin module.
> 2. Searching upward up to BASEDIR (B), preserving full
>    path to it starting from ROOTDIR (C), and forgetting
>    the rest.
> 3. Now that the path is found, the next is down-searching
>    to find LIBDIR (D), constructing the path lib, and put
>    it in @INC.

This is much more clear than what I'd read before (at least to me).
This is more involved than just finding out where the modules are.
This is doing it in an almost seamless way. Earlier in the discussion,
I thought you were concerned with the names of the base directory
and the library directory changing. From this example, it seems
more that these will be constant from a certain node down, and
that yuo are interesting in finding where that common parent node
happens to be in the overall file system. This makes more sense to
me why you'd want to do the extra work. If someones moves the
entire directory tree holding all the subdirectories, but does not
change the names of any of the subdirectories therein, then this
indeed could be a pretty handy package to use.

The solutions offered by myself and others addressed a slightly different
situation. I still think this could be done using relative
directories, but it's making more sense to use FindBin and continue
from there now that I see the scope and focus of your problem
and proposed solution are different from what I previously thought.

> It's that simple, IMHO.

Now that I think I understand your particular purpose, it does
seem that your argument is pretty simple, valid, and also relevant.
I must admit, I'm not sure where the communication error was, but
what seems to have caused so much dissension was not your
argument, but the point from which you were perceived to be starting.

To be honest, I personally don't remember the specifics of how
your implementation is coded after the weekend, but your explanation of how
it is implemented (as I understand your proposal currently) seems to be a
sensible way to do what you want.

Chris Stith
mischief@motion.net  mischief@pikenet.net
mr_mischief1@hotmail.com





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

Date: Mon, 28 Aug 2000 15:27:58 GMT
From: Steven Merritt <smerr612@mailandnews.com>
Subject: A view from their side(was: selling perl to management)
Message-Id: <8oe0dd$btb$1@nnrp1.deja.com>

A lot of people have given you really good replies and ammo to use in
your presentation.  That having been said, I have a litle insight to
offer into what management may be thinking.  Here's my company's
official position on Perl.  The names have been changed to protect the
presumed innocents.

[Begin]
(Group name of the body which evaluates new technologies for use within
the company) Position Paper on Perl.

Feb 28, 2000

Recommendation

(WE) do not recommend Perl to be used within _____ as a language for
extensive application development.  Perl is an interpreted language best
suited for use with a command line interface(Unix).  Perl does not port
well to other platforms and does not allow for extensive scalability of
applications.  For all application development where Perl may be
considered (WE) have certified and recommend JAVA as _____'s Development
language of choice.  This having been said, Perl is optimized for
scanning arbitrary text files, extracting informatino and printing
reports.  In situations where large volume/high transaction data needs
to be intrepreted and utilized via scripting, Perl may be a good choice.
If Perl is to be considered for use please review the standards section
below for the implications of using Perl or any other "freeware"
application within _____.

Overview
Architecture

(WE) have certified JAVA as the development language of choice in most
areas where Perl may be utilized, however it is recognized that JAVA may
have certain shortcomings in the area of high transaction processing. In
this "niche" a scripting language such as Perl may be a "best solution"
provided proper steps are taken to grant the exception needed to utilize
it.

Standards

Perl is not currently certified to be used within _____.  Additionally
because of it's status as a "freeware" application certain issues need
to be addressed if a group is looking to obtain an exception to utilize
it. First plese contact corporate legal and get authorization to use
this freeware application within your group. Next please identify which
group will support Perl for you on a 24/7 basis (note: corporate IT will
not support any freeware applications). If both these issues have been
addressed please contact (US) for additional information on processing
an exception.

Evaluation Methods

Current published opinions from the Gartner Group and GIGA where taken
into account when preparing this position. In addition _____ corporate
legal opinions involving freeware where addressed.

Tactical Evaluation
Acceptable Alternatives.

Application development:  JAVA

Conclusion

Perl is not the best choice for full application development but can
serve as a good tool for scripting in a high transaction situation where
JAVA may be to costly to develop or to slow to process.

[END]

Any typos in the above I take responsibility for.  Any grammatical or
usage errors are the fault of the original writer.

IMNVHO this is a fairly heads-up assessment of Perl for a shop the size
of the one I'm in.(Fortune 100)  Typically these businesses have to have
contracts and support deals for everything they do.  It's the whole, "I
have this piece of paper that says I'm Y2K compliant, I'll sue you if
anything breaks!" type of mindset.  Of course any business without this
attitude would quickly lose stockholders.  I'm not sure it's a great
environment for fostering growth and innovation, but it seems to be the
business model everyone is using.  In the meantime everyone in my
department seems to completely ignore this position and we use tools
written in Perl for a good number of our daily tasks.  It doesn't hurt
that we have a pretty OSS-Aware Network Admin who keeps Perl
distributions in good shape and the modules we need installed properly
and all that good stuff.

Steven
--
King of Casual Play
The One and Only Defender of Cards That Blow

My newsreader limits sigs to four lines, but I cleverly bypassed this by


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 28 Aug 2000 16:26:59 GMT
From: marcel@codewerk.com (Marcel Grunauer)
Subject: Re: A view from their side(was: selling perl to management)
Message-Id: <slrn8ql4m6.28f.marcel@gandalf.local>

On Mon, 28 Aug 2000 15:27:58 GMT, Steven Merritt
<smerr612@mailandnews.com> wrote:

>A lot of people have given you really good replies and ammo to use in
>your presentation.  That having been said, I have a litle insight to
>offer into what management may be thinking.  Here's my company's
>official position on Perl.  The names have been changed to protect the
>presumed innocents.
>
>[Begin]
[PHB-compliant drivel effectively saying "(We) like Java. (We) don't
like Perl."]
>[END]
>
>Typically these businesses have to have
>contracts and support deals for everything they do.  It's the whole, "I
>have this piece of paper that says I'm Y2K compliant, I'll sue you if
>anything breaks!" type of mindset.  Of course any business without this
>attitude would quickly lose stockholders.  I'm not sure it's a great
>environment for fostering growth and innovation, but it seems to be the
>business model everyone is using.

Well, there are a few, but not (to my knowledge) many commercial Perl
support options. This reminds me that I've wanted to write something
like a perladvocacy.pod, and since management types seem to like that
sort of thing, some White Papers on Perl, some targeted at management,
some at developers. The management WPs might be buzzword-compliant.

Does that sound like a feasible course of action or has it been tried
and/or found unnecessary before?

>In the meantime everyone in my
>department seems to completely ignore this position and we use tools
>written in Perl for a good number of our daily tasks.  It doesn't hurt
>that we have a pretty OSS-Aware Network Admin who keeps Perl
>distributions in good shape and the modules we need installed properly
>and all that good stuff.

That's good to hear, but it's still management who spends the money and
who places the job ads.

-- 
Marcel Gr\"unauer - Codewerk plc . . . . . . . . . . . <http://www.codewerk.com>
Perl Consulting, Programming, Training, Code review . . .  <marcel@codewerk.com>
mod_perl, XML solutions - email for consultancy availability
sub AUTOLOAD{($_=$AUTOLOAD)=~s;^.*::;;;y;_; ;;print} Just_Another_Perl_Hacker();


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

Date: Mon, 28 Aug 2000 16:34:11 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: A view from their side(was: selling perl to management)
Message-Id: <p15lqs4015tm5vt4rnicqvaiu9qh4i8pt3@4ax.com>

Steven Merritt wrote:

>Perl is not currently certified to be used within _____.  Additionally
>because of it's status as a "freeware" application certain issues need
>to be addressed if a group is looking to obtain an exception to utilize
>it.

And Java is not "freeware"? Did YOU pay for it?

Commercial support for Perl IS available.

-- 
	Bart.


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

Date: Mon, 28 Aug 2000 17:49:11 GMT
From: Steven Merritt <smerr612@mailandnews.com>
Subject: Re: A view from their side(was: selling perl to management)
Message-Id: <8oe8mf$mcn$1@nnrp1.deja.com>

In article <p15lqs4015tm5vt4rnicqvaiu9qh4i8pt3@4ax.com>,
  Bart Lateur <bart.lateur@skynet.be> wrote:
> Steven Merritt wrote:
>
> >Perl is not currently certified to be used within _____.
Additionally
> >because of it's status as a "freeware" application certain issues
need
> >to be addressed if a group is looking to obtain an exception to
utilize
> >it.
>
> And Java is not "freeware"? Did YOU pay for it?
>
> Commercial support for Perl IS available.

I only reproduced the position paper, I'm not in a position to argue
it's conclusions or assumptions.  I'm not even sure who to talk to about
it if I find glaring errors or bad assumptions.  We can tear this thing
to shreds in this forum and it won't matter one iota, because it's still
law as far as the PHBs are concerned.  It will remain so unless we can
talk to the  people who the PHBs listen to.  We all know they don't
listen to the developers. Feel free to pick this thing apart, I'd
encourage it actually, eventually I might find someone in the (WE)
orginization and be able to show the arguements to them, but if you do,
please remember the context and quote the [Begin] and [End] block
markers so people know this isn't my opinion.

Steven
--
King of Casual Play
The One and Only Defender of Cards That Blow

My newsreader limits sigs to four lines, but I cleverly bypassed this by


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 28 Aug 2000 11:37:46 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Bulk add to a hash.. Any ideas?
Message-Id: <brian-ya02408000R2808001137460001@news.panix.com>

In article <1eg2qv3.60p37ppyqryaN@[192.168.88.117]>, sumus@aut.dk (Jakob Schmidt) posted:

> brian d foy <brian@smithrenaud.com> wrote: 
> >
> > [ you snipped the good parts! ]
> 
> Some guys have all the luck :-)
>  
> > > Well if you're going to add a 'bulk' (sounds like at least a dozen k-v
> > > pairs to me) it'll enhance readability hugely IMHO.
> > 
> > then, i would suggest that a slice is not a good way to do it
> > (from a readability perspective).

> I suppose you like

> In article <8oc336$8um$1@nnrp1.deja.com>,  <alphazerozero@my-deja.com>
> wrote:
> >$hash->{'key3'}="value3";  #however this
> >$hash->{'key4'}="value4";  #does... But surely its more verbose than
> 
> better (from a readability perspective)?

are you being a smart-ass on purpose?

if you have a large number of keys and values to add, i think
it's much better to somehow put the keys next to the values.  if
you have two different lists (keys and values) in different
places in the program, then it's very difficult to see which
key goes with which value.

i would use a temporary hash and then merge it with the other
hash (using your favorite merge method):

   {
   my %hash = (
      key => value,
      key => value,
      key => value,
      );

   @other_hash{ keys %hash } = values %hash;
   }

as for wasting cycles, i think development and maintenance
thought cycles should count as well.  if you are worreid about
a tight memory situation, Perl might not be the right tool.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>


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

Date: Mon, 28 Aug 2000 16:01:18 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Bulk add to a hash.. Any ideas?
Message-Id: <d53lqs4rnutd0gb9pirl19mt6ac3uuq7mc@4ax.com>

alphazerozero@my-deja.com wrote:

>I am curious if anyone knows a shortcut to adding to a hash.

	%hash = (%hash, key1 => 'value1', key2 => 'value2');

or a hash slice, which appears to be a bit faster.

-- 
	Bart.


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

Date: Mon, 28 Aug 2000 17:15:41 GMT
From: ewhite@ssc.wisc.edu (Eric White)
Subject: cgi.pm script fine under 98, but hidden values not returned under NT (?)
Message-Id: <8oe6bv$kos$1@news.doit.wisc.edu>

Hello All,

(I realize this is more of a cgi question rather than a perl question,
but maybe someone here knows the answer?  I've also posted
this to comp.infosystems.www.authoring.cgi.)

I'm guessing that the answer to my question is something 
obvious, but I've looked high and low w/o any luck, so here goes:

I've got a series of pages that rely on information being carried over from 
one to the other via the hidden() function.  This all works fine and dandy on 
the win98 machine on my desk, but when I loaded the script to an NT box the 
script acts as if none of the hidden values are being passed from page to 
page. 

The script is written in perl 5.6.  The web server in question is running NT 4 



and Xitami 2.4d7.  

Am I missing something in this setup?  The script compiles under NT so I think 



the script itself is ok, but something's getting dropped somewhere along the 
line...

Any suggestions are greatly appreciated.


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

Date: 28 Aug 2000 12:44:38 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Debugging tools
Message-Id: <8odjb6$e44$1@orpheus.gellyfish.com>

On Mon, 28 Aug 2000 10:42:54 GMT Are Bjoerby wrote:
> 
> I am developing scripts for a server without any debugging modules
> installed.  Is there any tool available that will compile a script
> and check for syntax errors?

perl -c <program>

Usually does the trick.  The Perl debugger can be invoked with perl -d

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Mon, 28 Aug 2000 13:00:13 GMT
From: Mark <mtaylorlrim@my-deja.com>
Subject: Re: directory where perl script is
Message-Id: <8odnoj$1ql$1@nnrp1.deja.com>

Check out the environment variables path_translated, path_info, and
script_name

One of them will give you what you want I think.


Mark


In article <8odn20$13f$1@nnrp1.deja.com>,
  Eric BULEON <beric20@my-deja.com> wrote:
> Hello
>
> I want to know in which directory the currently running Perl script
is.
> How can I do that ?
>
> Thanks
>
> --
> Eric
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

--
Please reply to this newsgroup as my Deja mail
is used as a spam catcher only!


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 28 Aug 2000 15:12:44 +0200
From: "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com>
Subject: Re: directory where perl script is
Message-Id: <8odogj$jtj1@intranews.bank.dresdner.net>

    Hi Eric,

Eric BULEON schrieb in Nachricht <8odn20$13f$1@nnrp1.deja.com>...
>I want to know in which directory the currently running Perl script is.
>How can I do that ?

    use the FindBin module. $FindBin::Bin
    contains what you are looking for.

    Best regards,

        Peter Dintelmann






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

Date: Tue, 29 Aug 2000 00:28:28 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: directory where perl script is
Message-Id: <slrn8qkq7r.sk8.mgjv@martien.heliotrope.home>

On Mon, 28 Aug 2000 12:48:07 GMT,
	Eric BULEON <beric20@my-deja.com> wrote:
> Hello
> 
> I want to know in which directory the currently running Perl script is.
> How can I do that ?

Your question is ambiguous:

Do you

1) Want to find out in which directory your program is running?

    use the Cwd module

    perldoc Cwd

2) Want to find out in which directory the sources of your program live?

    This is answered in the FAQ documentation:

    perldoc perlfaq8
    [snip]
        How do I add the directory my program lives in to the mod­
        ule/library search path?
    [snip]


Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Hi, Dave here, what's the root
Commercial Dynamics Pty. Ltd.   | password?
NSW, Australia                  | 


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

Date: Tue, 29 Aug 2000 00:39:57 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: directory where perl script is
Message-Id: <slrn8qkqtd.sk8.mgjv@martien.heliotrope.home>

[Please, in the future, put your response _after_ the suitably trimmed
text you reply to. It's just more natural, and makes it easier for
everyone to read the post.]

On Mon, 28 Aug 2000 13:00:13 GMT,
	Mark <mtaylorlrim@my-deja.com> wrote:

[Reordered, reformatted and snipped down a bit]

> In article <8odn20$13f$1@nnrp1.deja.com>,
>   Eric BULEON <beric20@my-deja.com> wrote:
> > Hello
> >
> > I want to know in which directory the currently running Perl script is.
> > How can I do that ?
>
> Check out the environment variables path_translated, path_info, and
> script_name
> 
> One of them will give you what you want I think.

I doubt it. 

Your variable names look somewhat like the environment variables that
are defined for the CGI. They are not the same. The CGI specifies
SCRIPT_NAME, PATH_INFO and PATH_TRANSLATED. Case matters. But, Perl is
not CGI.

The OP asked how to find out in which directory a Perl program is
located or running (ambiguity). Perl does not set any environment
variables related to that information.

See other posts for correct answers.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | The world is complex; sendmail.cf
Commercial Dynamics Pty. Ltd.   | reflects this.
NSW, Australia                  | 


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

Date: Mon, 28 Aug 2000 16:06:30 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: Evenlog module
Message-Id: <8oe2lj$erl$1@nnrp1.deja.com>

In article <ujp0AdOEAHA.61@net003s>,
  "Johan" <jco@hetnet.nl> wrote:
> I wrote a script to get the eventlog records from several machines.
> All fields in the hash are filled correct except the 'user' field.
> Anybody else who came across this problem and found a solution? I'm
> working with Activestate Perl build 5.6.0 build 616
> thanks in advance,
> Johan

What is the 'user' field filled with?  A funny looking, really long
alphanumeric data?  Check out Win32::LookupAccountSID.  You may want to
check out Dave Roth's site, http://www.roth.net/perl

HTH,
amonotod

--
    `\|||/                     amonotod@
      (@@)                     netscape.net
  ooO_(_)_Ooo________________________________
  _____|_____|_____|_____|_____|_____|_____|_____|


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 28 Aug 2000 12:56:20 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: format and padding
Message-Id: <8odk14$e6s$1@orpheus.gellyfish.com>

On Thu, 24 Aug 2000 18:45:47 GMT JMarsan wrote:
> Hi all,
> 
> I need to create a format. I have a problem with padding. I looked in
> my o'reilly Perl books but could not find any solution to my problem.
> Here is my format:
> 
> format ORDER =
> ---------------------------------------------------------------------
> Order Reference: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>                  $orderref
> Last Name: @<<<<<<<<<<<<<<<<<<<<<<<   First Name: @<<<<<<<<<<<<<<<<<<
> 
> .
> 
> Now my problem is that I can not find a way to avoid the padding with
> white spaces when the last name is shorter than the field. For example,
> I would like to have this output:
> 
> Order Reference: 5192227876
> Last Name: Evans   First Name: Mary
> 
> ... and not this one:
> 
> Order Reference: 5192227876
> Last Name: Evans                      First Name: Mary
> 

I don't think you can do that using formats - though I am an infrequent
user of them.  Probably what you want to do is to format the first name
and last name into a single variable (using simple string interpolation or
possibly sprintf for more control ) including the field labels and then
have a single placeholder in the format.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Mon, 28 Aug 2000 11:45:55 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: format and padding
Message-Id: <39AA9743.C2502C9C@texas.net>

JMarsan wrote:
> 
> Hi all,
> 
> I need to create a format. I have a problem with padding. I looked in
> my o'reilly Perl books but could not find any solution to my problem.
> Here is my format:
> 
> format ORDER =
> ---------------------------------------------------------------------
> Order Reference: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>                  $orderref
> Last Name: @<<<<<<<<<<<<<<<<<<<<<<<   First Name: @<<<<<<<<<<<<<<<<<<
> 
> .
> 
> Now my problem is that I can not find a way to avoid the padding with
> white spaces when the last name is shorter than the field. For example,
> I would like to have this output:
> 
> Order Reference: 5192227876
> Last Name: Evans   First Name: Mary
> 
> ... and not this one:
> 
> Order Reference: 5192227876
> Last Name: Evans                      First Name: Mary

Formats are for formatting.  Sounds like you just want to print.  So
don't use a format.

- Tom


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

Date: Mon, 28 Aug 2000 17:19:29 GMT
From: Brock <brock_johnson@my-deja.com>
Subject: Re: Formatting text (CGI)
Message-Id: <8oe6ub$k43$1@nnrp1.deja.com>

In article
<39a7c383_3@einstien.netscapeonline.co
 .uk>,
  "bretttdonovan"
<bretttdonovan@netscapeonline.co.uk>
wrote:
> Does anyone know how to format text
strings so that I can for example have
> scripts kicking out arial font
instead of default?
>
> Thanks
>
> Brett
>
>
The font tag, though deprecated, is
still more widely recognized (and
backward compatible) than CSS. This is
a guess, but you might try something
like this:
#!/usr/local/bin/perl -w
if ("font") {print "font face='arial'
font;};
Hope I got that syntax correct? NOTE:
The above will only work if font tags
are used in your document, such as
<font color='#339900'> Basically, you
just need to search for a constant and
replace it.

--
The Best to all!
Brock Johnson


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 28 Aug 2000 13:01:39 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Golf: Date of Easter
Message-Id: <39b2616c.64471630@news.newsguy.com>

marcel@codewerk.com (Marcel Grunauer) wrote:

>It would appear the inline condition EXPR1 ? EXPR2 : EXPR3, when EXPR2
>is true, only stretches to the comma in EXPR3, since print() is a list
>operator.

It has nothing to do with print().  The ?: operator has higher
precedence than the , operator, so the comma isn't in EXPR3.
What you have is (EXPR1 ? EXPR2 : EXPR3), EXPR4.

>In any case, this saves a few bytes and doesn't output the extra numbers
>at the end:
>
>    print int 3+$b/31,"/",$b%31;

You save three more bytes by keeping the ?: operator:

     print$b<32?3:4,"/",$b%31;

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: Mon, 28 Aug 2000 14:19:59 GMT
From: marcel@codewerk.com (Marcel Grunauer)
Subject: Re: Golf: Date of Easter
Message-Id: <slrn8qkt72.10e.marcel@gandalf.local>

On Mon, 28 Aug 2000 13:01:39 GMT, Keith Calvert Ivey <kcivey@cpcug.org> wrote:

>marcel@codewerk.com (Marcel Grunauer) wrote:
>
>>It would appear the inline condition EXPR1 ? EXPR2 : EXPR3, when EXPR2
>>is true, only stretches to the comma in EXPR3, since print() is a list
>>operator.
>
>It has nothing to do with print().  The ?: operator has higher
>precedence than the , operator, so the comma isn't in EXPR3.
>What you have is (EXPR1 ? EXPR2 : EXPR3), EXPR4.

Ah, thanks!

It just occurred to me that you can use B::Deparse to see that:

    $ perl -MO=Deparse,-p -e 'print $b<32?"3/$b":"4/",$b-31'
    print((($b < 32) ? "3/$b" : '4/'), ($b - 31));

Interesting to see that perl (not Perl) seems to like double quotes only
when there is something to interpolate, single quotes otherwise. There
was some discussion about this a while ago...


-- 
Marcel Gr\"unauer - Codewerk plc . . . . . . . . . . . <http://www.codewerk.com>
Perl Consulting, Programming, Training, Code review . . .  <marcel@codewerk.com>
mod_perl, XML solutions - email for consultancy availability
sub AUTOLOAD{($_=$AUTOLOAD)=~s;^.*::;;;y;_; ;;print} Just_Another_Perl_Hacker();


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 4152
**************************************


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