[30288] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1531 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 11 06:09:38 2008

Date: Sun, 11 May 2008 03:09:04 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 11 May 2008     Volume: 11 Number: 1531

Today's topics:
        code written under 5.10.0 to be run under 5.8.8 dummy@phony.info
        Creating new pages automatically with PDF::API2 <stpra123@gmail.com>
    Re: Filehandles <whynot@pozharski.name>
    Re: Get variable from its name string or vice versa? <benkasminbullock@gmail.com>
    Re: I need to extract an array from a scalar regex-wise <uri@stemsystems.com>
    Re: I need to extract an array from a scalar regex-wise <get@bentsys.com>
    Re: implementation for Parsing Expression Grammar? <gneuner2/@/comcast.net>
    Re: Net::SMTP fails <hjp-usenet2@hjp.at>
        new CPAN modules on Sun May 11 2008 (Randal Schwartz)
    Re: Printing a new line kronecker@yahoo.co.uk
    Re: Printing a new line <jurgenex@hotmail.com>
    Re: Printing a new line <1usa@llenroc.ude.invalid>
    Re: regex problem unresolved <ben@morrow.me.uk>
    Re: regex problem unresolved <jurgenex@hotmail.com>
    Re: regex problem unresolved <jurgenex@hotmail.com>
    Re: regex problem unresolved <ben@morrow.me.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 10 May 2008 20:51:54 -0700
From: dummy@phony.info
Subject: code written under 5.10.0 to be run under 5.8.8
Message-Id: <0gqc245d164jqt67qo69ho0lif7i1f7clv@4ax.com>

I understand that one can specify that a script must be run under a perl
version no earlier than a particular version.  So, if I say 'use 5.6.0',
that code will throw an error if one tries to run it under perl 5.5.0,
right?

But how about the reverse case?

Suppose I write code on my desktop, which has perl 5.10.0 installed, and
later transfer that code to a system that only has perl as far as 5.8.8.
How can I cause an error on the desktop if I accidentally use any of the
new features of 5.10.0, as I would want to do to signal incompatibility?
Is this sort of thing impossible?



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

Date: Sun, 11 May 2008 00:51:16 -0700 (PDT)
From: hotkitty <stpra123@gmail.com>
Subject: Creating new pages automatically with PDF::API2
Message-Id: <c0a6a90a-2d17-4e0d-990d-396b0b441a3c@d1g2000hsg.googlegroups.com>

Since no one in the beginners group could answer this I thought I'd
ask it to this group. I am using PDF::API2 to create PDF files from a
bunch of separate text files I have. The issue I am having is that I
am only able to create the first page of each text file and I haven't
been able to figure out how to automatically generate additional pages
if the text document requires it. In the PDF::API2::Simple module,
there is "autoflow", which will generate the additional pages you need
and fill it with the appropriate text. I have the following code and
would appreciate if anyone could guide me to how I can generate multi-
page pdf's (I've omitted some of the code that isn't relevant to
creating the pdf files):

#!/usr/bin/perl

use warnings;

use LWP::Simple;
use HTML::TokeParser;
use PDF::API2;
use Text::Autoformat;
 .
 .
 .
 .
 .
my $pdffile = '$file';
my $pdf = PDF::API2->new( -file => "$directoryname/$file.pdf");
my $page = $pdf->page;

$page->mediabox('A4');

 my $times = $pdf->corefont( 'Times', -encoding => 'latin1');

my $main_text = $page->text;
$main_text->font($times, 14);
$main_text->fillcolor('pearl');
$main_text->lead(16);
$main_text->translate(15, 650);
$main_text->paragraph("@body\n", 575, 144, -align => "justify");



$pdf->save;
$pdf->end;



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

Date: Sat, 10 May 2008 23:43:25 +0300
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: Filehandles
Message-Id: <d0ehf5xfr5.ln2@orphan.zombinet>

valerie.seigneur@gmail.com wrote:
*SKIP*
	use strict;
	use warnings;

> open INPUT, "inputfile";

	open my $INPUT, '<', 'inputfile' or
	  die "can't open inputfile: $!";

reread L<perlopentut>

> while (<INPUT>) {
>     ...

review the code under elipsis with adding C<die>'s for any function that
can fail (rereread L<perlfunc>).

>     print $result;
>     # I've tried all sorts of things here with | < > at the beginning
> or the end,
>     # exec and backticks...
> }

run B<randomize> at shell prompt, use debagger, post minimal example,
get some life, blah-blah-blah...  Perl is fun, have a nice day.

