[13365] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 775 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 13 09:07:17 1999

Date: Mon, 13 Sep 1999 06:05:10 -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           Mon, 13 Sep 1999     Volume: 9 Number: 775

Today's topics:
    Re: /etc/passwd (Malcolm Ray)
        another RE problem <m.scheferhoff@gmx.de>
    Re: another RE problem <jeffp@crusoe.net>
        BUG: RH 5.2/perl 5.004_05, RH6.0/perl 5.005_03 <mgoheen@noname.com>
        Check Password from /etc/passwd on Linux (UNIX) <krajzewicz@inx.de>
    Re: Check Password from /etc/passwd on Linux (UNIX) <bauer@zrz.tu-berlin.de>
        Deleting spaces in a string <vbezard@atos-group.com>
    Re: Deleting spaces in a string <nick.condon@tamesis.com>
    Re: Deleting spaces in a string <jeffp@crusoe.net>
    Re: Deleting spaces in a string <nick.condon@tamesis.com>
    Re: Design Advice needed on Sending Data to Client (Ron Grunwald-Computer Programmer PGS Tensor Perth)
    Re: Design Advice needed on Sending Data to Client (Kragen Sitaker)
    Re: How to make clean the text with screen control char <tchrist@mox.perl.com>
        install_driver(mysql) failed: HELP <ml@marklord.net>
        parsing a record at specific columns <pleduc@your_finger.home.com>
    Re: parsing a record at specific columns <jeffp@crusoe.net>
        Problem with PGP::Sign in a CGI script <grimoire@twisted.gothicdreams.net>
        Question about @_ / $_ <krajzewicz@inx.de>
    Re: Question about @_ / $_ <mark.winder@virgin.net>
    Re: Question about @_ / $_ (Graham Ashton)
    Re: Question about @_ / $_ <jeffp@crusoe.net>
    Re: Reading symbolic links <jeffp@crusoe.net>
        Regular Expresions <m.scheferhoff@gmx.de>
    Re: Regular Expresions <jeffp@crusoe.net>
    Re: Searching by date problem. <madebeer@igc.apc.org>
        Trouble installing DBM mSQL on Solaris. <mark.winder@virgin.net>
        Why perlcrt.dll needed? (G Crowder)
    Re: XML plus XSL to HTML? <nmorison@ozemail.com.au>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 13 Sep 1999 12:44:26 GMT
From: M.Ray@ulcc.ac.uk (Malcolm Ray)
Subject: Re: /etc/passwd
Message-Id: <slrn7tpsda.9nl.M.Ray@carlova.ulcc.ac.uk>

On Sat, 11 Sep 1999 20:57:23 GMT, Ubu <ubu@easynet.ca> wrote:
>In article <slrn7tla71.5ou.abigail@alexandra.delanet.com>,
>  abigail@delanet.com wrote:
>>
>> What part of the manual about crypting passwords didn't you
>understand?
>>
>> What is "a complete method for checking accounts"? Retina scans?
>>
>OK, I ordinarily try to stay away from potential flame wars, but I have
>to ask, just who is this 'Abigail' and what is she so angry about? I've
>been following this newsgroup more or less regularly for a while now and
>every single day seems to bring another string of insulting, demeaning,
>but ultimately unhelpful posts from 'Abigail' - Dear Abby indeed.

 ...plus a number of helpful articles.  Don't forget those.  The two
sets overlap, of course, but if you think Abigail posts *only* insults,
you haven't been paying attention.  I've learnt a fair amount about
Perl from reading Abigail's articles (but not about how to be a bastard:
I'm competent at that already).
-- 
Malcolm Ray                           University of London Computer Centre


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

Date: Mon, 13 Sep 1999 14:37:45 +0200
From: Michael Scheferhoff <m.scheferhoff@gmx.de>
Subject: another RE problem
Message-Id: <37DCF019.D877995D@gmx.de>

Hallo,

is there a possibility to find out, how often a string matched?

Michael



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

Date: Mon, 13 Sep 1999 08:41:53 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: another RE problem
Message-Id: <Pine.GSO.4.10.9909130840580.19013-100000@crusoe.crusoe.net>

> is there a possibility to find out, how often a string matched?

Yes, there are many ways.

