[19436] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1631 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 27 21:15:40 2001

Date: Mon, 27 Aug 2001 18:15:21 -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: <998961321-v10-i1631@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 27 Aug 2001     Volume: 10 Number: 1631

Today's topics:
    Re: Perl 101 Question <ibroemer@home.com>
    Re: Perl 101 Question (Logan Shaw)
    Re: Perl 101 Question <davidhilseenews@yahoo.com>
    Re: Perl 101 Question <bart.lateur@skynet.be>
    Re: Perl 101 Question <godzilla@stomp.stomp.tokyo>
        Perl and the Zen of Eval : Or how to avoid bad karma (Michael DuPont)
        Perl in Non-IT Work Environments <jkeen@concentric.net>
        Perl number conversion Utilities <hasting@agere.com>
    Re: Perl number conversion Utilities <tinamue@zedat.fu-berlin.de>
    Re: Perl number conversion Utilities <ashallwani@tsp.ece.mcgill.ca>
    Re: pi <bwalton@rochester.rr.com>
    Re: pl or not pl, that is the question <iltzu@sci.invalid>
        Preliminary task description <tsee@gmx.net>
    Re: Preliminary task description <godzilla@stomp.stomp.tokyo>
    Re: Preliminary task description <tsee@gmx.net>
    Re: Question about GD (Abigail)
        Selecting * on numerous MySQL tables. (Mike Solomon)
    Re: Selecting * on numerous MySQL tables. (Malcolm Dew-Jones)
    Re: Sex or Perl?  Which is better? <bcaligari@fireforged.com>
    Re: Statement modifiers?? <iltzu@sci.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 27 Aug 2001 23:25:14 GMT
From: Jimmy <ibroemer@home.com>
Subject: Re: Perl 101 Question
Message-Id: <3B8AD71B.382DEF6F@home.com>

Hi David,

Thanks very much.  Your script got me half way there, but not quite.  The
desired output was this:

~~~ Begin file
MARY HAD A LITTLE LAMB

Mary had a little lamb,
her fleece was white as snow.
And everywhere that Mary went,
The Lamb was sure to go.

The End.
~~~End file

Your script gave me this:

 ~~~ Begin file
MARY HAD A LITTLE LAMB
Mary had a little lamb,
her fleece was white as snow.
And everywhere that Mary went,
The Lamb was sure to go.
The End.
~~~End file

I was hoping to preserve the blank lines that were intended, which are found
within the text.

I suppose this makes my request a bit more complicated??  What do you think?

Regards,

Jimmy

David Hilsee wrote:

> "Jimmy" <ibroemer@home.com> wrote in message
> news:3B89B609.F3820B82@home.com...
> > Hi all... It's been a few years since I've written, Perl.  And if ever
> > the expression "Use it or loose it" applies, it's in programming!
> >
> > I'm trying to solve what should be a pretty simple problem.  If you can
> > help, please read on.
> >
> > I have a couple of hundred text files that are not formatted very well.
> > Here's an example:
> >
> > ~~~ Begin file
> >
> >
> >                                  MARY HAD A LITTLE LAMB
> >
> >                                  Mary had a little lamb,
> >                                  her fleece was white as snow.
> >                                  And everywhere that Mary went,
> >                                  The Lamb was sure to go.
> >
> >                                  The End.
> >
> >
> >
> > ~~~End file
> >
> > I would like to run a script that will parse these files, and create the
> > following type of format in a new directory:
> >
> > ~~~ Begin file
> >  MARY HAD A LITTLE LAMB
> >
> > Mary had a little lamb,
> > her fleece was white as snow.
> > And everywhere that Mary went,
> > The Lamb was sure to go.
> >
> > The End.
> > ~~~End file
> >
> > So basically, removing unnessecary white spaces and blank lines that
> > precede and follow the text.  One more thing, the blank lines could very
> > well have spaces in them, too.
> >
> > If anybody could show me a simple, easy script that I could run to
> > produce this desired output, I would be most greatful.
> >
> > Thanks very much.
> >
> > Jimmy
> >
>
> Well, the basic idea, as I picture it, is this:
>
> #!/usr/bin/perl -w
> use strict;
>
> my $text;
> { local ($/) = undef;   $text = <DATA>; }
>
> $text =~ s/^\s+//;
>
> $text =~ s/\s+$//;
>
> $text =~ s/^\s+?(?=($|\S))//mg;
>
> print $text;
>
> __DATA__
>
>                                  MARY HAD A LITTLE LAMB
>
>                                  Mary had a little lamb,
>                                  her fleece was white as snow.
>                                  And everywhere that Mary went,
>                                  The Lamb was sure to go.
>
>                                  The End.
>
> The rest should just be a matter of reading the files.
>
> --
> David Hilsee



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

