[16682] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4094 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 22 14:05:41 2000

Date: Tue, 22 Aug 2000 11:05:26 -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: <966967524-v9-i4094@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 22 Aug 2000     Volume: 9 Number: 4094

Today's topics:
    Re: #ifdef filtering program ? (Martien Verbruggen)
        ActivePerl Install Failed sumera.shaozab@lmco.com
    Re: Assistance needed updating a script nobull@mail.com
    Re: Callling Java method with Perl <info@digitaltango.com>
    Re: Certain Items in a string <hartleh1@westat.com>
    Re: cgi newbie help needed <callgirl@la.znet.com>
    Re: cgi newbie help needed <tony_curtis32@yahoo.com>
    Re: cgi newbie help needed <flavell@mail.cern.ch>
    Re: Cookie problem (chrs in value) <bart.lateur@skynet.be>
    Re: Direct screen access (Teodor Zlatanov)
    Re: Forking in WinNT <jeffrey.l.susanj@boeing.com>
    Re: FTP module trouble <graham.wood@iona.com>
    Re: FTP module trouble nobull@mail.com
    Re: Gifgraph problems (Martien Verbruggen)
    Re: Gifgraph problems (brian d foy)
        grepmail 4.42 released <newspost@coppit.org>
    Re: help a newbie with writing to a file cornelhughes@netscape.net
        help with simple regexp - does my head in <kellym36@drink.bt.co.uk>
    Re: help with simple regexp - does my head in (Marcel Grunauer)
    Re: help with simple regexp - does my head in (Mike Stok)
    Re: help with simple regexp - does my head in <russ_jones@rac.ray.com>
    Re: help with simple regexp - does my head in (Marcel Grunauer)
    Re: help with simple regexp - does my head in (Mike Stok)
    Re: Help (Martien Verbruggen)
    Re: help: wanted perl programmer london <russ_jones@rac.ray.com>
    Re: help: wanted perl programmer london <mc@backwoods.org>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 23 Aug 2000 01:12:01 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: #ifdef filtering program ?
Message-Id: <slrn8q5620.5ap.mgjv@martien.heliotrope.home>

On Tue, 22 Aug 2000 14:22:58 GMT,
	sibban@my-deja.com <sibban@my-deja.com> wrote:
> I was wondering if there exists a filtering program
> already to process textfiles with C-style preprocessor
> directives (even nested ifdefs) such as:

It's called cpp, and if you have a C compiler installed it is installed
as well. Perl has the -P option, but that just uses the C preprocessor,
and only on the current source file.

# perl -MCPAN -e shell
cpan> i /cpp/
Module id = Filter::cpp
    DESCRIPTION  Filters script through C preprocessor
    CPAN_USERID  PMQS (Paul Marquess <Paul.Marquess@btinternet.com>)
    CPAN_VERSION 1.01
    CPAN_FILE    P/PM/PMQS/Filter-1.19.tar.gz
    DSLI_STATUS  bdcf (beta,developer,C,functions)
    INST_FILE    (not installed)

But I would definitely use a real C preprocessor, if at all possible.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | That's funny, that plane's dustin'
Commercial Dynamics Pty. Ltd.   | crops where there ain't no crops.
NSW, Australia                  | 


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

Date: Tue, 22 Aug 2000 17:06:20 GMT
From: sumera.shaozab@lmco.com
Subject: ActivePerl Install Failed
Message-Id: <8nubtq$rsa$1@nnrp1.deja.com>

Hello,

I am trying to install the latest verstion of ActivePerl for My Windows
NT workstation.  When I tried to install the Windows installer, I get
this error:

Internal Error 2336. 5, C:\TEMP\MSI766.tmp


A different tmp file gets created everytime I run the Installer program.

Any idea how I can resolve this problem?

TIA

SAS


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


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

Date: 22 Aug 2000 18:28:24 +0100
From: nobull@mail.com
Subject: Re: Assistance needed updating a script
Message-Id: <u9n1i5jjd3.fsf@wcl-l.bham.ac.uk>