Here are two.  My favorite is the bottom one, although some say it's a
little ugly because it creates a temporary list.

  $count++ while /match/g;

  $count = () = /match/g;

-- 
jeff pinyan    japhy@pobox.com
perl stuff     japhy+perl@pobox.com
CPAN ID: PINYAN            http://www.perl.com/CPAN/authors/id/P/PI/PINYAN



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

Date: Mon, 13 Sep 1999 07:20:16 -0400
From: "Matt Goheen" <mgoheen@noname.com>
Subject: BUG: RH 5.2/perl 5.004_05, RH6.0/perl 5.005_03
Message-Id: <x55D3.4605$X5.252315@typhoon.nyroc.rr.com>

The following script fails under the above mentioned OS/Perl versions:

------------------------------------------------
#!/usr/bin/perl
print STDERR "stderr 0\n";
warn "warn 0\n";

open SAVEERR, ">&STDERR";

open STDERR, ">foo.out" or die "can't redirect stderr";

print STDERR "stderr 1\n";
warn "warn 1\n";

close STDERR;

open STDERR, ">&SAVEERR";

print STDERR "stderr 2\n";
warn "warn 2\n";
-----------------------------------------------

Under Solaris 2.6 (Perl 5.004_04) and on NT 4.0 (Perl 5.005_03), it works fine.

Under the Linux systems, the final "warn" doesn't print.  "die" statements also
fail to output anything.

Anyone know if this has been fixed in some newer version of Perl under Linux, or is
it a Linux bug???  Any way to work around it under Linux?

    - Matt Goheen

P.S. Use "iname" in place of "noname" to reply directly via email.






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

Date: Mon, 13 Sep 1999 11:18:55 +0200
From: Daniel Krajzewicz <krajzewicz@inx.de>
Subject: Check Password from /etc/passwd on Linux (UNIX)
Message-Id: <37DCC17F.991774C5@inx.de>

Hello !!!

I just have a very small quesion :
if I know a users name and the password given by him, how can I
determine if the User belongs to my system. Currently I=B4m running
Linux, but it shall work for all systems.
By the way, I greatly invite to my site listed below, look esp. at
the chapter graphic/calendar-pictures and write an EMail (just click =

on "Daniel Krajzewicz"-Text...

thanks and bye,
Daniel Krajzewicz


-- =

 __________________________
<     Daniel Krajzewicz    >
 >------------------------<
<     krajzewicz@inx.de    >   =

 >------------------------<
< http://www.art-so-far.de >
 >------------------------<
<__________________________>


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

Date: Mon, 13 Sep 1999 12:00:06 +0200
From: Christoph Bauer <bauer@zrz.tu-berlin.de>
Subject: Re: Check Password from /etc/passwd on Linux (UNIX)
Message-Id: <37DCCB26.CE7F798E@zrz.tu-berlin.de>

Hi,
Daniel Krajzewicz wrote:
> 
> Hello !!!
> 
> I just have a very small quesion :
> if I know a users name and the password given by him, how can I
> determine if the User belongs to my system. Currently I´m running
> Linux, but it shall work for all systems.
I don't know about pw-shadow-files, NIS, etc.
Don't think you'll like my answer concerning win-compatiblity ;-)

just type
perldoc -f crypt.

Happy copy'n'pasting ;-)

Christoph


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

Date: Mon, 13 Sep 1999 13:11:55 +0200
From: "Vincent BEZARD" <vbezard@atos-group.com>
Subject: Deleting spaces in a string
Message-Id: <7rimes$dee$1@jaydee.iway.fr>

Please, help me,

I have a string witch looks like "23 6659 478", and I want to del all the
spaces, in order to get a interger like "236659478". I tried =~ s/\s+//, but
I still not work.
Thanks

-----------------------------------------------------------
Vincent BEZARD
641, Avenue du Grain d'Or
41350 VINEUIL
Tel: 02-54-52-51-87
Fax: 02-54-52-52-70
-----------------------------------------------------------




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

Date: Mon, 13 Sep 1999 12:26:15 +0100
From: Nick Condon <nick.condon@tamesis.com>
Subject: Re: Deleting spaces in a string
Message-Id: <37DCDF56.2DAC1D59@tamesis.com>

Vincent BEZARD wrote:

> Please, help me,
>
> I have a string witch looks like "23 6659 478", and I want to del all the
> spaces, in order to get a interger like "236659478". I tried =~ s/\s+//, but
> I still not work.

You need to add a g for "global" to the end of your string, i.e.:
s/\s+//g
The string you tried will only remove the first set of spaces, and give you
"236659 478", (which I expect you already know).
--
Nick Condon




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

Date: Mon, 13 Sep 1999 07:31:36 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Deleting spaces in a string
Message-Id: <Pine.GSO.4.10.9909130730000.19013-100000@crusoe.crusoe.net>

[posted & mailed]

On Sep 13, Vincent BEZARD blah blah blah:

> I have a string witch looks like "23 6659 478", and I want to del all the
> spaces, in order to get a interger like "236659478". I tried =~ s/\s+//, but

Such a popular question, it's in the FAQ.

from perlfaq4:

     How do I strip blank space from the beginning/end of a
     string?


-- 
jeff pinyan    japhy@pobox.com
perl stuff     japhy+perl@pobox.com
CPAN ID: PINYAN            http://www.perl.com/CPAN/authors/id/P/PI/PINYAN



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

Date: Mon, 13 Sep 1999 13:48:39 +0100
From: Nick Condon <nick.condon@tamesis.com>
Subject: Re: Deleting spaces in a string
Message-Id: <37DCF2A7.734122A3@tamesis.com>

Jeff Pinyan wrote:

> On Sep 13, Vincent BEZARD blah blah blah:
>
> > I have a string witch looks like "23 6659 478", and I want to del all the
> > spaces, in order to get a interger like "236659478". I tried =~ s/\s+//, but
>
> Such a popular question, it's in the FAQ.
>
> from perlfaq4:
>
>      How do I strip blank space from the beginning/end of a
>      string?

But that's not what he asked.

I know that this group is full of people who *love* to jump down people's throats
with "it's in the the FAQ", but you could at least read what he actually posted.
--
Nick Condon




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

Date: 13 Sep 1999 09:27:14 GMT
From: rong@news.pgs.com (Ron Grunwald-Computer Programmer PGS Tensor Perth)
Subject: Re: Design Advice needed on Sending Data to Client
Message-Id: <7rig1i$3db$1@news.hstn.tensor.pgs.com>

Caitlyn Hay (caithay@hotmail.com) wrote:
: I'm new to internet programming.  I have to write a server program that
: interacts with a client program.  Basically, the client program will submit
: a criteria to the server via a http connection.  Based on this criteria, the
: server will generate some ASCII formated data, and return it (the ASCII
: data) back to the client.

: What is the standard way of doing this?  My first thought was to send the
: ASCII data back to the client line by line.  But then, how would the client
: know how many lines there are?  On second thought, maybe I can save the
: ASCII data to a temp file, and let the client download it.  But then, what
: if there are more than one client request with different criteria - that
: means I have to generate different files.  All these questions pop up, I
: need to know the standard way of doing this?

: Any resources would be appreciated.
: TIA
: cait

I think sockets programming would be the ideal approach to your problem.
Sockets are easy to create and interacting with them using Perl is as
simple as:

     $buffer = <SOCKET>;    # Reading incoming data.
     print SOCKET $buffer;  # Writing outgoing data.

I've got an 11-page document titled "Sockets Programming Guide", which is a
very good concise document, but unfortunately I've only got it postscript
format. I can mail it to you if you need it.

Does your server and client have to interact via the HTTP protocol, because
that would imply a CGI-based approach ?


Cheers, Ron.

--------------------------------------------------------------------------
Ron Grunwald               | Usual E-mail         rong@prth.pgs.com
UNIX Programming Section   | Alternate E-mail     r.grunwald@usa.net 
PGS Tensor Pty. Ltd.       | Work Tel.            011 618 9320 9029
 Petroleum Exploration and | IBM Centre, Perth
   Seismic Processing.     |             Western Australia
--------------------------------------------------------------------------



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

Date: Mon, 13 Sep 1999 12:56:33 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Design Advice needed on Sending Data to Client
Message-Id: <5w6D3.7538$N77.609667@typ11.nn.bcandid.com>

In article <QVgC3.2461$x7.56225409@nr1.ottawa.istar.net>,
Caitlyn Hay <caithay@hotmail.com> wrote:
>What is the standard way of doing this?