Date: 27 Aug 2001 19:35:32 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Perl 101 Question
Message-Id: <9mep0k$ada$1@charity.cs.utexas.edu>

In article <3B89B609.F3820B82@home.com>, Jimmy  <ibroemer@home.com> wrote:
>Hi all... It's been a few years since I've written, Perl.  And if ever
>the expression "Use it or loose it" applies, it's in programming!
>
>I'm trying to solve what should be a pretty simple problem.  If you can
>help, please read on.
>
>I have a couple of hundred text files that are not formatted very well.
>Here's an example:
>
>~~~ Begin file
>
>
>                                 MARY HAD A LITTLE LAMB
>
>                                 Mary had a little lamb,
>                                 her fleece was white as snow.
>                                 And everywhere that Mary went,
>                                 The Lamb was sure to go.
>
>                                 The End.
>
>
>
>~~~End file
  :
  :
>So basically, removing unnessecary white spaces and blank lines that
>precede and follow the text.  One more thing, the blank lines could very
>well have spaces in them, too.

I'd do it something like this:

	#! /usr/local/bin/perl

	# read all lines of input
	@lines = <>;

	# clean up each line
	foreach (@lines)
	    {
	    # remove newline at end of each string
	    chomp;

	    # remove leading and trailing whitespace
	    s/^\s+//;
	    s/\s+$//;
	    }

	# remove all blank lines from the beginning
	while (length $lines[0])
	{
	    shift @lines;
	}

	# ... and from the end
	while (length $lines[-1])
	{
	    pop @lines;
	}

	# print the cleaned-up version
	print map ("$_\n", @lines);

In case you've forgotten or never ran into it, using -1 as an array
index will get you the last element of the array.

Hope that helps.

  - Logan
-- 
"Our grandkids love that we get Roadrunner and digital cable."
(Advertisement for Time Warner cable TV and internet access, July 2001)


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

Date: Tue, 28 Aug 2001 00:52:17 GMT
From: "David Hilsee" <davidhilseenews@yahoo.com>
Subject: Re: Perl 101 Question
Message-Id: <5XBi7.25183$hT4.7372381@news1.rdc1.md.home.com>


"Jimmy" <ibroemer@home.com> wrote in message
news:3B8AD71B.382DEF6F@home.com...
> Hi David,
>
> Thanks very much.  Your script got me half way there, but not quite.  The
> desired output was this:
>
> ~~~ Begin file
> MARY HAD A LITTLE LAMB
>
> Mary had a little lamb,
> her fleece was white as snow.
> And everywhere that Mary went,
> The Lamb was sure to go.
>
> The End.
> ~~~End file
>
> Your script gave me this:
>
>  ~~~ Begin file
> MARY HAD A LITTLE LAMB
> Mary had a little lamb,
> her fleece was white as snow.
> And everywhere that Mary went,
> The Lamb was sure to go.
> The End.
> ~~~End file
>
> I was hoping to preserve the blank lines that were intended, which are
found
> within the text.
>
> I suppose this makes my request a bit more complicated??  What do you
think?
>
> Regards,
>
> Jimmy
>

Hmm, for some reason both my blank lines that were in between the text had
spaces in them.  Bad test case.

Using this for the last regex works better:

# remove the non-newline spaces starting each line
$text =~ s/^(?:(?=[^\n])\s)+//mg;

--
David Hilsee




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

Date: Tue, 28 Aug 2001 00:53:14 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl 101 Question
Message-Id: <acqlot0or4i35cegqriq8fnfn1iqo86dnt@4ax.com>

Jimmy wrote:

>I was hoping to preserve the blank lines that were intended, which are found
>within the text.

The reason is in this line:

>>	$text =~ s/^\s+?(?=($|\S))//mg;


which is, if I may say so, more complex than necessary.

	$text =~ s/^\s+//mg

would do the same. BTW, why the variable $text? $_ would have been ideal
for this little job. You can drop the silly '$text =~ ' thing then. But,
back to the subject of the day: the reason for the removal of blank
lines is that newlines count as whitespace too, and "leading whitespace"
for a line may well continue into the next line.

So we don't want to match newlines.

	s/^[\t ]+//mg;

After that, you can also remove superfluous empty lines by doing

	s/\n{3,}/\n\n/g;

BTW 

>>	$text =~ s/\s+$//;

also removes the trailing newline. You'll want at least one.

	s/\s+$/\n/;

-- 
	Bart.


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

Date: Mon, 27 Aug 2001 18:02:29 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Perl 101 Question
Message-Id: <3B8AEDA5.AEC88FF1@stomp.stomp.tokyo>

Jimmy wrote:

> I have a couple of hundred text files that are not formatted very well.
> Here's an example:
 
(snipped poem with leading white space and subsequent comments)

topic, format poetry without leading white space.


Every wonder why the author of Mary's Little Lamb
indicates Mary's fleece is white as snow? 

baaaahhhhhh..... Oh MY!


Simple as thinking twice; efficiency twice over.


Godzilla!  Queen Of Semantic Guerrillas.
--

#!perl

print "Content-type: text/plain\n\n";

open (FILEHANDLE, "test.txt");

while (<FILEHANDLE>)
 {
  $_ =~ s/^\s+//;
  $_ =~ s/\s+$//;
  if ($. == 1)
   { $title_length = length ($_);  }
  else
   { $average_length = $average_length + length ($_); }
 }

$average_length = int ($average_length / $.) - 1;
$title_length = $average_length - $title_length;

seek (FILEHANDLE, 0, 0);
$. = 0;

while (<FILEHANDLE>)
 {
  $_ =~ s/^\s+//;
  $_ =~ s/\s+$//;
  if ($. == 1)
   { print " " x $title_length, "$_\n"; }
  else
   { print "$_\n"; }
 }

close (FILEHANDLE);

exit;



CONTENTS test.txt:
___________________

            Star Char

    Twinkle Twinkle Little Star
    How I Wonder What You Are
    If I Reach Out So Very Far
    To Touch You My Little Star
  Will You Burn My Finger To A Char?




PRINTED RESULTS:
________________


         Star Char

Twinkle Twinkle Little Star
How I Wonder What You Are
If I Reach Out So Very Far
To Touch You My Little Star
Will You Burn My Finger To A Char?


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

Date: 27 Aug 2001 14:19:06 -0700
From: mdupont777@yahoo.com (Michael DuPont)
Subject: Perl and the Zen of Eval : Or how to avoid bad karma
Message-Id: <8118d547.0108271319.7f6fc3ca@posting.google.com>

# Oh seeker of Perl Wisdom, 
# do not forget the karma of eval
# find the ZEN of eval.
# dont be fooled : see through the illusion.
# Remember that the code is just in your mind!
sub zen 
  {
    my $thought = shift;
    &$thought;
  };