blindemann@my-deja.com writes:

> Subject: Assistance needed updating a script

Please use the subject line to tell us something about what you are
asking.  Your subject line tells us nothing.

> I have the portion of the script that e-mails the user already in
> place, I just need to figure out how to add the contents of the
> file.

Add simply?  Or add as a MIME attachement?  I'm guessing you mean the
latter.  Try using the MIME modules.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Tue, 22 Aug 2000 17:18:09 GMT
From: "Etienne Laverdiere" <info@digitaltango.com>
Subject: Re: Callling Java method with Perl
Message-Id: <lByo5.167670$1h3.3076507@news20.bellglobal.com>

I finaly found a JPL-08201999.tar.gz module. Can I install it on my Active
State distribution?

Regards,

Etienne Laverdiere

<skesavan@my-deja.com> wrote in message news:8nu2sr$gep$1@nnrp1.deja.com...
> In article <Kyvo5.167322$1h3.3068407@news20.bellglobal.com>,
>   "Etienne Laverdiere" <info@digitaltango.com> wrote:
> > Hi all,
> >
> > can I call a Java Method from a Perl script?
>
>
> Check out JPL module - I think it comes with Perl 5.6.
>
>
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: Tue, 22 Aug 2000 13:20:32 -0400
From: Henry Hartley <hartleh1@westat.com>
Subject: Re: Certain Items in a string
Message-Id: <39A2B660.75FAB946@westat.com>


Ben Kennedy wrote:
> 
> In general, its easier to write Win32 filenames as
> 
> $filename = 'c:\long\path\to\filename.txt';

One thing to remember here though is that if you are writing just a path
that ends with a backslash, you still have to escape that last
backslash:

$filepath = 'c:\long\path\to\\' ;

Otherwise, you are escaping the ' instead and you will get a "Can't find
string terminator "'" anywhere before EOF" or "String found where
operator expected" or some such error message.

Henry Hartley


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

Date: Tue, 22 Aug 2000 08:46:07 -0700
From: "Godzilla!" <callgirl@la.znet.com>
Subject: Re: cgi newbie help needed
Message-Id: <39A2A03F.EDEFDB6A@la.znet.com>

Ben Graves wrote:
 
> I am trying to teach myself perl script for use in cgi 
> and want to know weather there is a way to get a perl cgi
> to load a web page (as in a url) after executing rather than
> just sending html code back directly to the browser.


"whether" Actually, "whether or not" for your context.

A rather noticeable unique idiom in writing, this 
"weather" is, an idiom I have noticed a person 
using for years.

You need to describe your goal with clarity and conciseness.
It is exceptionally unclear what you want to do. Shirley
you don't intend to be vague about your goal.

If you want your visitor to see this web page, your
script must return html code, either as a fetch or
as a location redirect. It is impossible to load
an average web page without returning html, by
one method or another.

If you are looking to save a web page, fetch this
web page and print it to a file. However, if you
don't return some data to your visitor, she or he
will receive a "Document Contains No Data" error
message. Most annoying.


Copy this script below, give it a name, upload then
point your browser to your new script. Take delight
in capturing some magic. Hope you have a decent sound
card and stereo system. Hmm... and not a Macintosh;
a Mac totally FUBARs a standard midi audio file.


Godzilla!



Don't forget to change your first line Perl locale.



#!/usr/local/bin/perl

  use LWP::Simple;

  print "Content-Type: text/html\n\n";

  $callgirl = get ("http://la.znet.com/~callgirl");

  print $callgirl;

exit;


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

Date: 22 Aug 2000 10:56:32 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: cgi newbie help needed
Message-Id: <87lmxpxpan.fsf@limey.hpcc.uh.edu>


[ dejeopardising ]

>> On Tue, 22 Aug 2000 16:04:48 +0100,
>> "Ben Graves" <ben.graves@virgin.net> said:

> Thanx for your help but could you explain how this is
> done with a code example please.

> Ben Graves.

