[22416] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4637 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 27 21:05:46 2003

Date: Thu, 27 Feb 2003 18:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 27 Feb 2003     Volume: 10 Number: 4637

Today's topics:
    Re: Anyway to do away with ?: in the map function <tore@aursand.no>
    Re: Brute Force Golf Solver <abigail@abigail.nl>
    Re: Brute Force Golf Solver <uri@stemsystems.com>
        Calling a WAV file <jgray1@twcny.rr.com>
    Re: Calling a WAV file <ian@WINDOZEdigiserv.net>
    Re: FAQ proposal: Why can't I compare two strings using <tore@aursand.no>
    Re: FAQ proposal: Why can't I compare two strings using <abigail@abigail.nl>
    Re: getting prmature end of script headers <abigail@abigail.nl>
    Re: HELP- How can  i use proxy service for port 80 as c <abigail@abigail.nl>
    Re: How Do I Clone An Object <abigail@abigail.nl>
        LISA 2003 Call for Papers <alex@usenix.org>
    Re: Necessary modules? <abigail@abigail.nl>
        newbie question <nono@nono.no>
    Re: newbie question <uri@stemsystems.com>
    Re: newbie question <shondell@cis.ohio-state.edu>
    Re: newbie question <spam@thecouch.homeip.net>
    Re: newbie question <uri@stemsystems.com>
    Re: PerlCC Error on Win2k - Perl57.lib ?! (Sisyphus)
    Re: please help me, my program will not work <abigail@abigail.nl>
    Re: scan text to find hyperlinks ? <tore@aursand.no>
    Re: scan text to find hyperlinks ? <abigail@abigail.nl>
    Re: Writing my own scripting language. Need advice. <tassilo.parseval@post.rwth-aachen.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 28 Feb 2003 01:50:37 +0100
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: Anyway to do away with ?: in the map function
Message-Id: <pan.2003.02.28.00.43.51.680661@aursand.no>

On Thu, 27 Feb 2003 11:56:18 -0600, Peter Shankey wrote:
> I am indeed not using the list returned by map.

Just to make my point perfect, I hereby offer you a nice chapter from the
FAQ, 'perldoc -q void';

   "The problem is that both grep and map build a return list,
    regardless of the context.  This means you're making Perl go to
    the trouble of building a list that you then just throw away.
    If the list is large, you waste both time and space.  If your
    intent is to iterate over the list then use a for loop for this
    purpose."

> map {
>  / values \((\w*),('[\W*|\w*]*'),([\w]*),([\w]*)/
>  ?($dbh->do("insert into customers values ( $1, $2, $3, $4 ) ")):()}
>  <DATA>;

I would have solved this the following way (and I don't like using DBI's
'do()' method even if it shortens my code a bit);

  my $stInsert = $dbh->prepare('INSERT INTO customers
                                VALUES (?, ?, ?, ?)');
  while ( <DATA> ) {
      chomp;
      if ( regexp ) {
          $stInsert->execute( $1, $2, $3, $4 );
      }
  }
  $stInsert->finish();

In my opinion, the code above is _a lot_ easier to read than yours.  No
offence, but using 'map' can be quite distracting sometimes.

But there's another thing with your code;  When dealing with 'INSERT' SQL
statements, you should really define what values you are inserting into
the database by naming them;

  INSERT INTO table ( field1, field2, field3 )
  VALUES ( value1, value2, value3 )

This ensures that your code will work even if the data model changes.

When it comes to your regular expression, you might want to have a look at
Text::CSV (if I remember correctly).  Text::CSV makes it easier to deal
with comma-delimited text.

In other words, I would have dealed with <DATA> in two parts (untested);

  while ( <DATA> ) {
      chomp;
      if ( m,values\s+\((.*)\),i ) {
          my $values = $1;
          # do the Text::CSV part here (I don't remember it's syntax)
      }
  }

I guess that my suggestions doesn't help the speed of your application at
all (rather otherwise), but some of the suggestions _might_ be useful. :)

Good luck!


-- 
Tore Aursand - tore@aursand.no - http://www.aursand.no/



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

Date: 28 Feb 2003 01:09:01 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Brute Force Golf Solver
Message-Id: <slrnb5tdld.nh4.abigail@alexandra.abigail.nl>

Quantum Mechanic (quantum_mechanic_1964@yahoo.com) wrote on MMMCDLXVII
September MCMXCIII in <URL:news:f233f2f0.0302271109.12de30e6@posting.google.com>:
:)  Under the auspices of "There are no stupid questions"...
:)  
:)  Has anyone done any work on a brute force golf solver?
:)  
:)  I'm not very good at golf, but I like the idea of tinkering with a
:)  program that writes programs.
:)  
:)  I envision a semi-intelligent program that knows about the most useful
:)  command line options, builtin functions and operators, and tries to
:)  generate valid (i.e., "perl -c") programs, runs them against test
:)  input, and validates the output against the expected output.
:)  
:)  Obviously just trying every possible string as a program would take
:)  too long, even starting with the shortest programs first.
:)  
:)  Even a subset of this problem, such as limiting the "solution space"
:)  to valid subroutines, could still take an eon. [BTW, which is longer,
:)  "eon" or "epoch"? :]
:)  
:)  A distributed approach would only help by a few orders of magnitude.
:)  
:)  As a final question, I should ask for wild guesses as to
:)  how impractical this idea is.