Using HTTP, which includes several increasingly awful, but
well-supported, ways of solving the problems you mention.

>All these questions pop up, I
>need to know the standard way of doing this?

See the HTTP/1.1 definition:
http://www.normos.org/ietf/rfc/rfc2068.txt

It's about 160 pages, so you should be able to finish it in just a few
hours.




-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Thu Sep 09 1999
60 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: 13 Sep 1999 06:36:57 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How to make clean the text with screen control characters.
Message-Id: <37dcefe9@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    Jonathan Stowe <gellyfish@gellyfish.com> writes:
:You will need to identify the characters you want to remove and then
:create a regular expression that will match that - you may run into trouble
:with things like emboldened or underlined text which might be rendered like:
:
:      N^HN^HN^HNA^HA^HA^HAM^HM^HM^HME^HE^HE^HE
:
:which is slightly (only slightly mind) more difficult to deal with than
:simply removing control characters.

COL(1)                  OpenBSD Reference Manual             COL(1)

NAME
     col - filter reverse line feeds from input

SYNOPSIS
     col [-bfx] [-l num]

DESCRIPTION
     col filters out reverse (and half reverse) line feeds so that the
     output is in the correct order with only forward and half forward
     line feeds, and replaces white-space characters with tabs where
     possible.  This can be useful in processing the output of nroff(1)
     and tbl(1).

     col reads from the standard input and writes to the standard output.

     The options are as follows:

     -b        Do not output any backspaces, printing only the last
		character
               written to each column position.

     -f        Forward half line feeds are permitted (``fine'' mode).
	       Normal ly characters printed on a half line boundary are
	       printed on the following line.

     -x        Output multiple spaces instead of tabs.

     -l num    Buffer at least num lines in memory.  By default, 128
	       lines are buffered.

     The control sequences for carriage motion that col understands and
     their decimal values are listed in the following table:

     ESC-7            reverse line feed (escape then 7)
     ESC-8            half reverse line feed (escape then 8)
     ESC-9            half forward line feed (escape then 9)
     backspace        moves back one column (8); ignored in the first column
     carriage return  (13)
     newline          forward line feed (10); also does carriage return
     shift in         shift to normal character set (15)
     shift out        shift to alternate character set (14)
     space            moves forward one column (32)
     tab              moves forward to next tab stop (9)
     vertical tab     reverse line feed (11)
-- 
"I always find my self wondering how people who can't code manage to get
 through life."
				- Steve Gifford


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

Date: Mon, 13 Sep 1999 06:41:07 -0400
From: Mark <ml@marklord.net>
Subject: install_driver(mysql) failed: HELP
Message-Id: <37DCD4B8.416D6769@marklord.net>

Trying to connect to MySQL Database

From the command line I am able to connect to the mysql server  OK
USE databaseName;
SHOW TABLES;
DESCRIBE tableName;
SELECT * FROM tableName;

But from perl ....

use DBI;
print "<br><b>Avialable Drivers II  using
DBI-\&gt\;available_drivers()\;</b><br>\n";
@drivers = DBI-> available_drivers();
for ($i = 0; $i < $#ary ; $i++){
  print $drivers[$i]."<br>\n";  # produces a list of drivers.
}
# ExampleP<br>
# Mysql<br>
# NullP<br>
# Sponge<br>
## So far so good