> "Rafael Garcia-Suarez" <rgarciasuarez@free.fr> wrote in
> message
> news:slrn8q54h1.cpq.rgarciasuarez@rafael.kazibao.net...
>> Ben Graves wrote in comp.lang.perl.misc: >I am trying
>> to teach myself perl script for use in cgi and want to
>> know >weather there is a way to get a perl cgi to load
>> a web page (as in a url) >after executing rather than
>> just sending html code back directly to the >browser.
>> 
>> You can send a redirection header to the browser; a
>> popular way to do this is to use the redirect() method
>> of CGI.pm.
>> 
>> -- Rafael Garcia-Suarez

Your new text goes here please!!  Quote the bits you want
to reply to and only those bits.  Then add your new
content.

The following is a *template* which should point you in
the right direction.  I've squished the code somewhat for
brevity in a posting context:

    use CGI ':standard';
    my %tag_url_hash =
      (
        tony => 'http://...',
        homer => 'ftp://...',
        ...
      );
    my $tag = param('somefield');
    if (defined $tag) {
      my $url = $tag_url_hash{$tag};
      if (defined $url) {
        print redirect($url);
      } else {
        # unknown tag
      }
    } else {
      # possibly unknown form content
    }

hth
t
-- 
"I'm not easily impressed.  Wow!  A blue car!"
                                               Homer Simpson


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

Date: Tue, 22 Aug 2000 18:36:16 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: cgi newbie help needed
Message-Id: <Pine.GHP.4.21.0008221822230.25685-100000@hpplus03.cern.ch>

On Tue, 22 Aug 2000, Ben Graves wrote:

> Thanx for your help but could you explain how this is done with a code
> example please.

If you haven't already got it, go to the CGI.pm's home site
and get the HTML-format documentation.  It's free.
http://stein.cshl.org/WWW/software/CGI/

You're looking for the last topic, "Creating the Header for a
Redirection Request", in the section
http://stein.cshl.org/WWW/software/CGI/#header

If you have already got it, then show us the part that you're having
trouble with and someone will be sure to help.


The general feeling on this group is that we should teach people to
fish, rather than handing them out a ready-smoked kipper.  I'm just
trying to do my bit 'cos I happen to agree with that approach.

If you're seriously interested, buy the author's book.  Even if you
don't buy it, you can still browse the examples online.
http://www.wiley.com/compbooks/stein/

Actually, if you're going to do anything involving CGI, then you
probably _should_ take it seriously.  You're in effect writing an
extension to the web server: it's far too easy to create security
exposures if you don't approach the project with the due degree of
seriouseness.  Have fun with it too, of course.


And try to cure yourself of the upside-down quoting habit.  The
regulars will respect you for it.  CGI questions that are not
specifically about Perl programming belong on
comp.infosystems.www.authoring.cgi



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

Date: Tue, 22 Aug 2000 15:52:36 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Cookie problem (chrs in value)
Message-Id: <3535qssgp2t54ebbot2k3qgajotn1cn2ch@4ax.com>

Randal L. Schwartz wrote:

>Moral - stop using printf so much.  I can't recall the number
>of beginner programs that look like this:
>
>        printf $string;
>
>Gah!  Do they know what they just did?  Scary.

I personally would like printf() to be dropped from Perl, and leave only
sprintf() in. The reason you quote is one reason. The fact that it is
superfuous, is another. And thirdly, IMO, you should always format text
into strings, and not print it out straight away. But that may be just
my preference. You'd end up doing a lot of small writes to files, which
isn't optimal, since each takes quite an overhead.

-- 
	Bart.


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

Date: 22 Aug 2000 12:57:04 -0500
From: tzz@iglou.com (Teodor Zlatanov)
Subject: Re: Direct screen access
Message-Id: <39a2b0e0$1_2@news.iglou.com>

<8nu1im$1b22$1@news2.vas-net.net>:Chris Denman (chris@inta.net.uk):comp.lang.perl.misc:Tue, 22 Aug 2000 15:07:10 +0100:quote:
: I have tried to set a variable as an address to hex 0a000 and wrote a
: charater to that address, but perl came back with errors, saying that this
: area of memory has forbiden access.