There are 95 printable characters in ASCII, and Perl makes use of all
of them. This means there are 59873693923837890625 Perl programs of
10 characters, and 3584859224085422343574104404449462890625 programs
of 20 characters, including "BEGIN{qx{rm -rf /};}". 

Suppose you give every person of this planet (all 6 billion of them)
a super fast computer, that's able to check a program in an picosecond
(10^-12 seconds). Then you still need almost 19 billion years to check
all possible 20 character Perl programs.

I'd say, it's impractical.



Abigail
-- 
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
                                      print } sub __PACKAGE__ { &
                                      print (     __PACKAGE__)} &
                                                  __PACKAGE__
                                            (                )


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

Date: Fri, 28 Feb 2003 01:16:05 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Brute Force Golf Solver
Message-Id: <x7u1epb3xn.fsf@mail.sysarch.com>

>>>>> "A" == Abigail  <abigail@abigail.nl> writes:

  A> Quantum Mechanic (quantum_mechanic_1964@yahoo.com) wrote on MMMCDLXVII

  A> Suppose you give every person of this planet (all 6 billion of them)
  A> a super fast computer, that's able to check a program in an picosecond
  A> (10^-12 seconds). Then you still need almost 19 billion years to check
  A> all possible 20 character Perl programs.

  A> I'd say, it's impractical.

note the nick of the OP. he should just use one of the Quantum::*
modules and wait until science catches up (they've got 7 qubit computers
now!). that will be much faster than your estimate. :)

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
Damian Conway Perl Classes - January 2003 -- http://www.stemsystems.com/class


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

Date: Fri, 28 Feb 2003 00:16:22 GMT
From: "Jack Gray" <jgray1@twcny.rr.com>
Subject: Calling a WAV file
Message-Id: <qTx7a.123508$Xr1.29923746@twister.nyroc.rr.com>

Can anyone tell me how I can call up a WAV file in my CGI script?

The senario is:
Customer has NOT filled in a 'required' field. A PRINT message is displayed
but I also want to add a WAV file to alert the customer. Here is a brief
snippet of the script:

<td colspan="4"><h3>Please fill out the following form to request a
quote:</h3>
   <p style="font-weight: bold;"><font color="red">*</font>Required
Fields</p></td>
    </tr>
    <tr>
      <td width="10%">&nbsp;</td>
      <td width="8%"><p style="font-weight: bold;"><font
color="red">*</font>Name:</p></td>
      <td width="60%"><input type="text" name="name" size="24" value =
$in{'name'}></td>
      <td width="22%"><p style="font-weight: bold; color: #ff0000">