-- 
Torvalds' goal for Linux is very simple: World Domination


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

Date: Sun, 11 May 2008 01:36:54 +0000 (UTC)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: Get variable from its name string or vice versa?
Message-Id: <g05ijm$111$2@ml.accsnet.ne.jp>

On Sat, 10 May 2008 20:31:57 +0200, Peter J. Holzer wrote:

> But it happens that Damian Conway already wrote one which might do what
> the OP wants: Smart::Comments.

That's very handy. I'm glad to know about it.


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

Date: Sun, 11 May 2008 04:34:37 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: I need to extract an array from a scalar regex-wise ?
Message-Id: <x7ve1lo3vm.fsf@mail.sysarch.com>

>>>>> "GE" == Gordon Etly <get@bentsys.com> writes:

  GE> Uri Guttman wrote:

  >> Gordon Etly <get@bentsys.com> writes:
  >> > > $_ =
  >> > > 'We went to the beach on Monday but it turned out that Sunday
  >> > > would have been better. The weather report Saturday said no rain
  >> > > until Thursday but I asked Tuesday (a trick!) and she said it
  >> > > rained Wednesday.'
  >> > >
  >> > > @days = qw( Monday Sunday Saturday Thursday Tuesday Wednesday )
  >> > >
  >> > > My best shot is:
  >> > > my @days = keys %{
  >> > > /((mon|tues|wednes|thurs|fri|satur|sun)day)/gi }; >>
  >> > > Which, oddly, doesn't seem to work. I say "oddly", because
  >> > >
  >> > > /((mon|tues|wednes|thurs|fri|satur|sun)day)/gi

  >> > I think you want something like this:
  >> >
  >> > Code:
  >> >  my @days = qw( Sunday Monday Tuesday Wednesday Thursday Friday
  >> > aturday  );
  >> >  my @wanted_days = qw( Monday Sunday Saturday Thursday Tuesday
  >> > Wednesday );

  >> huh?? he wants to GET those days from the text, not preset them.

  GE> Ok, so I mis-read. After re-reading it seems he just wants to capture 
  GE> the days of the week from the string, so the answer is simple:

you misread AGAIN. 

  GE> Code:
  GE>  $_ =
  GE>  'We went to the beach on Monday but it turned out that Sunday would
  GE>  have been better. The weather report Saturday said no rain until
  GE>  Thursday but I asked Tuesday (a trick!) and she said it rained
  GE>  Wednesday.';

  GE>  my @days = m#((?:mon|tues|wednes|thurs|fri|satur|sun)day)#gi;

  GE>  print join(", ", @days);

the OP wanted the unique set of days which is why his post had a keys on
a dereferenced but incorrect hash ref. and he wanted it in one
expressions without external loops.

also he got correct answers from other people (including myself) a while
back. try reading followups before posting another answer (correct or
not).

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Sat, 10 May 2008 23:46:48 -0700
From: "Gordon Etly" <get@bentsys.com>
Subject: Re: I need to extract an array from a scalar regex-wise ?
Message-Id: <68nj2pF2tdoqpU1@mid.individual.net>

Uri Guttman wrote:


[please stop leading quoted text with spaces]

> ordon Etly <get@bentsys.com> writes:

> > Uri Guttman wrote:

> > > Gordon Etly <get@bentsys.com> writes:

> > Ok, so I mis-read. After re-reading it seems he just wants to 
> > capture
> > the days of the week from the string, so the answer is simple:

> you misread AGAIN.

No I didn't:

  advice please wireless 802.11 on RH8 wrote:

  > Let's say I want to extract all of the days of the week out
  > of a scalar
  ...
  > I want a regex/map/grep/etc (no iterative clauses PLEASE!)
  > that yields:
  >
  > @days = qw( Monday Sunday Saturday Thursday Tuesday Wednesday )

He wanted the days in the string (presuming in the order they appear) 
and ultimately stored into an array. My example fulfills this.

> > Code:
> >  $_ =
> >  'We went to the beach on Monday but it turned out that Sunday would
> >  have been better. The weather report Saturday said no rain until
> >  Thursday but I asked Tuesday (a trick!) and she said it rained
> >  Wednesday.';
> >
> >  my @days = m#((?:mon|tues|wednes|thurs|fri|satur|sun)day)#gi;
> >
> >  print join(", ", @days);