The new CPAN (http://www.cpan.org) Inline module is supposed to work on
Windows machines.  You can try using it for direct memory access - I've
never tried it, and the Inline module is very new and might have bugs, but
it still might be useful to you and easier to learn than XS.

-- 
Teodor Zlatanov <tzz@iglou.com>
"Brevis oratio penetrat colos, longa potatio evacuat ciphos." -Rabelais


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

Date: Tue, 22 Aug 2000 16:15:40 GMT
From: "Jeff Susanj" <jeffrey.l.susanj@boeing.com>
Subject: Re: Forking in WinNT
Message-Id: <FzpBu6.93t@news.boeing.com>


reedjd@bitsmart.com wrote in message <8nsjr2$s3b$1@nnrp1.deja.com>...
>I'm having problems getting a forking application to work in WinNT with
>ActivePerl "This is perl, v5.6.0 built for MSWin32-x86-multi-thread"
>
>When I run the following App, I get Dr. Watson crash:
>could not attache to the application
>Windows NT Error Code = 87
>
>Code:
[snip]

Windows NT does not support fork.  I have used filehandles to create
parallel processes.

Jeff S.





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

Date: Tue, 22 Aug 2000 17:17:29 +0100
From: "Graham Wood" <graham.wood@iona.com>
Subject: Re: FTP module trouble
Message-Id: <8nu9fj$h5$1@bvweb.iona.com>

Hi Mike,

I'm just attempting the same sort of thing with FTP on OS/390. Here's where
I think you are at.

The Net::FTP module inherits from the Net::Cmd module.  This means that
methods available in Net::Cmd are available to you if you have:

use Net::FTP;

in your script.  You don't need to explicitly use Net::Cmd as well (I
think.)

The command you are looking for to run the unimplemented FTP client commands
is
$ftp->command("your command [args]");

where "your command" is the FTP command you want to send to the session, and
[args] are optional command line arguments for the command.

If the command you are trying to run is "edit mike.dat", for example,
$ftp->command("edit mike.dat");

should do it.

I haven't tried this yet but I did just successfully run "SITE FILEtype=JES"
via a perl script and an FTP session which was as non-standard as I've dared
so far and it appeared to work.

Hope this helps and is not balderdash.

Graham Wood


mike <mike@hulenbend.net> wrote in message
news:8ns9b4$oju3@news1.lmtas.lmco.com...
> I am very poor working with modules and I obviously have some problems
here,
> I think in the way I am attempting to call Net::Cmd.
>
> I guess  " @ISA = qw(Net::Cmd); " is an array of commands that I can use,
> but I don't understand how they should be applied.
>
> Any help is appreciated.
>
> Mike
>
>      #! /usr/bin/perl -w
>      #
>      # this is ftp_ex.pl
>      #
>      # this code connects to the mainframe and processes commands
>      #
>
>      use Net::FTP;
>      use Net::Cmd;
>
>      my $username = "\myid";
>      my $password = "mypass";
>      my $host = "tn3270.mainframe.com";
>
>      my $ftp = Net::FTP->new("$host", Debug => 1);
>
>      unless ( $ftp->login($username, $password) )
>       {
>       print "Not in\n";
>       }
>       else
>       {
>       print "Logged in\n";
>       }
>
>      @ISA = qw(Net::Cmd);
>
>      $ftp->qw("edit");                        #tso edit command
>      $ftp->qw("mike.data");               #the name of the file
>
>      $ftp->qw("input");                      #input is a  subcommand of
edit
>      $ftp->qw("this is a text line");     #here is the text
>      $ftp->qw("save");                      #save is a subcommand of edit
>      $ftp->qw("end");                       #end the edit session
>
>      $ftp->quit;
>
> here is the output :::
>
>
>      Net::FTP: Net::FTP(2.33)
>      Net::FTP:   Exporter
>      Net::FTP:   Net::Cmd(2.11)
>      Net::FTP:   IO::Socket::INET
>      Net::FTP:     IO::Socket(1.1603)
>      Net::FTP:       IO::Handle(1.1505)
>
>      Net::FTP=GLOB(0xc72a4)<<< 220-TCPFTP IBM MVS V3R2 at
>      mainframe.com, 14:
>      37:21 on 2000/08/21
>      Net::FTP=GLOB(0xc72a4)<<< 220 Connection will close if idle
>      for more than 5 minu
>      tes.
>      Net::FTP=GLOB(0xc72a4)>>> user myid
>      Net::FTP=GLOB(0xc72a4)<<< 331 Send password please.
>      Net::FTP=GLOB(0xc72a4)>>> PASS ....
>      Net::FTP=GLOB(0xc72a4)<<< 230 myid is logged on.  Working
>      directory is "myid.".
>      Logged in
>
>      Can't locate auto/Net/FTP/qw.al in @INC (@INC contains:
>      /applocal/lib/perl5/5.00
>      502/sun4-solaris /applocal/lib/perl5/5.00502
>      /applocal/lib/perl5/site_perl/5.005
>      /sun4-solaris /applocal/lib/perl5/site_perl/5.005 .) at
>      ftp_cmd.pl line 31
>
>      Net::FTP=GLOB(0xc72a4)>>> QUIT
>      Net::FTP=GLOB(0xc72a4)<<< 221 Quit command received. Goodbye.
>
>




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