eoh

 #Write out error message if email is missing
if($in{'name'} eq "")
{print "Please enter your name";}
print <<"eoh";

How can I edit this script to play the WAV?

Thanks for the help!
Jack




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

Date: Fri, 28 Feb 2003 00:36:58 GMT
From: "Ian.H [dS]" <ian@WINDOZEdigiserv.net>
Subject: Re: Calling a WAV file
Message-Id: <vnbt5voma7aajdhs20rkvgcj85p9i39abi@4ax.com>
Keywords: Remove WINDOZE to reply

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

In a fit of excitement on Fri, 28 Feb 2003 00:16:22 GMT, "Jack Gray"
<jgray1@twcny.rr.com> managed to scribble:

> Can anyone tell me how I can call up a WAV file in my CGI script?
> 
> The senario is:
> Customer has NOT filled in a 'required' field. A PRINT message is
> displayed but I also want to add a WAV file to alert the customer.
> Here is a brief snippet of the script:


Perl == server side
Customer == client side.


In short, you can't; not for the customer to hear anyway, but it'll
play nice sounds on the server ;)



Regards,

  Ian

-----BEGIN xxx SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPl6vKGfqtj251CDhEQLDmwCdHSoDL958x2btPcB9591aDePYurwAni+x
11356bJyBq/ZXeaP7jK91PNV
=Hmzg
-----END PGP SIGNATURE-----

-- 
Ian.H  [Design & Development]
digiServ Network - Web solutions
www.digiserv.net  |  irc.digiserv.net  |  forum.digiserv.net
Scripting, Web design, development & hosting.


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

Date: Fri, 28 Feb 2003 00:56:14 +0100
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: FAQ proposal: Why can't I compare two strings using == ?
Message-Id: <pan.2003.02.27.12.52.48.701291@aursand.no>

On Thu, 27 Feb 2003 03:21:20 +0000, Jürgen Exner wrote:
>> You are also right.  After some thinking, I came up with the following
>> questions:
>>
>>   "Why doesn't my use of operator do what I excpect?"
>>
>> It's a problem with this one, though; a lot of people don't even _know_
>> what an operator is. :-/

> Plus the average user wouldn't find this entry using "perldoc -q".
> Typically you would search for "compare", "equal", maybe "string".

Hmm.  POD should really support keywords associated with each question.
That way, the question could be as perfect as possible, while searching
wuold be a lot easier.

> Therefore, although it is technically accurate I would prefer a less
> accurate but more useful wording.

I agree.


-- 
Tore Aursand - tore@aursand.no - http://www.aursand.no/



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

Date: 28 Feb 2003 00:24:12 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: FAQ proposal: Why can't I compare two strings using == ?
Message-Id: <slrnb5tb1c.nh4.abigail@alexandra.abigail.nl>

Philip Lees (pjlees@ics.forthcomingevents.gr) wrote on MMMCDLXVII
September MCMXCIII in <URL:news:3e5dbf97.63328218@news.grnet.gr>:
==  
==  NOTE: If you use warnings (as you should) then Perl will alert you to
==  what's wrong. (While you're adding 'use warnings' or the -w flag to
==  your scripts, you should also include 'use strict'.)


You shouldn't blindly add "use strict" to your program if you don't
know what it means, just because someone in some newsgroup said so.

Turning on strictness does change the way Perl parses your program.
That's something that shouldn't be taken lighthearted.


Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'


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

Date: 28 Feb 2003 00:27:20 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: getting prmature end of script headers
Message-Id: <slrnb5tb78.nh4.abigail@alexandra.abigail.nl>

matt (urzaserra@home.com) wrote on MMMCDLXVI September MCMXCIII in
<URL:news:Gac7a.1359$Pa.117742@news2.west.cox.net>:
;;  I just got this perl cgi program that is a web based database searcher and
;;  editor but i am getting the premature end of script header errors.

That means you have an error somewhere!