> the OP wanted the unique set of days which is why his post had a keys
> on a dereferenced but incorrect hash ref. and he wanted it in one
> expressions without external loops.


  advice please wireless 802.11 on RH8 wrote:

  > I'm also not crazy about the hash solution because order may
  > be significant.

He never said "unique", all he said was he wanted to capture the 
occurrences of days of the week in the string into an array. He never 
said their couldn't be duplicates. He _did_ say that "order may be 
significant", which to me is in line with capturing each occurrence of a 
day of the week in the string (as they appear.)

> also he got correct answers from other people (including myself) a

Actually your answer was based on the occurrences' being unique, a 
requirement the OP never gave, so your answer imposes a limit the OP 
most likely doesn't want, where as mine solution merely gets each 
occurrence, in the _order_ they appear.

> while back. try reading followups before posting another answer

This answer I gave in my last post was correct. It was also simple and 
to the point. Maybe _you_ should read the original post more carefully.


-- 
G.Etly 




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

Date: Sat, 10 May 2008 21:26:54 -0400
From: George Neuner <gneuner2/@/comcast.net>
Subject: Re: implementation for Parsing Expression Grammar?
Message-Id: <vdhc245g2fh8que71re3beuok2i5e8snm9@4ax.com>

On Fri, 9 May 2008 22:52:30 -0700 (PDT), "xahlee@gmail.com"
<xahlee@gmail.com> wrote:

>In the past weeks i've been thinking over the problem on the practical
>problems of regex in its matching power. For example, often it can't
>be used to match anything of nested nature, even the most simple
>nesting. It can't be used to match any simple grammar expressed by
>BNF. Some rather very regular and simple languages such as XML, or
>even url, email address, are not specified as a regex. (there exist
>regex that are pages long that tried to match email address though)

What's your point?  The limitations of regular expressions are well
known.

>After days of researching this problem, looking into parsers and its
>theories etc, today i found the answer!!
>
>What i was looking for is called Parsing Expression Grammar (PEG).

PEG has its own problems - it's very easy with PEG to create subtly
ambiguous grammars for which quite legal looking input is rejected.
And there are no good tools to analyze a PEG and warn you of subtle
problems.

Chris Clark (YACC++) has posted at length about the merits, problems
and limitations of various parse techniques - including PEG - in
comp.compilers.  Before you consider doing anything with PEG I suggest
you look up his posts and read the related threads.


>It seems to me it's already in Perl6, and there's also a
>implementation in Haskell. Is the perl6 PEG is in a usable state?
>
>Thanks.
>
>  Xah
>  xah@xahlee.org
>? http://xahlee.org/

George
--
for email reply remove "/" from address


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

Date: Sun, 11 May 2008 10:46:16 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Net::SMTP fails
Message-Id: <slrng2dciv.v9m.hjp-usenet2@hrunkner.hjp.at>

On 2008-05-09 19:07, smallpond <smallpond@juno.com> wrote:
> Peter J. Holzer wrote:
>> On 2008-05-07 20:10, smallpond <smallpond@juno.com> wrote:
>>>This line:
>>>250-AUTH LOGIN PLAIN XYMCOOKIE
>>>says that you must authenticate with one of the types: LOGIN, PLAIN or XYMCOOKIE.
>> 
>> 
>> No, it says that you *can* authenticate using one of these methods. 
>
> The response from the server when Dave tried not authenticating already told us
> that you *must* authenticate:
>
> Net::SMTP=GLOB(0x82ccfac)<<< 530 authentication required

You will notice that "250-AUTH LOGIN PLAIN XYMCOOKIE" and "530
authentication required" are not the same message.

The fist means "This server supports the following authentication
methods and you can authenticate yourself using any of them". It doesn't
say that authentication is required, only that it is possible. It may be
the case the authentication is required for some specific operations,
but again, this message doesn't tell you for which. (as a bit of
anectotal evidence, in late 2005 I was collecting statistics about ESMTP
extensions: AUTH was announced by 50 % of the MXs we were sending mail
to - but we could send mail to them just fine, no authentication was
required).

The second message means: "authentication is required for this specific
operation" (probably a RCPT command). This one says that you *must*
authenticate, and the earlier response to EHLO told you which methods
you *can* use.


> So are you suggesting that Dave try to authenticate with a method not from the list?

No. I wasn't suggesting anything to the OP, I was just correcting your
mistaken statement about what the response to EHLO means.

(In fact I haven't seen anything from the OP that indicates that he
tried to authenticate at all, so I'd suggest that he try to authenticate
using a method from the list, but maybe I missed a posting)

	hp



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