When I try open a file handle
$dbh = DBI->connect('DBI:mysql:databaseName......
I get
#################
install_driver(mysql) failed: Can't locate loadable object for module
DBD::mysql in @INC (@INC contains: /usr/lib/perl5/
i386-openbsd/5.00404 /usr/lib/perl5
/usr/lib/perl5/site_perl/i386-openbsd /usr/lib/perl5/site_perl .) at
(eval 1) line 2

        DBI::install_driver('DBI', 'mysql') called at
/usr/lib/perl5/site_perl/DBI.pm line 323
        DBI::connect('DBI', 'DBI:mysql:databaseName', '', '') called at
 ./sql_test.pl line 25
#################

When I try open a file handle
$dbh = DBI->connect('DBI:Mysql:databaseName......    Capital (M)ysql
I get
#################
install_driver(Mysql) failed: Can't locate Mysql/Statement.pm in @INC
(@INC contains: /usr/lib/perl5/i386-openbsd/5.0040
4 /usr/lib/perl5 /usr/lib/perl5/site_perl/i386-openbsd
/usr/lib/perl5/site_perl .) at /usr/lib/perl5/site_perl/DBD/Mysql
 .pm line 12.

        DBI::install_driver('DBI', 'Mysql') called at
/usr/lib/perl5/site_perl/DBI.pm line 323
        DBI::connect('DBI', 'DBI:Mysql:databaseName', '', '') called at
 ./sql_test.pl line 29
#################

I'm not sure how to tell DBI.pm where the mysql driver(s) are.
any help would definitly be apprieciated.

ml@marklord.net

Mark



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

Date: Mon, 13 Sep 1999 12:20:58 GMT
From: Paul Leduc <pleduc@your_finger.home.com>
Subject: parsing a record at specific columns
Message-Id: <37DCEBB5.BC656964@your_finger.home.com>

This is probably an easy question, but as a perl newbie, I am having
some difficulty finding the answer.

The question is: how do I parse a record at specific columns?

The only way I can see is using /(.....)(.*)/
where $1 gets the first 5 cols (or however many dots I use) and $2 gets
the rest of the record.
While this works well for short columns, it would not be so convenient
to split a record at say col 50

I tried various incantations range (such as /(.*){1,5}(.*)/ ), but can't
get it to work correctly.

Anyone please?

-- 
Paul Leduc -  pleduc@home.com
(remove YOUR FINGER from my address when replying)


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

Date: Mon, 13 Sep 1999 08:39:31 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: parsing a record at specific columns
Message-Id: <Pine.GSO.4.10.9909130835290.19013-100000@crusoe.crusoe.net>

[posted & mailed]

On Sep 13, Paul Leduc blah blah blah:

> The question is: how do I parse a record at specific columns?

Instead of using valuable time parsing with a regex, use unpack().

  #          123456789012345678901234567890
  $record = "College StJeff      Pinyan    ";
  ($occup,$first,$last) = unpack "A10A10A10", $record;

Or use substr().

  #          012345678901234567890123456789
  $record = "College StJeff      Pinyan    ";
  $first = substr($record,10,10);

Yes, the first set of numbers started with 1, and the second set with 0.
Not a typo.

perldoc -f substr
perldoc -f unpack

-- 
jeff pinyan    japhy@pobox.com
perl stuff     japhy+perl@pobox.com
CPAN ID: PINYAN            http://www.perl.com/CPAN/authors/id/P/PI/PINYAN



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

Date: Mon, 13 Sep 1999 12:47:56 GMT
From: Alex Page <grimoire@twisted.gothicdreams.net>
Subject: Problem with PGP::Sign in a CGI script
Message-Id: <7rirpo$hnl$1@nnrp1.deja.com>

I'm writing a CGI script which uses the CGI and PGP::Sign modules. It
generates a string of text and asks the user to sign the text and submit
their signature using a web form. I don't know why, but when I run this
script from the command-line (entering key/value pairs as prompted by
the CGI module) I get different results from running it from the web
server (Apache, natch).

More specifically, when I call the pgp_verify method, the script appears
to reset itself - the output starts again at the header level, looking
something like this (using View Source, my edits in []s):

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><TITLE>Authentication Script</TITLE>
</HEAD><BODY>
[...]
<B>Debug message: </B>Last command before call to pgp_verify!<BR>
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><TITLE>Authentication Script</TITLE>
</HEAD><BODY>
[...]
<B>Debug message: </B>Last command before call to pgp_verify!
<B>Debug message: </B>First command after call to pgp_verify!
[rest of script]

I've got no idea why this should happen; can anyone help? The
PGP::Sign::pgp_error output doesn't show any problems. Relevant parts of
my script are as follows:

###################### Script follows #####################

#!/usr/bin/perl -w

use CGI qw/:standard :html3/;
use PGP::Sign;
use strict;

print header, start_html ( -title => 'Authentication Script' ), "\n";

# If no parameters, generate random phrase and ask user to sign

if (  !param ) {
        generate_form();
        bugout();
}

# If parameters, attempt to verify signed info;

my ($signer, @errors);
my $signature = param ( 'signed_text' ) if param ( 'signed_text' );
my $textphrase = param ( 'text_phrase' ) if param ( 'text_phrase' );

debug "Last command before call to pgp_verify!";

$signer = pgp_verify ( $signature, undef, $textphrase );

debug "First command after call to pgp_verify!";

@errors = PGP::Sign::pgp_error;

# Rest of script follows from here...

################## End of Script #####################

I'd be very grateful for any help on this one.

Alex
--
Diet Techno - You need it, because you beep.
     (with thanks to Dooferlad)
MancGoff: http://www.gothicdreams.net/grimoire
Exiled in DejaLand... proper news server in use soon!


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Mon, 13 Sep 1999 11:59:53 +0200
From: Daniel Krajzewicz <krajzewicz@inx.de>
To: Daniel Krajzewicz <krajzewicz@inx.de>
Subject: Question about @_ / $_
Message-Id: <37DCCB19.C8A6ED5F@inx.de>

Dear Friends,

I just hav a little question about the use of @_ / $_...
When a string is passed to a subroutine which schould hold two
parameters,
where the second features spaces, for example "car yellow fast low", can
I parse it by using the following command into these two parameters :
($object, $attributes) =3D @_; =

or what is the correct syntax.
By now, I=B4m using the character =B4|=B4 to seperate between the differe=
nt
parameters,
so it would look like : "car|yellow fast low" and would be splitted and
the assigned...

Thanks for help,
Daniel Krajzewicz


-- =

 __________________________
<     Daniel Krajzewicz    >
 >------------------------<
<     krajzewicz@inx.de    >   =

 >------------------------<
< http://www.art-so-far.de >
 >------------------------<
<__________________________>


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

Date: Mon, 13 Sep 1999 11:40:58 +0100
From: Mark Winder <mark.winder@virgin.net>
Subject: Re: Question about @_ / $_
Message-Id: <37DCD4BA.2F82@virgin.net>

No This will not work as the string will be passed into the object. =

A good way to do this is to say

($object,$attributes)=3Dsplit("|","car|yellow fast low");

so that your subroutine would look like

sub do_things_with_objects
{
 $p=3D@_; =

 ($object,$attributes)=3Dsplit("|",$p); =

  ....
}

and this would be called with a single string parameter. =


The only time in simple perl that parameters can change with a
subroutine call is if you supply a list (something with an @ on it) to a
subroutine. As what is passed to the subroutine is itself a single list
all of the following do NOT work: =


	passing more than one list. =

        passing a list followed by one or more values.

Note that passing one or more values first and then a list does work
however.    =


Hope this is helpful, =


		Mark Winder. =


Daniel Krajzewicz wrote:
> =

> Dear Friends,
> =

> I just hav a little question about the use of @_ / $_...
> When a string is passed to a subroutine which schould hold two
> parameters,
> where the second features spaces, for example "car yellow fast low", ca=
n
> I parse it by using the following command into these two parameters :
> ($object, $attributes) =3D @_;
> or what is the correct syntax.
> By now, I=B4m using the character =B4|=B4 to seperate between the diffe=
rent
> parameters,
> so it would look like : "car|yellow fast low" and would be splitted and=

> the assigned...
> =

> Thanks for help,
> Daniel Krajzewicz
> =

> --
>  __________________________
> <     Daniel Krajzewicz    >
>  >------------------------<
> <     krajzewicz@inx.de    >
>  >------------------------<
> < http://www.art-so-far.de >
>  >------------------------<
> <__________________________>



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

Date: 13 Sep 1999 11:31:48 GMT
From: billynospam@mirror.bt.co.uk (Graham Ashton)
Subject: Re: Question about @_ / $_
Message-Id: <slrn7tpo4m.ekp.billynospam@wing.mirror.bt.co.uk>

In article <37DCD4BA.2F82@virgin.net>, Mark Winder wrote:

>sub do_things_with_objects
>{
> $p=@_; 
> ($object,$attributes)=split("|",$p); 
>  ....
>}

oops, $p contains the number of elements in @_, rather than the first
parameter in the list - you're evaluating @_ in scalar context. you want
to say `@p = @_' and then `split("|", $p[0])' instead, but that's not a
very good way to do it.

    sub foo {
        my $p = shift;
        ($first_bit, $rest_of_it) = split /|/, $p, 2;
    }

might actually work (I must confess to not having tried to run my code
either)...

>The only time in simple perl that parameters can change with a
>subroutine call is if you supply a list (something with an @ on it) to a
>subroutine. As what is passed to the subroutine is itself a single list
>all of the following do NOT work: 
>
>	passing more than one list. 

that's because two lists turn into one list, not because you can't pass
it.

-- 
Graham


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

Date: Mon, 13 Sep 1999 07:35:04 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Question about @_ / $_
Message-Id: <Pine.GSO.4.10.9909130731450.19013-100000@crusoe.crusoe.net>

[posted & mailed]

On Sep 13, Mark Winder blah blah blah:

> sub do_things_with_objects
> {
>  $p=@_; 
>  ($object,$attributes)=split("|",$p); 
>   ....
> }

You didn't happen to... I dunno... test this before you posted it, did
you?  I see three ungoodnesses already.

1. you're not using my() or local(), so these are global variables
2. $p = @_; makes $p hold the NUMBER of elements
3. split "|", ...; | is a special regex character

  sub whatever {
    my ($obj,$attr) = split /\|/, $_[0];
    # or
    # my ($p) = @_;
    # ... split /\|/, $p;
  }

-- 
jeff pinyan    japhy@pobox.com
perl stuff     japhy+perl@pobox.com
CPAN ID: PINYAN            http://www.perl.com/CPAN/authors/id/P/PI/PINYAN



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

Date: Mon, 13 Sep 1999 07:28:35 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Reading symbolic links
Message-Id: <Pine.GSO.4.10.9909130727510.19013-100000@crusoe.crusoe.net>

[posted & mailed]

On Sep 13, Ron Grunwald-Computer Programmer PGS Tensor Perth blah blah blah:

> when a symbolic link is found, how can one determine which file or
> directory it is pointing to ?

Use symlink() to create a symbolic link, and readlink() to find what a
symbolic link points to.

-- 
jeff pinyan    japhy@pobox.com
perl stuff     japhy+perl@pobox.com
CPAN ID: PINYAN            http://www.perl.com/CPAN/authors/id/P/PI/PINYAN



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

Date: Mon, 13 Sep 1999 12:52:54 +0200
From: Michael Scheferhoff <m.scheferhoff@gmx.de>
Subject: Regular Expresions
Message-Id: <37DCD786.A2C4D693@gmx.de>

Hallo,

I have a problem with regular expressions. I hope that someone can help
me.

I have:

<1.part> <2.part> <...> <...> <last part>

I need:

<last part>

including the brackets or without brackets.

Thanks,

Michael



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

Date: Mon, 13 Sep 1999 07:39:14 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Regular Expresions
Message-Id: <Pine.GSO.4.10.9909130735110.19013-100000@crusoe.crusoe.net>

[posted & mailed]

On Sep 13, Michael Scheferhoff blah blah blah:

> I have:
> 
> <1.part> <2.part> <...> <...> <last part>
> 
> I need:
> 
> <last part>

This LOOKS like HTML parsing.  There ARE modules for that.  But just in
case it isn't, here's some help.

This is assuming there are no > characters between the < and the > that
you want.

$string = "<a> <b> <c>";
($wanted) = $string =~ /
  <
  ([^>]*)  # any non ">" char, any number of times, save to $1
  >
  $        # end of string
/x;

This is assuming the <...> you want is at the end of a string.  If not,
read some more of 'perlre' for better understanding of regular
expressions.

-- 
jeff pinyan    japhy@pobox.com
perl stuff     japhy+perl@pobox.com
CPAN ID: PINYAN            http://www.perl.com/CPAN/authors/id/P/PI/PINYAN



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

Date: Mon, 13 Sep 1999 02:43:24 -0700 (PDT)
From: Michael de Beer <madebeer@igc.apc.org>
Subject: Re: Searching by date problem.
Message-Id: <APC&1'0'50775da8'ad8@igc.apc.org>

type 

perldoc -q date

It will point you to CPAN : 
  Date::Manip
  Date::Calc

-Mike



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

Date: Mon, 13 Sep 1999 10:45:32 +0100
From: Mark <mark.winder@virgin.net>
Subject: Trouble installing DBM mSQL on Solaris.
Message-Id: <37DCC7BC.662C@virgin.net>

Trying to install DBI/mSQL on solaris. I unpack the tar file & change
directory to 
Msql-Mysql-modules-1.2206 

make Makefile.PL and immediately get the following message:

Can't call method "new" without a package or object reference at
Makefile.PL line 320. 

Trying the same with versions 1.2205,1.2204 and 1.2203 gives a different
and more complex problem but the same in each of the three cases. In
these cases I get asked what components I want to install, respond 2
(means mSQL only (either mSQL 1 or mSQL 2) )

Get asked if I want to install MsqlPerl - acept 
default [n]
Get asked what directory mSQL is installed, accept the default
/usr/local/Hughes, which is correct as I checked it. 

Which db to use for test [test]
Such a db does exist, although I know nothing about it, I accepted this. 
What host is the db on [localhost] - accept this, it's true!

Then get the following error message:
Creating files for mSQL IO object version 1.20 does not match $IO:: 1.15
at /usr
/local/lib/perl5/sun4-solaris/5.00404/DynaLoader.pm line 185, <STDIN>
chunk 5.
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/sun4-solaris/5.00404/I
O/Seekable.pm line 50, <STDIN> chunk 5.
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/sun4-solaris/5.00404/I
O/File.pm line 111, <STDIN> chunk 5.

I take this to mean that the version of module IO which I previously
installed is 1.20 when it should be 1.15 but 1.19 is the earliest
version available. 

I am running perl 5.004_04 under SunOS 5.6

I'm well and truly stuck here and don't know how to proceed any further.
Anyone got any suggestions ? 

Mark Winder. 

mark.winder@virgin.net.



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

Date: Mon, 13 Sep 1999 13:56:21 GMT
From: nospam@all.uk (G Crowder)
Subject: Why perlcrt.dll needed?
Message-Id: <7ris9n$g8t$1@glencoe.hw.ac.uk>

I notice that my Perl/Tk programme now requires perlcrt.dll when it is
run as an exe generated by perl2exe. I don't know which of the latest
additions to the programme triggered this but I'm curious to know.
Might it be the addition of back-ticked commands, though  I thought I
commented these lines out but still got the .dll requirement flagged
up?

Thanks,
Graham Crowder



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

Date: Mon, 13 Sep 1999 22:30:15 +1000
From: "Neale Morison" <nmorison@ozemail.com.au>
Subject: Re: XML plus XSL to HTML?
Message-Id: <W66D3.13408$1E2.92481@ozemail.com.au>

----- Original Message -----
From: Neale Morison <nmorison@ozemail.com.au>
Newsgroups: comp.lang.perl.misc
Sent: Saturday, 11 September 1999 22:41
Subject: XML plus XSL to HTML?


> Hi all. I'm looking for pointers in using Perl to create an HTML document
by
> running an XML document through an XSL stylesheet.

While I haven't found tools in Perl to accomplish this, you can do it with
Internet Explorer 5 on a file by file basis. Open up this document in IE5,
with your xsl and xml files substituted:
<HTML>
  <HEAD>
    <TITLE>Transform XML via XSL to HTML with IE5</TITLE>
  </HEAD>

  <XML id="source" src="auction1neale.xml"></XML>
  <XML id="style" src="bids-table2neale.xsl"></XML>
  <XML id="HTMLoutput" ></XML>

  <SCRIPT FOR="window" EVENT="onload">
      source.transformNodeToObject(style.XMLDocument,
HTMLoutput.XMLDocument); // this displays as HTML
      document.write(HTMLoutput.xml);

  </SCRIPT>
</HTML>


Then save the resulting HTML file. However this doesn't permit automation,
in particular batch processing of files.
It's looking like Perl hasn't got there yet, and the Java (!) and Microsoft
(gasp) tools are ahead. Perhaps the reason is that Perl is not well suited
to this kind of parsing, because regular expressions cannot deal with
parenthetic expressions nested to unlimited depth?
There's a great article on this at
http://www.perlmonth.com/columns/perl_xml/perl_xml.html?issue=4&id=937224791









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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. Due to their sizes, neither the Meta-FAQ nor
the FAQ are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq" from
almanac@ruby.oce.orst.edu. 

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


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