Abigail
-- 
print v74.117.115.116.32;
print v97.110.111.116.104.101.114.32;
print v80.101.114.108.32;
print v72.97.99.107.101.114.10;


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

Date: 28 Feb 2003 01:13:24 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: HELP- How can  i use proxy service for port 80 as client using PERL
Message-Id: <slrnb5tdtk.nh4.abigail@alexandra.abigail.nl>

Sade Bhat Kalasabail (sade_bhat@yahoo.com) wrote on MMMCDLXVII September
MCMXCIII in <URL:news:3a621d3c.0302261651.44e185a3@posting.google.com>:
][  'I have a client, that needs to contact a remote server on port
][   80. Due to our firewall setup I am not allowed to do this
][   directly, but I can utilise a proxy service for port 80. How do I
][   do this, using perl?' 


How do you do what, using Perl? Write a proxy server? Install
a proxy server? Start a proxy server? Connect to a proxy server?

I wouldn't pick Perl for the first 3 tasks, and I may not pick
Perl for the latter task either.



Abigail
-- 
 :;$:=~s:
-:;another Perl Hacker
 :;chop
$:;$:=~y:;::d;print+Just.$:


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

Date: 28 Feb 2003 00:41:16 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: How Do I Clone An Object
Message-Id: <slrnb5tc1c.nh4.abigail@alexandra.abigail.nl>

Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMCDLXVI
September MCMXCIII in <URL:news:b3jc9r$fa0$1@mamenchi.zrz.TU-Berlin.DE>:
??  
??  This clone routine will have to be changed (or at least checked) whenever 
??  the underlying object structure changes.  For a more general (but probably
??  less efficient) approach, a module can be used.  I'm not sure if there's
??  a dedicated deep-copy module (which is what you're looking for), but
??  Data::Dumper and similar serialization modules do a good job.  You
??  basically dump the object to a string and immediately restore it again.
??  The restored object will be a perfect clone of the original (blessed and
??  all).  This way you can change the object structure whichever way you
??  want, the clone method will automatically adapt.


Eh, no. It all depends on how you create your objects. There is no
general way of cloning objects in Perl (which is ill defined anyway,
if an attribute is a reference, should the attribute of the clone
reference the same data, or a copy of the data?).

I create my objects like this:

    package Foo::Bar;

    my (%attr1, %attr2);

    sub constructor {
        my $proto = shift;
        my $class = ref $proto || $proto;

        bless [] => $proto;
    }

    sub accessor1 {
        my $key = shift;
    
        $attr1 {$key} = shift if @_;
        $attr1 {$key}
    }

    sub accessor2 {
        my $key = shift;

        $attr2 {$key} = shift if @_;
        $attr2 {$key}
    }

    sub DESTROY {
        my $key = shift;

        delete $attr1 {$key};
        delete $attr2 {$key};
    }


A general cloning method that just copies what's in the reference is
breaking encapsulation. You shouldn't peek inside, let alone rely
on what's inside. One of these days, it's going to bite you.

The only way to implement cloning is having the full cooperation
of the entire inheritance tree - each class should do its part
of the cloning. Which would be needed anyway, because only the
class nows whether which of the attributes that are references 
need shallow or deep copies.


Abigail
-- 
# Perl 5.6.0 broke this.
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


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

Date: Thu, 27 Feb 2003 15:29:39 -0800
From: Alex Walker <alex@usenix.org>
Subject: LISA 2003 Call for Papers
Message-Id: <3E5E9F63.8070902@usenix.org>

LISA 2003
October 26-31, 2003
San Diego, California USA
http://www.usenix.org/events/lisa03/

The annual LISA conference is the meeting place of choice for system and
network administrators. System administrators of all specialties and
levels of expertise meet at LISA to exchange ideas, sharpen old skills,
learn new techniques, debate current issues, and meet colleagues and
friends. People come from over 30 countries to attend LISA. They include
a wide range of system and network administrators working in the full
spectrum of computing environments-large corporations, small businesses,
academic institutions, government agencies, and so on, as well as many
full- and part-time students.

GET INVOLVED!

The LISA 2003 Program Committee invites you to contribute your ideas,
proposals, and papers for refereed papers, invited talks, panels,
Guru-is-in sessions and work-in-progress reports.

We welcome submissions that address all facets of the practice and
theory of system and network administration.

The Call for Participation, with submission guidelines and sample
topics, is now available on the USENIX Web site at:

http://www.usenix.org/events/lisa03/

Submissions are due by April 21, 2003.

This is *your* conference. You can participate in the planning and
contribute to LISA's success by submitting a proposal or making a
suggestion. Remember that experts and old-timers don't have all the good
ideas.

We look forward to hearing from you!

Sincerely,

AEleen Frisch, Exponential Consulting
LISA 2003 Program Chair
aeleen@usenix.org

=============================================================================
LISA 2002 is sponsored by USENIX, the Advanced Computing Systems
Association, and SAGE, the System Administrators Guild. www.usenix.org
=============================================================================




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

Date: 28 Feb 2003 00:49:54 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Necessary modules?
Message-Id: <slrnb5tchi.nh4.abigail@alexandra.abigail.nl>

Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMCDLXVII
September MCMXCIII in <URL:news:b3kqs6$jv1$1@mamenchi.zrz.TU-Berlin.DE>:
:}  
:}  To get a more complete list, you can insert a coderef into @INC
:}  that prints out every module that is searched for:
:}  
:}      BEGIN { unshift @INC, sub { warn "loading $_[ 1]\n"; return } }
:}  
:}  With this line early in your application, run it once (perl -c ...
:}  is sufficient) and collect STDERR.