Date: Sun, 11 May 2008 04:42:18 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sun May 11 2008
Message-Id: <K0ot2I.1A9J@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

ACH-Builder-0.03
http://search.cpan.org/~tkeefer/ACH-Builder-0.03/
Tools for Building ACH (Automated Clearing House) Files 
----
AnyEvent-3.4
http://search.cpan.org/~mlehmann/AnyEvent-3.4/
provide framework for multiple event loops 
----
AnyEvent-AIO-1.0
http://search.cpan.org/~mlehmann/AnyEvent-AIO-1.0/
truly asynchronous file and directrory I/O 
----
AnyEvent-BDB-1.0
http://search.cpan.org/~mlehmann/AnyEvent-BDB-1.0/
truly asynchronous berkeley db access 
----
BDB-1.5
http://search.cpan.org/~mlehmann/BDB-1.5/
Asynchronous Berkeley DB access 
----
Continuity-REPL-0.01
http://search.cpan.org/~awwaiid/Continuity-REPL-0.01/
Use a Devel::REPL on a Continuity server 
----
Coro-4.7
http://search.cpan.org/~mlehmann/Coro-4.7/
coroutine process abstraction 
----
DBD-Pg-2.7.0
http://search.cpan.org/~turnstep/DBD-Pg-2.7.0/
PostgreSQL database driver for the DBI module 
----
DBIx-Class-Schema-Slave-0.02200
http://search.cpan.org/~travail/DBIx-Class-Schema-Slave-0.02200/
DBIx::Class::Schema for slave (EXPERIMENTAL) 
----
Devel-CoverX-Covered-0.008
http://search.cpan.org/~johanl/Devel-CoverX-Covered-0.008/
Collect and report caller (test file) and covered (source file) statistics from the cover_db 
----
Fault-1.00
http://search.cpan.org/~daleamon/Fault-1.00/
----
File-Path-2.06_01
http://search.cpan.org/~dland/File-Path-2.06_01/
Create or remove directory trees 
----
Games-RolePlay-MapGen-1.2.0
http://search.cpan.org/~jettero/Games-RolePlay-MapGen-1.2.0/
The base object for generating dungeons and maps 
----
IO-AIO-3.0
http://search.cpan.org/~mlehmann/IO-AIO-3.0/
Asynchronous Input/Output 
----
IO-AIO-3.01
http://search.cpan.org/~mlehmann/IO-AIO-3.01/
Asynchronous Input/Output 
----
Jcode-2.07
http://search.cpan.org/~dankogai/Jcode-2.07/
Japanese Charset Handler 
----
Lingua-JA-Kana-0.03
http://search.cpan.org/~dankogai/Lingua-JA-Kana-0.03/
Kata-Romaji related utilities 
----
MP4-File-0.05
http://search.cpan.org/~mhx/MP4-File-0.05/
Read/Write MP4 files 
----
MP4-File-0.06
http://search.cpan.org/~mhx/MP4-File-0.06/
Read/Write MP4 files 
----
Moose-0.44
http://search.cpan.org/~stevan/Moose-0.44/
A postmodern object system for Perl 5 
----
Muldis-D-0.28.1
http://search.cpan.org/~duncand/Muldis-D-0.28.1/
Formal spec of Muldis D relational DBMS lang 
----
PerlIO-Util-0.09
http://search.cpan.org/~gfuji/PerlIO-Util-0.09/
A selection of general PerlIO utilities 
----
RT-Client-REST-0.36
http://search.cpan.org/~dams/RT-Client-REST-0.36/
talk to RT installation using REST protocol. 
----
Runops-Hook-0.03
http://search.cpan.org/~nuffin/Runops-Hook-0.03/
DEPRECATED (all functionality merged into Runops::Trace 
----
Runops-Trace-0.10
http://search.cpan.org/~nuffin/Runops-Trace-0.10/
Trace your program's execution 
----
Sepia-0.96_02
http://search.cpan.org/~seano/Sepia-0.96_02/
Simple Emacs-Perl Interface 
----
ShipIt-0.52
http://search.cpan.org/~bradfitz/ShipIt-0.52/
software release tool 
----
Sjis-0.17
http://search.cpan.org/~ina/Sjis-0.17/
Source code filter for ShiftJIS script 
----
TM-View-0.2
http://search.cpan.org/~alphazulu/TM-View-0.2/
Topic Maps, Views and Listlets 
----
Test-Fixture-DBIC-Schema-0.02
http://search.cpan.org/~tokuhirom/Test-Fixture-DBIC-Schema-0.02/
load fixture data to storage. 
----
Text-Wrapper-1.02
http://search.cpan.org/~cjm/Text-Wrapper-1.02/
Simple word wrapping routine 
----
Variable-Magic-0.16
http://search.cpan.org/~vpit/Variable-Magic-0.16/
Associate user-defined magic to variables from Perl. 
----
Weather-Google-0.03
http://search.cpan.org/~possum/Weather-Google-0.03/
Perl interface to Google's Weather API 


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


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

Date: Sat, 10 May 2008 19:16:18 -0700 (PDT)
From: kronecker@yahoo.co.uk
Subject: Re: Printing a new line
Message-Id: <46d91c39-bc90-4d37-8bcf-287e16d8ff21@c19g2000prf.googlegroups.com>

On May 11, 10:09 am, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
> kronec...@yahoo.co.uk wrote in news:1581fc33-6137-44a8-b363-
> d15a01698...@d19g2000prm.googlegroups.com:
>
> > Sounds simple enough.
>
> > I am printing to a text file file
>
> > open (example, ">remote.txt") || die ("Could not open file. $!");
>
> The recommended convention, if you are going to use bareword
> filehandles, is to use all upper case. On the otherhand, such
> filehandles are package local which means they can be the source of
> hard-to-track bugs. I would recommend:
>
> my $remote_file = 'remote.txt';
>
> open my $example, '>', $remote_file
>     or die "Cannot open '$remote_file': $!";
>
> > print example ($first_name);
> >  print example ($last_name);
>
> print $example "$_\n" for ( $first_name, $last_name );
>
> > close (example);
>
> Check on errors on close as well, especially if you opened the file for
> writing.
>
>
>
> > I have tried putting \n but it gives errors.
>
> This is not helpful. Where did you try to put \n?
>
> If you are using 5.10, you can just use the new say function to append a
> newline automatically to every line you print.
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> use 5.010;
>
> my ($first_name, $last_name) = qw( first last );
>
> my $remote_file = 'remote.txt';
>
> open my $example, '>', $remote_file
>     or die "Cannot open '$remote_file': $!";
>
> say $example $_ for ( $first_name, $last_name );
>
> close $example
>     or die "Error closing '$remote_file': $!";
>
> __END__
>
> C:\Temp> t
>
> C:\Temp> cat remote.txt
> first
> last
>
> --
> A. Sinan Unur <1...@llenroc.ude.invalid>
> (remove .invalid and reverse each component for email address)
>
> comp.lang.perl.misc guidelines on the WWW:http://www.rehabitation.com/clpmisc/

I tried this and it gave me errors

 print example ($first_name\n);
 print example ($last_name\n);


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

Date: Sun, 11 May 2008 03:04:40 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Printing a new line
Message-Id: <pvnc24pkimqpltvn6q38pa3me19e8ctgb1@4ax.com>

kronecker@yahoo.co.uk wrote:
>On May 11, 10:09 am, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
>> kronec...@yahoo.co.uk wrote in news:1581fc33-6137-44a8-b363-
[inserting line break in output]
>> > I have tried putting \n but it gives errors.
>>
>> This is not helpful. Where did you try to put \n?
>
>I tried this and it gave me errors
>
> print example ($first_name\n);
> print example ($last_name\n);

Well, the way you wrote that the second argument to print is an
expression, similar to e.g. 
	print example ($foo + 35);
except that instead of the plus operator you were using the backslash
operator which creates a reference to n. And that doesn't make any sense
for several reasons.

\n represents a line break _INSIDE_OF_A_DOUBLE-QUOTED_STRING_  but of
course not when used as a standalone term.
So just use a double-quoted string:
	print example "$first_name\n";
	print example "$last_name\n";

Of course you can do that in a single print statement, too:
	print example "$first_name\n$last_name\n";

jue


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

Date: Sun, 11 May 2008 03:59:50 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Printing a new line
Message-Id: <Xns9A9AF41C72ED4asu1cornelledu@127.0.0.1>

kronecker@yahoo.co.uk wrote in
news:46d91c39-bc90-4d37-8bcf-287e16d8ff21@c19g2000prf.googlegroups.com: 

< snip full quote ... you didn't read what I wrote anyway >

>> --

Don't quote sigs.

> I tried this and it gave me errors
> 
>  print example ($first_name\n);
>  print example ($last_name\n);

You should not post questions if you are not going to bother to read the 
responses.

Sinan
-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/


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

Date: Sun, 11 May 2008 02:30:29 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: regex problem unresolved
Message-Id: <lquhf5-qog.ln1@osiris.mauzo.dyndns.org>


Quoth Ben Bullock <benkasminbullock@gmail.com>:
> 
> As far as I know, it's possible to install Perl into a local account. It 
> doesn't have to be installed globally. The last time I did this was about 
> 1996, so I'm not 100% sure about nowadays, but I'm fairly sure it should 
> be possible.

It's certainly possible (I've got about 16 versions of perl installed
here under my own user account) but it's by no means easy if you aren't
familiar with building perl from source.