my $karma=0; # You do start out with no karma!
zen do {
  print q[Oh Perlmonks :
      wisely avoid the endless cycle of karma 
      created by the belief in the form of nibanna
      for the comtemplation of nibanna takes quite 
      much more memory than you can afford in this cycle of karma!
      You will have to learn to see through the endless cycle of forms
to find the essence of being!];

  my $koan = q{ 
           my $program = q[
my $variable = '$karma++;print "OM($karma)\n";eval($variable)';
                   print $variable;
                   my $value =  eval($variable);
                   print $value;
                  ];
           print $program;
           eval $program;
          };
  zen(do{eval $koan});
}
#$this = "copyleft 2001 mdupont";
#bless(\sub {bless \$this,&$that;},"PerlZen");
#reposted from : http://www.perlmonks.org/index.pl?node=Meditations


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

Date: 28 Aug 2001 00:09:03 GMT
From: "James E Keenan" <jkeen@concentric.net>
Subject: Perl in Non-IT Work Environments
Message-Id: <9menev$9lf@dispatch.concentric.net>

The following message was originally posted on comp.lang.perl.moderated.
Ignore duplication, s.v.p.

I would like to hear from people who are employed in jobs where their
official responsibilities are *not* primarily IT-related and who use Perl on
the job.

I'm not paid as a programmer or technologist.  My employers know nothing
about my use of Perl.  But being able to extract information from databases
and reformat it with Perl has been crucial to my success.  Are their other
people out there like me?  If there are, we could exchange information and
experiences with a view toward possibly:

-- establishing a mailing list or newsgroup for Perl in non-IT environments
-- improving our Perl skills and our ability to build a base for Perl in
such environments
-- preparing articles for outlets like perl.org or the Perl Journal about
the use of Perl in such environments

You may reply on or off list.  Thank you very much.

Jim Keenan
Brooklyn, NY
jkeen@concentric.net







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

Date: Mon, 27 Aug 2001 18:00:09 -0400
From: Joseph Hasting <hasting@agere.com>
Subject: Perl number conversion Utilities
Message-Id: <3B8AC2E9.D7D3DB28@agere.com>

Hi,  I spent some time putting these number conversion subroutines
together.  It was very difficult to find the non-printf ways to convert
number formats, so I thought I would share them:

sub dec2hex {return sprintf("%lx ", shift);}
sub hex2dec {return hex(shift);}
sub bin2dec {return unpack("N", pack("B32", substr("0" x 32 . shift,
-32)));}
sub dec2bin {my $str = unpack("B32", pack("N", shift)); $str =~
s/^0+(?=\d)//; return $str;}
sub bin2hex {return dec2hex(bin2dec(shift));}
sub hex2bin {return dec2bin(hex2dec(shift));}


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

Date: 27 Aug 2001 22:37:36 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: Perl number conversion Utilities
Message-Id: <9mei3g$1r6f5$4@fu-berlin.de>

Joseph Hasting <hasting@agere.com> wrote:
> Hi,  I spent some time putting these number conversion subroutines
> together.  It was very difficult to find the non-printf ways to convert
> number formats, so I thought I would share them:

> sub dec2bin {my $str = unpack("B32", pack("N", shift)); $str =~
> s/^0+(?=\d)//; return $str;}

at least that one can be:
sub dec2bin {sprintf "%b", shift} # for perl 5.6 or higher

regards,
tina
-- 
http://www.tinita.de \  enter__| |__the___ _ _ ___
tina's moviedatabase  \     / _` / _ \/ _ \ '_(_-< of
search & add comments  \    \ _,_\ __/\ __/_| /__/ perception
---   Warning: content of homepage hopelessly out-dated   ---


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

Date: Tue, 28 Aug 2001 00:27:50 GMT
From: "Aziz Shallwani" <ashallwani@tsp.ece.mcgill.ca>
Subject: Re: Perl number conversion Utilities
Message-Id: <aABi7.23460$KE4.3093698@carnaval.risq.qc.ca>

Would anybody have a float2bin and bin2float subroutines similar to the
dec2bin and bin2dec subroutines?

thanks
Aziz

"Tina Mueller" <tinamue@zedat.fu-berlin.de> wrote in message
news:9mei3g$1r6f5$4@fu-berlin.de...
> Joseph Hasting <hasting@agere.com> wrote:
> > Hi,  I spent some time putting these number conversion subroutines
> > together.  It was very difficult to find the non-printf ways to convert
> > number formats, so I thought I would share them:
>
> > sub dec2bin {my $str = unpack("B32", pack("N", shift)); $str =~
> > s/^0+(?=\d)//; return $str;}
>
> at least that one can be:
> sub dec2bin {sprintf "%b", shift} # for perl 5.6 or higher
>
> regards,
> tina
> --
> http://www.tinita.de \  enter__| |__the___ _ _ ___
> tina's moviedatabase  \     / _` / _ \/ _ \ '_(_-< of
> search & add comments  \    \ _,_\ __/\ __/_| /__/ perception
> ---   Warning: content of homepage hopelessly out-dated   ---




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

Date: Tue, 28 Aug 2001 00:40:42 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: pi
Message-Id: <3B8AE889.A43A83F2@rochester.rr.com>

mgulde wrote:
 ...
> I am trying to generate pi. For this, I wrote the following script:
 ...
> But with this script, perl can only display 16 digits. How can I make
> this script more efficient (with higher numbers of digits)?
> Is it possible to use formats like "bigInt" or "double" like in
> Pascal?
 ...
> mgulde

Check out the Math::BigFloat module, which is probably already on your
hard drive.
-- 
Bob Walton


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

Date: 27 Aug 2001 19:42:09 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: pl or not pl, that is the question
Message-Id: <998940337.2188@itz.pp.sci.fi>

In article <87elq0v7sv.fsf@abra.ru>, Ilya Martynov wrote:
>
>Ok. On Unix if script is a command (i.e. something executable
>installed in $PATH) I also think that it should not have any postfix
>because user usually doesn't care how command is implemented.  But in
>other cases it can be useful to know if something is Perl, Python,
>Ruby or another language script. At least when I write scripts for
>myself which don't leave my $HOME I always add postfix to them. Also
>it can be convenient to use postfixes when dealing with web server
>configuration.

Same here.  Programs in $PATH should have no extensions.  Scripts under
$HOME get a descriptive suffix, and frequently don't even have the x bit
set, since I normally invoke "perl" explictly to run them.  (And no, I
don't have "." in my path -- why would anyone do such a silly thing?)

For example, ~/perl/google.pl and /usr/local/bin/google are identical.
The former is for tweaking and testing, the latter is in general use.

CGI scripts are a different issue entirely.  I use either ".pl" or no
suffix at all for them, but the reasons for choosing either get pretty
complicated as one considers webserver configuration, making URLs look
as clean as possible, and multiple maintainers.  Often both kinds of
names end up in the same directory on the same server.

Anyone else is free to do as they want, I could hardly care less.

-- 
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real!  This is a discussion group, not a helpdesk.  You post something,
we discuss its implications.  If the discussion happens to answer a question
you've asked, that's incidental."           -- nobull in comp.lang.perl.misc




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

Date: Mon, 27 Aug 2001 20:19:35 +0200
From: "Steffen Müller" <tsee@gmx.net>
Subject: Preliminary task description
Message-Id: <9me2r0$lmc$05$1@news.t-online.com>

This isn't yet complete and not completely up to date, but I'm posting it so
you guys can comment it before I finish.

- The contest is basically a tournament, but works evolutionary.
- It is played through locally for a given number of turns.
- Entries submitted as a perl module.pm file.
- Entries have to follow certain guidelines:
  -> They're basically a class.
  -> and therefore provide certain methods to the platform
     -> such as constructor (and if necessary a destructor!)
     -> and content-specific methods such as:
        -> $entry->move(arguments)
        -> $entry->makeDecision(arguments)
           (for the encounters)
  -> They're passed certain arguments with the method call
     such as:
     -> what they can see on the playing plane (a small 2d
        matrix) for the move method
     -> What decision the opponent made in the last round
        of the encounter.
  -> Though they might include complex logic, they return
     only little and very simple data. For the move method,
     that would be a direction (small integer: 0-7) and for
     the makeDecision method, that would be either a coop
     or a defect flag (for classic PD).
     This makes the problem and task simple to understand
     without restricting the complexity of the entry.
- For every entry, a number of entities (object instances
  in programming terms) is spawned each of which has an
  absolute (and at first random) position on the playing
  ground.
- Each turn, each entity's move(matrix) method is called
  with their current view matrix (see below). The entity
  returns an integer indicating the direction of movement.
  Each entity can move one unit per turn horizontally,
  vertically or diagonal.
- The entities don't know their absolute position. They
  are only passed information on their surroundings.
- The playing ground is a 2-dimensional plane (a list of
  lists) that has a fixed size, but whenever an entity
  steps over its boundaries, it is 'teleported' to the
  other edge of the 'world' without it knowing that.
  It can still see over the edge of the world to the
  other side.
- #UPDATE# This may change:
  The matrix passed to the entities via move looks like
  this:
  0 0 0 0 0
  0 0 0 0 0
  0 0 1 0 0
  0 0 0 0 0
  0 0 0 0 0
  for a range of sight of two units in each direction.
  0 = empty
  1 = self
  2 = enemy
  3 = friendly
  The entities cannot distinguish between different enemy
  strategies.
- Whenever a number of entities meet, a 'fight' or encounter
  is performed:
  -> It lasts for a fixed number of iterations (which are not
     to be confused as the time unit 'turns'. An encounter is
     carried out within one turn after the movement period.)
  -> Regardless of how points are awarded, the entity that
     has the highest score after the encounter assimilates
     the others. That is, they become new instances of the
     winning strategy.
  -> The rules for the encounters still have to be specified.
     Everything that follows in this section is preliminary:
  -> Encounters are carried out as a round-robin tournament.
     That is, each participating entity encounters all others
     (for the given number of iterations).
     By doing that, one can simplify the encounter logic to a
     two-way encounter.
  -> Each iteration, the makeDecision(arguments) method is
     called for both entities. The argument passed to the
     method is whichever decision the opposing entity made in
     the previous iteration. In the first iteration, this
     argument is omitted.
  -> Points are awarded depending on the decisions of the
     opponents:
     -> Both chose cooperation: both get 3 points.
     -> Both chose to defect: both get 1 point.
     -> One chose to cooperate and one chose to defect:
        -> Defecting entity gets 5 points.
        -> Cooperating entity gets no points.
  -> Problem: What if multiple instances (entities) of the same
     strategy meet?
  -> If only two entities of the same entry meet with no
     opponents, they do not fight each other. Nothing happens.
     -> (see below: inter-entity communication)
  -> If a number of entities of the same strategy and any
     opponents meet: (I'm very unsure about this section!)
     -> The tournament could be carried out as normal with
        the entities of the same strategy knowing when they
        confont each other. They could try to adjust their
        encounter-strategy if they meet a mate.
        This way, they *do* have an advantage if they fight
        in couples.
        To limit this advantage, one could ignore any entities
        of a given strategy over a maximum of two. (eg. The third
        mate does not participate but is assimilated if its mates
        lose the fight.)
     -> One could (see above) ignore any additional entities of a
        given strategy.

- Multiple entries allowed per contestant?

Additional possibilities to make the task more complex:
- Inter-entity communication?
  -> One could offer another layer of complexity by allowing the
     programmers to implement some sort of inter-entity
     communication. Because programmers could do different
     implementations of the communication (no specification coming
     from us!), only intra-'species' communication is allowed.
     Entities can only talk to mates, not foes.
     Whenever two mates meet, (and) before any encounter is carried out,
     they get the opportunity to exchange any data.
     For example, if a certain strategy implemented a counter how
     many points an entity gathered in its life (or how many turns
     it lasted), the meeting entities could compare their variables
     and use the comparison to decide which of the two is to win the
     tournament. Now, the one that isn't supposed to can cooperate
     when they encounter each other, and the other one always defects
     giving it an edge over the competition.
     One could also compare movement patterns to form clusters of
     entities to give them an edge in competition.
     This option would really make the contest a competition... and
     programming the platform a pain!

Puh, I'm done for now.

Steffen




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

Date: Mon, 27 Aug 2001 11:36:45 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Preliminary task description
Message-Id: <3B8A933D.D168DC0@stomp.stomp.tokyo>

Steffen Müller wrote:
 
(snipped)
 
> - Entries submitted as a perl module.pm file.

Is there a problem with writing a stand-alone
Perl script for this?  A module qualifies where
a Perl script would be disqualified? Logical.

My hunch is you are looking to others to provide
solutions for a module you wish to write and
later publish.


Godzilla!
--
10:10:15 08/27/2001 - RESTRICTED FILE REDIRECT:
   - DNS:  - IPA: 65.202.108.130
   - System: 
   - Redirect URL: /default.ida


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

Date: Mon, 27 Aug 2001 20:49:17 +0200
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: Preliminary task description
Message-Id: <9me4fu$9tv$02$1@news.t-online.com>

"Godzilla!" <godzilla@stomp.stomp.tokyo> schrieb im Newsbeitrag
news:3B8A933D.D168DC0@stomp.stomp.tokyo...
> Steffen Müller wrote:
>
> (snipped)
>
> > - Entries submitted as a perl module.pm file.
>
> Is there a problem with writing a stand-alone
> Perl script for this?  A module qualifies where
> a Perl script would be disqualified? Logical.
>
> My hunch is you are looking to others to provide
> solutions for a module you wish to write and
> later publish.

No. Not in any way.
It's just convenient if I can spawn a bunch of object from the classes.
There's going to be a template anyway.

Appreciate your worries, though.

Yours *faithfully*,
Steffen




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

Date: 27 Aug 2001 23:02:30 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Question about GD
Message-Id: <slrn9olkcb.qgj.abigail@alexandra.xs4all.nl>

Bernhard Schelling (barna@megapage.ch) wrote on MMCMXVI September
MCMXCIII in <URL:news:3B87E3CA.F6E57C62@megapage.ch>:
'' Hi all,
'' 
'' I have a really big image, and i only need a piece of the big image
'' everytime a web page is accessed.
'' Now im not sure what's the fastest way to cut it out.
'' 
'' I have infinite diskspace and a mysql database on a linux system, so I
'' ask you, what should i do?

First of all, you should get rid of the MySQL database, and get something
useful. Oracle, Sybase, Postgres, DB2, to name a few.

After that, I'd visit my travel agent and book some trips. Infinite
diskspace means you can make a steady income selling diskspace, and
perhaps disks.

'' - Use one big PNG file, load it, and copy the piece into another image
'' ($image->copy(..)) (really slow, I tried that first)
'' - Use one big GD file, and do it like the one above
'' - Use more smaller PNG file, load only the needed one (or multiple files
'' if its over a border) and copy them together (thats what i'm doing now
'' :-)
'' - Use a GD2 File and use ->newFromGd2Part(..) (is that fast??)
'' - Copy the big PNG file in the database as GD Format and load it with
'' GD::Image->new($datafromdatabase) and copy the piece
'' - another way?

You would need to run a benchmark. I do notice you don't mention caching.
Perhaps you can chache some calculations.



Abigail
-- 
perl -le 's[$,][join$,,(split$,,($!=85))[(q[0006143730380126152532042307].
          q[41342211132019313505])=~m[..]g]]e and y[yIbp][HJkP] and print'


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

Date: 27 Aug 2001 11:09:41 -0700
From: mike_solomon@lineone.net (Mike Solomon)
Subject: Selecting * on numerous MySQL tables.
Message-Id: <56568be5.0108271009.7fd5d5a6@posting.google.com>

>I'm running into a snag... here's an example of the query I'm making
>from within Perl:

>SELECT * FROM table1,table2

>I know it's not a nice way to do it, but I'm making an SQL webpage
>frontend which I'd like to support it just in case. I'm
>using fetchrow->hashref to pull it out and display it. The problem I'm
>running into is when table1 and table2 have similar
>column names. One of them would be overwritten in the hash reference to
>be replaced by the second one it encounters.

>So my question is this. Is there any way to force MySQL to ouput the
>table name with the column name instead of just the
>column name, ie. table1.column2.

>Thanks in advance,
>Dave Mittner


Change your SQL statement to something like

SELECT table1.name tab1name, table2.name tab2name
FROM table1, table2

You then use tab1name and tab2name as your reference

This should solve your problem

Regards


Mike Solomon


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

Date: 27 Aug 2001 11:44:07 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Selecting * on numerous MySQL tables.
Message-Id: <3b8a94f7@news.victoria.tc.ca>

Mike Solomon (mike_solomon@lineone.net) wrote:
: >I'm running into a snag... here's an example of the query I'm making
: >from within Perl:

: >SELECT * FROM table1,table2

: >I know it's not a nice way to do it, but I'm making an SQL webpage
: >frontend which I'd like to support it just in case. I'm
: >using fetchrow->hashref to pull it out and display it. The problem I'm
: >running into is when table1 and table2 have similar
: >column names. One of them would be overwritten in the hash reference to
: >be replaced by the second one it encounters.

: >So my question is this. Is there any way to force MySQL to ouput the
: >table name with the column name instead of just the
: >column name, ie. table1.column2.

: >Thanks in advance,
: >Dave Mittner


: Change your SQL statement to something like

: SELECT table1.name tab1name, table2.name tab2name
: FROM table1, table2

: You then use tab1name and tab2name as your reference

In MySql that might need to be

	SELECT table1.name AS tab1name, table2.name AS tab2name
                           ^^                       ^^



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

Date: Mon, 27 Aug 2001 20:00:55 +0200
From: "B. Caligari" <bcaligari@fireforged.com>
Subject: Re: Sex or Perl?  Which is better?
Message-Id: <9me1ju0sq0@enews3.newsguy.com>


"Kevin Michael Vail" <kevin@vaildc.net> wrote in message
news:260820011101145764%kevin@vaildc.net...
> In article <slrn9ohskn.lfd.tadmc@tadmc26.august.net>, Tad McClellan
> <tadmc@augustmail.com> wrote:
>
> > [ piggybacked 'cause OP cannot be found ]
> >
> >
> > Brendon Caligari <bcaligari@fireforged.com> wrote:
> > >"None" <pohanl@aol.com> wrote in message
> > >news:12124e47.0108251948.44fc310f@posting.google.com...
> > >> In the beginning there was sex.  Then came Perl.
> > >> Which is better?
> >
> > >> Well, which is better?  Sex or Perl?
> >
> >
> > Always enable warnings and strictures in Perl.
> >
> > Unprotected Perl is a dangerous gamble in today's world.
>
> No one else has pointed out that TMTOWTDI applies to both sex and Perl.
>
> :-)
>

hehehe....
 ...do you do perl for money?






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

Date: 27 Aug 2001 20:18:58 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Statement modifiers??
Message-Id: <998942777.3166@itz.pp.sci.fi>

In article <9m7sb1$kt3$1@news.panix.com>, David Combs wrote:
>
>You really need macros to do them "right".
>You define assert *as a macro*.
>
>So that Assert(i > j) generates:
>
>   if not (i > j) {
>      either-die-or-warn-or-goIntoDebugger("Assertion Failed: " . "i > j")
>    }

You can always turn the concept around, and use plain simple eval() to
implement equivalent functionality in Perl:

  use Carp 'croak';
  sub assert ($) {
      eval $_[0] or croak "Assertion failed: $_[0]";
  }

Of course, it's not quite the same thing, since lexical variables will
not be visible to the evaled code.  Come to think of it, I bet one could
fix that by making assert() an XSUB and playing scope games..

I wouldn't be surprised if someone had already done just that.

And then there's always the source filter option.

-- 
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real!  This is a discussion group, not a helpdesk.  You post something,
we discuss its implications.  If the discussion happens to answer a question
you've asked, that's incidental."           -- nobull in comp.lang.perl.misc



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

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.  

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


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