Alternatively, one could just inspect %INC. 
Just stuff

    CHECK {print "$_\n" for keys %INC}

somewhere in your code, and run 'perl -c'.



Abigail
-- 
perl -wle'print"Êõóô áîïôèåò Ðåòì Èáãëåò"^"\x80"x24'


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

Date: Thu, 27 Feb 2003 15:07:59 -0800
From: nono <nono@nono.no>
Subject: newbie question
Message-Id: <f06t5v03tvca84iit0bfl8p0b8g8quli6a@4ax.com>

let's say I have these variables:

$var0 = 55
$var1 = 66
$var2 = 77
$var3 = 88
$var4 = 99

how do I print them one by one depending on what the $index is in the
following for cycle ?
I mean when $index = 0, print $var0 , when $index is 3 print $var3

thanks
Rod


for($index=0; $index <=4; $index++)
{
???    print $var.$index;	???
}



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

Date: Thu, 27 Feb 2003 23:08:15 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: newbie question
Message-Id: <x7adghcof5.fsf@mail.sysarch.com>


use an array.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
Damian Conway Perl Classes - January 2003 -- http://www.stemsystems.com/class


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

Date: 27 Feb 2003 18:16:48 -0500
From: Ryan Shondell <shondell@cis.ohio-state.edu>
Subject: Re: newbie question
Message-Id: <xcwznohmhzz.fsf@psi.cis.ohio-state.edu>

nono <nono@nono.no> writes:

> let's say I have these variables:
> 
> $var0 = 55
> $var1 = 66
> $var2 = 77
> $var3 = 88
> $var4 = 99

Naming variables like that (foo1, foo2) is usually a good indication
that you should be using an array instead.

@var = (55, 66, 77, 88, 99);

> how do I print them one by one depending on what the $index is in the
> following for cycle ?
> I mean when $index = 0, print $var0 , when $index is 3 print $var3
>
> thanks
> Rod
> 
> 
> for($index=0; $index <=4; $index++)
> {
> ???    print $var.$index;	???
> }
> 

Ditch the C-style for loop.

# print everything in @var

foreach my $index (@var) {
  print $index;
}

# or even...

print $_, "\n" foreach (@var);

# or just print the first 3 items

for (0..2) {
  print $var[$_];
}

It all depends on what you need to do.

TMTOWTDI.