Date: 22 Aug 2000 18:10:49 +0100
From: nobull@mail.com
Subject: Re: FTP module trouble
Message-Id: <u9snrxjk6e.fsf@wcl-l.bham.ac.uk>

"mike" <mike@hulenbend.net> writes:

> I am very poor working with modules and I obviously have some problems here,

For documentation on a module type "perldoc" followed by the module name.

For information on using Net::FTP type:

perldoc Net::FTP

> I think in the way I am attempting to call Net::Cmd.

AFAICS, you are not attempting to call Net::Cmd.
 
> I guess

Why do you guess?   You have manuals don't you?

>  " @ISA = qw(Net::Cmd); " is an array of commands that I can use,

For an explaination of @ISA see "perldoc perlobj".  The above
statement should only appear when you are defining a sub-class of
Net::Cmd.

You should _not_ be modifying @ISA outside of a package (i.e. in the
package main:: namespace). Where did you get the idea that you should
modify @main::ISA?

>      $ftp->qw("edit");                        #tso edit command


Net::FTP has no method called qw(), what made you think that it did?
What did you think that it did?

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Wed, 23 Aug 2000 00:55:01 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Gifgraph problems
Message-Id: <slrn8q5525.5ap.mgjv@martien.heliotrope.home>

[comp.lang.perl removed. Doesn't exist anymore. Inform your news admin]

On Tue, 22 Aug 2000 14:37:56 +0300,
	Sorana Fraier <sorana@bgumail.bgu.ac.il> wrote:
> I'm trying to draw a pie/bar chart after searching publications through a
> certain database (ENTREZ).
> The search is performed correctly. A filename.gif is created but with zero
> size.
> The error I get is:
> 
> Data array 1: 
> length misfit at /usr/local/lib/perl5/site_perl/5.005/GIFgraph.pm line 316, 
> <ENTREZ> line 31. 

That's an old version of GIFgraph you've got there. I believe that it
means that one of the data sets you are feeding it isn't of the same
length as the other ones (I have to use my memory here, because I'm
simply too lazy right now to check out all the old versions of GIFgraph
from CVS).

> The subroutine which draws the graph is:
> 
> sub create_pie {
>   
>   my (@publications_per_year) = @_;
>   my (@X) = ();
>   my (@Y) = ();   
>   @X=("1995","1996","1997","1998","1999","2000");
>   @Y=(@publications_per_year);

@publications_per_year better have exactly 6 entries, or this will fail.

>   @data = ([@X],[@Y]);

@data = ([@X], [@publications_per_year]);

or even

@data = (\@X, \@publications_per_year);

would also work. I'm pretty certain that GIFgraph never modifies the
arrays you pass it. GD::Graph (the newer versions) certainly don't.

Do something like:

print "X: ", scalar @X, "\n";
print "Y: ", scalar @Y, "\n";

If those numbers don't match, you need to make sure they do. A good way
of doing that would be to get the X and Y data from your database query
in one go.

> There isn't any chances of missing data within the array which should
> replaced by undef. Any ideas will be highly appreciated.

I'm not sure what you mean by that....

> Please email personally also to
> sorana@bgumail.bgu.ac.il

Ok.. But only in this very special case, since you could as well have
emailed this to me directly (which is what most people seem to do). I
normally don't do that at all, and would have told you to expect an
answer on the newsgroup only if you post.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Can't say that it is, 'cause it
Commercial Dynamics Pty. Ltd.   | ain't.
NSW, Australia                  | 


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

Date: Tue, 22 Aug 2000 11:40:39 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Gifgraph problems
Message-Id: <brian-ya02408000R2208001140390001@news.panix.com>

In article <Pine.OSF.4.21.0008221424110.5002-100000@sansana.bgu.ac.il>, Sorana Fraier  <sorana@bgumail.bgu.ac.il> posted:

> I'm trying to draw a pie/bar chart after searching publications through a
> certain database (ENTREZ).
> The search is performed correctly. A filename.gif is created but with zero
> size.
> The error I get is:
> 
> Data array 1: 
> length misfit at /usr/local/lib/perl5/site_perl/5.005/GIFgraph.pm line 316, 
> <ENTREZ> line 31. 

the array references you passed to the plotter contained arrays
of different lengths.  make sure that don't :)

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


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

Date: Sat, 19 Aug 2000 22:31:39 -0400
From: David Coppit <newspost@coppit.org>
Subject: grepmail 4.42 released
Message-Id: <sq585p2at917@corp.supernews.com>

Description:
- grepmail is a Perl program that searches a normal or compressed mailbox
  (gzip, bzip2, or tzip) for a given regular expression and returns those
  emails that match the query. It also supports searches constrained by date
  and size.

Download:
- You can download grepmail 4.42 from CPAN:
  http://www.cpan.org/authors/id/D/DC/DCOPPIT/grepmail-4.42.tar.gz
- Until the file propagates to the mirrors, you can use the following URL:
  http://download.sourceforge.net/grepmail/grepmail-4.42.tar.gz

Changes:
- Added -a flag to use received date instead of sent date for -d matches.
- Included emails are now ignored properly
- If an email has no date, the -d switch now issues a warning and does not
  treat the email as a match
- -d "" can be used to find emails without dates
- Mailbox files are now detected as files using 
  if ($buffer =~ /^(X-From-Line:|From) /im && $buffer =~ /^Subject: /im)
  rather than
  if ($buffer =~ /^(X-From-Line:|From) /im && $buffer =~ /^Date: /im)
- Improved detection of binary files
- STDERR and STDOUT now checked separately during "make test"
- Headers can now be in the format "Date:<tab>" in addition to "Date: "

A complete change log is at:
- ftp://grepmail.sourceforge.net/pub/grepmail/CHANGES 

Thanks,
David

_________________________________________________________________________
David Coppit - Graduate Student        david@coppit.org      
The University of Virginia             http://coppit.org/
    "Yes," said Piglet, "Rabbit has Brain." There was a long silence.
"I suppose," said Pooh, "that that's why he never understands anything."




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

Date: Tue, 22 Aug 2000 15:50:42 GMT
From: cornelhughes@netscape.net
Subject: Re: help a newbie with writing to a file
Message-Id: <8nu7g9$m3k$1@nnrp1.deja.com>

It was a permission problem, thanks

In article <8nrgf1$h0a$1@nnrp1.deja.com>,
  Rodney Engdahl <red_orc@my-deja.com> wrote:
> In article <8nrfur$gga$1@nnrp1.deja.com>,
>   cornelhughes@netscape.net wrote:
> > I have a script that when I try to open a file to write to it
> >
> > sub put_entry {
> >    $file = ">".$pickdbase;
> >    open(FILE, $file) || die "Couldn't open $file";
>
> if you change this line to:
>
>     open(FILE, $file) || die "Couldn't open $file, $!";
>
> you will get more information, and may be able to determine the
problem.
> However, if you can read from the file but not write to it, sounds
like
> the write permissions for the file are set wrong.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


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


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

Date: Tue, 22 Aug 2000 16:55:42 +0100
From: john kelly <kellym36@drink.bt.co.uk>
Subject: help with simple regexp - does my head in
Message-Id: <39A2A27D.8D9132FB@drink.bt.co.uk>

evenin all..


im stuck trying to split off the beginning of  a string at '='

ie.

'attrval=monkey'
   becomes
'monkey'

been poring over the manuals for ages & i cant do it-

cheers:)



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

Date: Tue, 22 Aug 2000 16:00:03 GMT
From: marcel@codewerk.com (Marcel Grunauer)
Subject: Re: help with simple regexp - does my head in
Message-Id: <slrn8q58rb.c25.marcel@gandalf.local>

On Tue, 22 Aug 2000 16:55:42 +0100, john kelly <kellym36@drink.bt.co.uk> wrote:

>im stuck trying to split off the beginning of  a string at '='
>
>'attrval=monkey'
>   becomes
>'monkey'

Using a regex:

    $_="attrval=monkey";
    s/^(.*?)=//;

Or you could use a combination of index() and substr().

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


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

Date: Tue, 22 Aug 2000 16:19:24 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: help with simple regexp - does my head in
Message-Id: <gKxo5.8999$C5.139491@typhoon.austin.rr.com>

In article <39A2A27D.8D9132FB@drink.bt.co.uk>,
john kelly  <kellym36@drink.bt.co.uk> wrote:

>im stuck trying to split off the beginning of  a string at '='
>
>ie.
>
>'attrval=monkey'
>   becomes
>'monkey'
>
>been poring over the manuals for ages & i cant do it-

What have you tried to do so far?

If you can guarantee that there's only one = in the string then

  $string =~ s/.*=//;

might suffice, but you should read the perlre man page (perl regular
expressions) to see what's going on.  If there can be more than one = 
sign then you should look up quantifiers in the manual page, and 
understand what greedy means.

As this is perl there are many ways to do it.

Hope this helps,

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |
GPG PGP Key 1024D/059913DA         | Fingerprint      0570 71CD 6790 7C28 3D60
stok@colltech.com (CT - work)      |                  75D2 9EC4 C1C0 0599 13DA


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

Date: Tue, 22 Aug 2000 11:20:48 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: help with simple regexp - does my head in
Message-Id: <39A2A860.67E0F11C@rac.ray.com>

john kelly wrote:
> 
> evenin all..
> 
> im stuck trying to split off the beginning of  a string at '='
> 
> ie.
> 
> 'attrval=monkey'
>    becomes
> 'monkey'
> 


You don't need a regexp, you can use split:

	(undef $attrval) = split('=',$orig_field,2);

See the previous response for the regexp solution. 

-- 
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747

Quae narravi, nullo modo negabo. - Catullus


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

Date: Tue, 22 Aug 2000 16:53:01 GMT
From: marcel@codewerk.com (Marcel Grunauer)
Subject: Re: help with simple regexp - does my head in
Message-Id: <slrn8q5bv6.e21.marcel@gandalf.local>

On Tue, 22 Aug 2000 11:20:48 -0500, Russ Jones <russ_jones@rac.ray.com> wrote:

>> 'attrval=monkey'
>>    becomes
>> 'monkey'
>
>You don't need a regexp, you can use split:
>
>	(undef $attrval) = split('=',$orig_field,2);
>

That should probably be a comma between the 'undef' and the '$attrval'.

But in this case I'd rather use a slice:

    $attrval = (split("=", $orig_field, 2))[1]


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


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

Date: Tue, 22 Aug 2000 16:54:44 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: help with simple regexp - does my head in
Message-Id: <ofyo5.14607$K5.219885@typhoon.austin.rr.com>

In article <39A2A860.67E0F11C@rac.ray.com>,
Russ Jones  <russ_jones@rac.ray.com> wrote:

>You don't need a regexp, you can use split:
>
>	(undef $attrval) = split('=',$orig_field,2);
>
>See the previous response for the regexp solution. 

Note that with split the first argument is a pattern, unless it's ' ' which
makes split behave specially and split on whitespace ignoring leading white-
space and split uses a whitespace pattern internally to do the split.  So
this is using a regular expression, albeit a simple single character e.g.

  $attrval = (split( /=/, $orig_field, 2 ))[-1];

Hope this helps,

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |
GPG PGP Key 1024D/059913DA         | Fingerprint      0570 71CD 6790 7C28 3D60
stok@colltech.com (CT - work)      |                  75D2 9EC4 C1C0 0599 13DA


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

Date: Wed, 23 Aug 2000 01:00:16 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Help
Message-Id: <slrn8q55c0.5ap.mgjv@martien.heliotrope.home>

On Tue, 22 Aug 2000 15:07:31 +0200,
	Paulino <paulino@jccm.es> wrote:
> Sorry, but I haven“t expleined the problem clearly
> 
> I need to change the table where is the program2.gif text by a table with
> other tags.
[snip]
> 
> If i aply the Regular Expresion
> 's/<table>.*?program2.gif.*?\/table>/$tablenew/igs' i get it next:

Don't try to do this with regular expressions. This gets discussed here
about once every week on this particular newsgroup. Get yourself the
HTML::Parser module, and use that. Or maybe Parse::RecDescent can do it.

Also see Perl FAQ, section 9
# perldoc perlfaq9
[snip]
       How do I remove HTML from a string?
[snip]

Even though that question isn't _exactly_ what you asked, it is close
enough. With HTML::Parser, or rather, a subclass of it, you find
yourself the node your looking for, find the enclosing table, and you
have what you want.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Unix is user friendly. It's just
Commercial Dynamics Pty. Ltd.   | selective about its friends.
NSW, Australia                  | 


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

Date: Tue, 22 Aug 2000 10:39:05 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: help: wanted perl programmer london
Message-Id: <39A29E99.FAE3636F@rac.ray.com>

eldras@my-deja.com wrote:
> 
> anyone up for £1000?  bit of medling with my web page.
> html, javascript and web knowledge. london only
> 

I'd piss for £1000. I'd even be willing to drink a lot of beer and try
and increase my output!


-- 
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747

Quae narravi, nullo modo negabo. - Catullus


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

Date: Tue, 22 Aug 2000 12:37:16 -0400
From: MC <mc@backwoods.org>
Subject: Re: help: wanted perl programmer london
Message-Id: <39A2AC3C.97D28C3F@backwoods.org>

naaa i might write his script for that, but it might still have a few bugs,
maybe a couple *ahem* intentional ones <VEG>

mc

Russ Jones wrote:
> 
> eldras@my-deja.com wrote:
> >
> > anyone up for £1000?  bit of medling with my web page.
> > html, javascript and web knowledge. london only
> >
> 
> I'd piss for £1000. I'd even be willing to drink a lot of beer and try
> and increase my output!
> 
> --
> Russ Jones - HP OpenView IT/Operatons support
> Raytheon Aircraft Company, Wichita KS
> russ_jones@rac.ray.com 316-676-0747
> 
> Quae narravi, nullo modo negabo. - Catullus

-- 
---------------------------------------------------------------------
My email address(s) are my private property.  They are NOT to be used
or recorded for ANY reason without my explicit permission.  Disregard
of this statement is in violation of federal privacy & copyright law.
---------------------------------------------------------------------
"The world wont end with a bang, or even a whimper, but with an error
message." -- format C:


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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


------------------------------
End of Perl-Users Digest V9 Issue 4094
**************************************


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