<snip>
> So the problem is where the match is taking place? To find the line where 
> the match is taking place involves carefully looking at the source code. 
> Unfortunately there is no particular magic trick which will solve this 
> problem for you. You will have to actually understand what the program is 
> doing to solve this problem. In these circumstances one useful start is 
> to sprinkle "print" statements throughout the code.

Another would be to put something like

    use Carp qw/confess/;

    $SIG{__DIE__} = sub { confess $_[0] };

somewhere near the top of the program, which should give you a complete
stack trace when the error occurs.

Ben

-- 
You poor take courage, you rich take care:
The Earth was made a common treasury for everyone to share
All things in common, all people one.
'We come in peace'---the order came to cut them down.       [ben@morrow.me.uk]


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

Date: Sun, 11 May 2008 03:13:40 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: regex problem unresolved
Message-Id: <3goc24td8dssdtdsbufik9eb4fd7b5eqve@4ax.com>

Ben Bullock <benkasminbullock@gmail.com> wrote:
>> And there's
>> a single line of error saying "Invalid [] range "l-c" in regex; marked
>> by <-- HERE in m/^3-oxoacyl-[acyl-c
>> <-- HERE arrier protein] reductase fabg1$/"
>
>What you need to do is to use \Q \E around the string which is causing 
>the problems. In my example code:
>
>if (/\Q$matchingstring\E/) { # 
>	print "Hallo Ela!\n"
>}