-- 
perl -e '$;=q,BllpZllla_nNanfc]^h_rpF,;@;=split//,
$;;$^R.=--$=*ord for split//,$~;sub _{for(1..4){$=
=shift;$=--if$=!=4;while($=){print chr(ord($;[$%])
+shift);$%++;$=--;}print " ";}}_(split//,$^R);q;;'


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

Date: Thu, 27 Feb 2003 19:54:24 -0500
From: Mina Naguib <spam@thecouch.homeip.net>
Subject: Re: newbie question
Message-Id: <7ry7a.18800$3b.194705@wagner.videotron.net>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

nono wrote:
> let's say I have these variables:
> 
> $var0 = 55
> $var1 = 66
> $var2 = 77
> $var3 = 88
> $var4 = 99
> 
> how do I print them one by one depending on what the $index is in the
> following for cycle ?
> I mean when $index = 0, print $var0 , when $index is 3 print $var3

You should really consider using an array instead of multiple variables 
like so.

@nums = qw(55 66 77 88 99);
#
# Then loop with index:
#
for ($index = 0; $index <= $#nums; $index++) {}
#
# Or loop with a foreach if you don't care about the index
#
foreach (@nums) {}

However, if you do insist on using your logic, then here's how you can 
do it:
$var0 = 55;
$index = 0;
print ${"var$index"};


Best of luck.

-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+XrNDeS99pGMif6wRAmNzAKCYWISMhoobyRbG1WEN/tWLkU/nWACePhT2
3+goF00JyU3pNaOM74wwY9E=
=H0U/
-----END PGP SIGNATURE-----



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

Date: Fri, 28 Feb 2003 01:13:45 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: newbie question
Message-Id: <x7y941b41j.fsf@mail.sysarch.com>

>>>>> "MN" == Mina Naguib <spam@thecouch.homeip.net> writes:

  MN> However, if you do insist on using your logic, then here's how you can
  MN> do it:
  MN> $var0 = 55;
  MN> $index = 0;
  MN> print ${"var$index"};

you shouldn't even give out any symref answer because the OP just might
use it. and that is not good for newbies to learn, especially for one
who doesn't even know basic arrays.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
Damian Conway Perl Classes - January 2003 -- http://www.stemsystems.com/class


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

Date: 27 Feb 2003 15:38:44 -0800
From: kalinabears@hdc.com.au (Sisyphus)
Subject: Re: PerlCC Error on Win2k - Perl57.lib ?!
Message-Id: <e615828f.0302271538.11ea2f77@posting.google.com>

martin.bohnert.ibm@froeschl.de (Martin Bohnert) wrote in message news:<c08299c0.0302270151.2c4536a0@posting.google.com>...
> Hi there,
> 
> I`d be glad if someone could help me out of this one:
> 
> I`m trying to compile a script (see below) on Win2k SP3 using
> ActiveState`s Perl 5.8.0.
> 
> C:\>perlcc -o mf.exe c:\mbohnert\source\perl\mf.pl
> pcc94Sga.c
> pcc94Sga.c(20389) : warning C4101: 'targ' : Unreferenzierte lokale
> Variable --> "unreferenced local variable"
> pcc94Sga.c(30817) : warning C4101: 'targ' : Unreferenzierte lokale
> Variable
> pcc94Sga.c(41314) : warning C4101: 'targ' : Unreferenzierte lokale
> Variable
> pcc94Sga.c(51731) : warning C4101: 'targ' : Unreferenzierte lokale
> Variable
> pcc94Sga.c(54500) : warning C4101: 'targ' : Unreferenzierte lokale
> Variable
> LINK : fatal error LNK1181: Eingabedatei "perl57.lib" kann nicht
> geoeffnet werde
> n -> "could not open perl57.lib"
> 
> %PATH% includes the path to perl/bin and perl/lib. perl57.lib doesn`t
> exist, OK - but the script runs fine if interpreted. Here`s the source
> code:
> 
> use File::copy;
> use File::stat;
> use Time::localtime;
> 
> $usage = "mf <Input path> <Output path> <Pattern>\n";
> 
> if (@ARGV != 3) {die "$usage";}
> 
> for ($ARGV[0], $ARGV[1]) { s/([^\\])$/\1\\/; }
> 
> opendir(INDIR, $ARGV[0]) || die "Couldn't open input path
> $ARGV[0].\n";
> opendir(OUDIR, $ARGV[1]) || die "Couldn't open output path
> $ARGV[1].\n";
> 
> $te=localtime(time)->mon() + 1;
> $te=~s/^(\S)$/0\1/;
> $te=$te . substr(localtime(time)->year() + 1900, 2, 4);
> 
> BAR: while($file=readdir(INDIR)) {
>     if($file=~m/\.fdf$/i) {
> 	print "Deleting file $ARGV[0]$file.\n";
> 	if (!unlink $ARGV[0].$file) {
> 	    print "Delete failed, DOS deleting.\n";
> 	    open(FOO, "del $ARGV[0]$file |");
> 	    while(<FOO>) {print "$_\n";}
> 	    close FOO;
> 	}
>  next BAR;
>     }
>     if ($file=~m/$ARGV[2]/i) {
> 	print "Copying file $ARGV[0]$file to $ARGV[1]$file.$te\n";
> 	if (!copy $ARGV[0].$file, $ARGV[1].$file.".".$te) {
> 	    print "Copy failed, DOS copying.\n";
> 	    open(FOO, "copy $ARGV[0]$file $ARGV[1]$file.$te |");
> 	    while(<FOO>) {print "$_\n";}
> 	    close FOO;
> 	}
>     }
> } 
> 
> Any hints on getting this thing to compile ?

The 'perlcc.bat' that ships with 5.8 has a hard coded reference to
'perl57.lib'. Find it, and change it to 'perl58.lib'.
I think that's all there is to it - though I haven't checked.

If any of those modules you're using are extensions (ie were built
using XS code) then you're going to have to link to their static
library file - ie the '.lib' file in the
'perl/site/lib/auto/module/package' branch. According to the
documentation 'perlcc' supports the '-L' switch, but I don't see any
documentation saying that it supports the '-l' switch.
Then, to run the executable, the module's shared library file needs to
be findable - ie the '.dll' that sits alongside the aforementioned
'.lib' file.

'perlcc' is experimental, buggy, and poorly (if at all) supported. The
executable built is huge and will not run independently of
'perl58.dll'.Imo, perlcc's only value is one of entertainment :-)

Hth.

Cheers,
Rob


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

Date: 28 Feb 2003 00:51:03 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: please help me, my program will not work
Message-Id: <slrnb5tcjn.nh4.abigail@alexandra.abigail.nl>

Klaus Eltermann (klaus@eltermann.com) wrote on MMMCDLXVI September
MCMXCIII in <URL:news:b3j7m3$jt4$3@news.online.de>:
==  tyrannous@o-space.com wrote:
==  
== > sub cycle
== > {
== > 
== >    &drawscreen;
== >    sleep 1;
== >    &cycle;
== > 
== > }
==  
==  You are aware, that you are getting recursive call's without a break 
==  condition, are you?
==  
==  cycle() will call itself, will call itself, ... until you run out off 
==  stack space.


Putting a 'goto' before '&cycle' will solve that problem. ;-)


Abigail
-- 
perl -wle 'print prototype sub "Just another Perl Hacker" {};'


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

Date: Fri, 28 Feb 2003 00:58:13 +0100
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: scan text to find hyperlinks ?
Message-Id: <pan.2003.02.27.12.59.44.965028@aursand.no>

On Wed, 26 Feb 2003 18:46:04 -0500, Eric Osman wrote:
> But what I want to do is scan non-html text and identify parts of
> the text that LOOK LIKE url's .

Try one of these modules available from CPAN:

  Regexp::Common
  URI::Find

One other thing:  Don't top-post.


-- 
Tore Aursand - tore@aursand.no - http://www.aursand.no/



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

Date: 28 Feb 2003 01:19:28 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: scan text to find hyperlinks ?
Message-Id: <slrnb5te90.nh4.abigail@alexandra.abigail.nl>

Eric Osman (ericosman-nospam@rcn.com) wrote on MMMCDLXVI September
MCMXCIII in <URL:news:3E5D4299.6070305@rcn.com>:
""  
""  In other words, I want my perl script to identify things that look
""  like hyperlinks in text.
""  
""  For finding the hyperlink-looking things in the text, which of these
""  would you suggest:
""  
""  o	Write it myself using some sort of regular expression
""  	concoction.
""  
""  o	Use the such-and-such well-known existing perl package to
""  	do it (which one ????)


    use Regexp::Common;

    /$RE{URI}/;


Its latest version matches fax, file, ftp, gopher, http, news, nntp, tel,
telnet, and tv URIs.

And more URIs are forthcoming.



Abigail
-- 
echo "==== ======= ==== ======"|perl -pes/=/J/|perl -pes/==/us/|perl -pes/=/t/\
 |perl -pes/=/A/|perl -pes/=/n/|perl -pes/=/o/|perl -pes/==/th/|perl -pes/=/e/\
 |perl -pes/=/r/|perl -pes/=/P/|perl -pes/=/e/|perl -pes/==/rl/|perl -pes/=/H/\
 |perl -pes/=/a/|perl -pes/=/c/|perl -pes/=/k/|perl -pes/==/er/|perl -pes/=/./;


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

Date: 27 Feb 2003 23:30:48 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: Writing my own scripting language. Need advice.
Message-Id: <b3m738$bjq$1@nets3.rz.RWTH-Aachen.DE>

[ f'up to clpm ]

Also sprach Salvador Fandiño García:

> Tassilo v. Parseval wrote:
> 
>> Also sprach Salvador Fandiño García:
>>>Anyway, usually it is not a good idea to write a new one from scratch 
>>>specially if you know nothing about language design and implementation.
>> 
>> 
>> I knew nothing about C, Perl etc. years ago. This changed not because I
>> refrained from trying them. Learning how to design and implement a new
>> language can only be done by doing it.
> 
> I don't thing so...

You can't learn it from books just as you can't learn C from the
Kernighan/Ritchie...instead you have it within reach while doing the
first steps. Learning by doing doesn't mean you are required to ignore
any written word on the topic in question.

>> Since the OP posted into a Perl group as well: Perl 1.0 is still
>> obtainable through cpan:
>>     
>>     http://search.cpan.org/author/MSCHWERN/perl-1.0_15/
>> 
>> and has been updated to run on modern machines. Besides being a bit of
>> nostalgia, it's a good example of how things work together. Unlike the
>> modern Perls it is a small package that is not too hard to understand.
> 
> That's the point, you don't start from scratch, it's better to study 
> what others have done first and later if you still believe it's worth 
> the trouble go and create your new language.

Precisely. Well, the OP asked here how it can be done. Obviously he is
interested in what others have to say about it. Perl-1.0 is rather tiny
and cosy and thus a good demonstration.

> There are lots of languages out there that are still incomplete or a 
> work in progress, and that will appreciate new programmers joining their 
> development and that was going to be my initial advice to the OP, if you 
> want to learn, look for one of those and try to help to its 
> development... 

Joining an existing project will teach you different things (still
invaluable, for sure). You are currently busy with teaching Perl how to
do assertions. But while doing it do you feel as though you are creating
your own language?

Also, the current Perl5 development is a good example that joining is
sometimes as hard as creating something new from scratch, given the
complexity of the software. The 5.8.0's source distribution is over
50meg in size. It takes a year to understand the whole system before
writing a single line of code.

> but the OP didn't really tell us why he wants to create a 
> new language, if he just want some fun, if he wants to learn, if he has 
> some new ideas, if it's for a project with a very specific requirements, 
> etc., so I asked.

I strongly hope the reason is either learning or having fun because
instant success is not to be expected by the OP. :-)

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

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


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