Actually I respectfully disagree. If the OP wants to compare two strings
then index() or even a simple 'eq' is the tool of choice. 

Using the \Q...\E method will work, but it is like filing the fin of a
hammer to fit a Philips screw head because you realized that pounding in
the screw doesn't work and you don't know how to use a screw drivers (I
know you do, but speaking in general).

jue


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

Date: Sun, 11 May 2008 03:15:45 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: regex problem unresolved
Message-Id: <20pc24lpn0egmn4e1kai95vfkqceu9a4sd@4ax.com>

Ben Morrow <ben@morrow.me.uk> wrote:
>Another would be to put something like
>
>    use Carp qw/confess/;
>
>    $SIG{__DIE__} = sub { confess $_[0] };
>
>somewhere near the top of the program, which should give you a complete
>stack trace when the error occurs.

Good advise, I will save this somewhere for myself.
However the OP seems to be pretty inexperienced wrt. programming. I
doubt that he will be able to put a stack trace to any use.

jue


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

Date: Sun, 11 May 2008 04:31:37 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: regex problem unresolved
Message-Id: <pt5if5-nnk.ln1@osiris.mauzo.dyndns.org>


Quoth Jürgen Exner <jurgenex@hotmail.com>:
> Ben Morrow <ben@morrow.me.uk> wrote:
> >Another would be to put something like
> >
> >    use Carp qw/confess/;
> >
> >    $SIG{__DIE__} = sub { confess $_[0] };
> >
> >somewhere near the top of the program, which should give you a complete
> >stack trace when the error occurs.
> 
> Good advise, I will save this somewhere for myself.

I have a little module Carp::AllVerb installed locally that just does
exactly this for __DIE__ and __WARN__; then when I'm having trouble
debugging something I can run

    perl -MCarp::AllVerb foo

and get lotsa stack traces :).

> However the OP seems to be pretty inexperienced wrt. programming. I
> doubt that he will be able to put a stack trace to any use.

This is possibly true; however, it should at least get him(?) a source
line number for the error, which we seem to have established his version
of perl doesn't give on its own.

Ben

-- 
For far more marvellous is the truth than any artists of the past imagined!
Why do the poets of the present not speak of it? What men are poets who can
speak of Jupiter if he were like a man, but if he is an immense spinning
sphere of methane and ammonia must be silent? [Feynmann]     ben@morrow.me.uk


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

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


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 1531
***************************************


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