[23654] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5861 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 26 18:05:44 2003

Date: Wed, 26 Nov 2003 15:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 26 Nov 2003     Volume: 10 Number: 5861

Today's topics:
    Re: Assigning split to a list: undefined values? (Malcolm Dew-Jones)
        Help with com port (Jeremy)
    Re: Help with com port <usenet@morrow.me.uk>
    Re: Help with updating HTML from drop down menu's pleas <tex@lager.engsoc.carleton.ca>
        keeping anonymous hash sorted <eddhig22@yahool.com>
    Re: keeping anonymous hash sorted <usenet@morrow.me.uk>
    Re: keeping anonymous hash sorted (Tad McClellan)
    Re: keeping anonymous hash sorted <REMOVEsdnCAPS@comcast.net>
    Re: keeping anonymous hash sorted <noreply@gunnar.cc>
        Mayo Jax DB disk daot03 repair <stremitz@consultant.com>
    Re: Mayo Jax DB disk daot03 repair <stremitz@consultant.com>
    Re: Newbie Question: Best way to Extract Post Hashes? <tex@lager.engsoc.carleton.ca>
    Re: Perl Editor (Sara)
        problem connecting pipes in Expect.pm <mikee@mikee.ath.cx>
    Re: Protecting Source code of a perl script <nobull@mail.com>
    Re: Regex matching question <stremitz@consultant.com>
    Re: Regex matching question <usenet@morrow.me.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 26 Nov 2003 14:58:10 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Assigning split to a list: undefined values?
Message-Id: <3fc53002@news.victoria.tc.ca>

Dmitry Epstein (mitia.nospam@northwestern.edu.invalid) wrote:
: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) wrote in
: news:3fc2aa3c@news.victoria.tc.ca: 

: > Dmitry Epstein (mitia.nospam@northwestern.edu.invalid) wrote:
: >: ko <kuujinbo@hotmail.com> wrote in
: >: news:bpme0m$25q$1@pin3.tky.plala.or.jp: 
: >: > Dmitry Epstein wrote:
: >: >> Here is a code snippet:
: >: >> 
: >: >> while ($line = <F>) {
: >: >>          my ($node1, $node2, $node3) = split ' ', $line;
: >: >>          last unless defined $node3;
: >: >>          ...
: >: >> }
: >: >> 
: >: >> The idea here was that the loop stops if the line was
: >: >> split into fewer than 3 values.  It doesn't work however:
: >: >> when the line has only 2 values, the variable $node3 is
: >: >> initialized with zero instead of remaining undefined.  How
: >: >> come? 
: >: >> 
: >: >> (I have since changed the code to use an array instead of
: >: >> a list.) 
: >: >> 
: >: > 
: >: > Since the pattern ' ' is split()ing on whitespace, the
: >: > newline on each line results in an empty trailing field
: >: > ('', which is a defined value). So you need to get rid of
: >: > the newline on each line: 
: >: > 
: >: > use strict;
: >: > use warnings;
: >: > 
: >: > while (my $line = <DATA>) {
: >: >    chomp $line;
: >: >    my ($node1, $node2, $node3) = split ' ', $line;
: >: >    last unless defined $node3;
: >: >    print join(" ", $node1, $node2, $node3), "\n"
: >: > }
: >: > 
: >: > __DATA__
: >: > a s d
: >: > a s
: >: > 
: >: > HTH- keith
: > 
: >: I don't think so.  Split on ' ' is supposed to "chomp" any
: >: trailing whitespace.  In fact, if I use an array to store the
: >: value of split instead of a list of scalars, the array does
: >: not receive a null value in the end.
: > 
: > Not exactly.  The "default" behaviour is to drop empty
: > trailing fields, but what does "default" mean?
: > 
: > perldoc -f split also states that assigning to a _list_ (which
: > is what you have) creates an implicit limit on the number of
: > fields to be extracted. 
: > 
: > So I am guessing that "default" is refering to the "limit",
: > but since you have implicitly defined a limit then you don't
: > get the default behaviour. 
: > 
: > Instead you get the first three fields, the third of which is
: > the empty string "found" at the end.
: > 
: > 
: >      "first-item  second-item \n"
: >          1111111111  22222222222   3 (3rd is 0 chars long)

: Heh, I didn't say my example was the "default" case (split with no 
: arguments, as I understand it), now did I? :)  This is what the 
: docs say:

: As a special case, specifying a PATTERN of space (' ') will split 
: on white space just as split with no arguments does.

The _Default_ behaviour to which I refered, and which I quote below, is in
the first paragraph of the perl I am using today ( v5.6.1 built for
MSWin32-x86-multi-thread )

	=item split

	... By default,
	empty leading fields are preserved, and empty trailing ones are
	deleted.

So, what will split do with the trailing empty fields?  

: There is a bit more on that case in the docs, but nowhere does it 
: say that specifying a limit, whether implicitly or explicitly, 
: somehow abrogates the standard behaviour of split on ' '.

No, but by the same token, the docs for the special case of ' ' do not
indicate what happens to the trailing fields, only ever the leading
fields.  Since no mention is made of the trailing fields, and since you do
not specify the number of fields, therefore I assume the indicated default
behaviour for trailing fields applies.



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

Date: 26 Nov 2003 11:17:42 -0800
From: jeremyk@crescentmfg.com (Jeremy)
Subject: Help with com port
Message-Id: <3a08abed.0311261117.77b3e1db@posting.google.com>

This is a program I wrote a long time ago in quick basic that sets up a label
printer and prints the variables of line1 and line2. 

line1$ = "Some stuff"
line2$ = "other stuff"
OPEN "COM1:9600,N,8,1,ASC" FOR RANDOM AS #15
                PRINT #15, CHR$(2) + "c0000"
                PRINT #15, CHR$(2) + "M1000"
                PRINT #15, CHR$(2) + "a"
                PRINT #15, CHR$(2) + "V0"
                PRINT #15, CHR$(2) + "O0500"
                PRINT #15, CHR$(2) + "QCCLEAR"
                PRINT #15, CHR$(2) + "XCGAAAA"
                PRINT #15, CHR$(2) + "L"
                PRINT #15, "C0030"
                PRINT #15, "R0000"
                PRINT #15, "D19"
                PRINT #15, "H11"
                PRINT #15, "PE"
                PRINT #15, "SE"
                PRINT #15, "A0"
                PRINT #15, "Q0001"
                PRINT #15, "322100000000300" + line1$
                PRINT #15, "322100000550275" + line2$
                PRINT #15, "W"
                PRINT #15, "E"
                PRINT #15, CHR$(2) + "QCCLEAR"
CLOSE #15



I have re written it in perl and can not get it to work. I have tried to do this:


$line1="some stuff\n";
$line2="other stuff\n";
open (port,"+>COM1") or die "$!\n";
	print port chr 2;
	print port  "c0000\n";
	print port  chr 2;
	print port  "M1000\n";
	print port  chr 2;
	print port  "a\n";
	print port  chr 2;
	print port  "V0\n";
	print port  chr 2;
	print port  "o0500\n";
	print port  chr 2;
	print port  "QCCLEAR\n";
	print port  chr 2;
	print port  "XCGAAAA\n";
	print port  chr 2;
	print port  "L\n";
	print port  "c00030\n";
	print port  "R0000\n";
	print port  "D19\n";
	print port  "H11\n";
	print port  "PE\n";
	print port  "SE\n";
	print port  "A0\n";
	print port  "Q001\n";
	print port  "322100000000300";
	print port  "$line1\n";
	print port  "322100000550275";
        print port  "$line2\n";
	print port  "W\n";
	print port  "E\n";
	print port  chr 2;
	print port  "QCCLEAR\n";
close (port);


Help!!!!!!!!!!!!!!!1


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

Date: Wed, 26 Nov 2003 19:47:48 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Help with com port
Message-Id: <bq3014$eu5$1@wisteria.csv.warwick.ac.uk>


jeremyk@crescentmfg.com (Jeremy) wrote:
> This is a program I wrote a long time ago in quick basic that sets up a label
> printer and prints the variables of line1 and line2. 
> 
> line1$ = "Some stuff"
> line2$ = "other stuff"
> OPEN "COM1:9600,N,8,1,ASC" FOR RANDOM AS #15
<schtuff>
> CLOSE #15
> 
> I have re written it in perl and can not get it to work. I have
> tried to do this:

How does it fail? What does it do or not do that you didn't expect?

> $line1="some stuff\n";
> $line2="other stuff\n";
> open (port,"+>COM1") or die "$!\n";

It is conventional to use UPPERCASE for filehandles; also, it is
usually better to use lexical filehandles.

I believe (but am not sure) that the name for the serial port is
"COM1:"? Also, the "9600,N,8,1,ASC" from the above is not here: I
suspect it is important.

Don't put "\n" on the end of die messages. It suppresses important
information about where the error occurred.

  open my $PORT, "+>COM1:9600,N,8,1,ASC" or die "can't open COM1: $!";

or, if this fails because "COM1:..." is incorrect syntax, you'll need
to do

  open my $PORT, "+>COM1:" or die "can't open COM1: $!";

and then set 9600 baud, no parity, 8 data bits, 1 stop bit, XON/XOFF
(I presume that's how that decodes?) with POSIX::Termios or some
appropriate ioctls.

> 	print port chr 2;
> 	print port  "c0000\n";
> 	print port  chr 2;
> 	print port  "M1000\n";
> 	print port  chr 2;
> 	print port  "a\n";
<snip>

I would do this with a here-doc:

  print $PORT <<EOF;
\x2c0000
\x2M1000
\x2a
etc...
EOF

> close (port);

Particularly with things like terminals, you *must* check the return
of close.

  close $PORT or die "close of COM1 failed: $!";

Ben

-- 
   Although few may originate a policy, we are all able to judge it.
                                             - Pericles of Athens, c.430 B.C.
  ben@morrow.me.uk


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

Date: 26 Nov 2003 21:16:05 GMT
From: "Clayton L. Scott" <tex@lager.engsoc.carleton.ca>
Subject: Re: Help with updating HTML from drop down menu's please!
Message-Id: <bq356l$pa3$1@driftwood.ccs.carleton.ca>

Paul Turner <paulturner@hotmail.com> wrote:
> Hi - I am a Perl newbie I'm afraid!

> I wonder if any of you kind people could help me please!  I wish to
> create a very simple Christmas gift management website for my family.

Please RTFM for CGI.pm it has some excellent examples to get you started.

Look up documentation for CGI.pm on your server 'perldoc CGI.pm'
or online at http://www.perldoc.com or http://search.cpan.org

Clayton


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

Date: Thu, 27 Nov 2003 06:45:51 +1100
From: Edo <eddhig22@yahool.com>
Subject: keeping anonymous hash sorted
Message-Id: <3FC502EF.40103@yahool.com>

Hello

I have been using Tie::IxHash to keep my hash sorted but now

         if (( $tmp > $max )||($tmp = 1)) {
             tie my (%slic), 'Tie::IxHash';
             foreach my $ky ( @kdslic ){
                 $slic{$sym}{$ky} = $$dbits{$ky};
             }
             $#{$set{1}} == $enf ? return $set : push 
@{$set->{$tmp}},\%slic;

print Dumper %set;
the $ky is not sorted. how can I keep them sorted in this case?

thanks



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

Date: Wed, 26 Nov 2003 22:03:10 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: keeping anonymous hash sorted
Message-Id: <bq37uu$mtc$2@wisteria.csv.warwick.ac.uk>


Edo <eddhig22@yahool.com> wrote:
> I have been using Tie::IxHash to keep my hash sorted but now
> 
>          if (( $tmp > $max )||($tmp = 1)) {
>              tie my (%slic), 'Tie::IxHash';
>              foreach my $ky ( @kdslic ){
>                  $slic{$sym}{$ky} = $$dbits{$ky};
>              }
>              $#{$set{1}} == $enf ? return $set : push 
> @{$set->{$tmp}},\%slic;

^^ missing }

Is this code part of a loop?  
Where do $tmp, $max, @kdslic, $sym, $set, %set, %dbits and $enf come from?
Please give us code we can run.

> print Dumper %set;

I think you are confusing $set and %set.

> the $ky is not sorted. how can I keep them sorted in this case?

% perl -MTie::IxHash -MData::Dumper
  -e'sub r { tie my %h, "Tie::IxHash"; return \%h }
  my $x = r; $x->{$_} = $_ for 0..100; print Dumper $x'

works for me... I think your problem lies elsewhere.

Ben

-- 
perl -e'print map {/.(.)/s} sort unpack "a2"x26, pack "N"x13,
qw/1632265075 1651865445 1685354798 1696626283 1752131169 1769237618
1801808488 1830841936 1886550130 1914728293 1936225377 1969451372
2047502190/'                                                 # ben@morrow.me.uk


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

Date: Wed, 26 Nov 2003 16:05:17 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: keeping anonymous hash sorted
Message-Id: <slrnbsa8st.5tl.tadmc@magna.augustmail.com>

Edo <eddhig22@yahool.com> wrote:

>          if (( $tmp > $max )||($tmp = 1)) {
                                     ^^^
                                     ^^^

That almost for sure does not do what you think it does.

Do you really want to set the value of $tmp to one?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Wed, 26 Nov 2003 17:00:48 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: keeping anonymous hash sorted
Message-Id: <Xns943FB776B3ABsdn.comcast@216.196.97.136>

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

Edo <eddhig22@yahool.com> wrote in news:3FC502EF.40103@yahool.com:

> Hello
> 
> I have been using Tie::IxHash to keep my hash sorted but now
 ...
> the $ky is not sorted. how can I keep them sorted in this case?

Why do you feel you need to *keep* it sorted?  Nearly always, one doesn't 
care about the order of keys until one prints out the structure.  Why not 
use a regular hash (MUCH faster than a tied hash), and sort the keys at 
output time?

- -- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP8Uw7GPeouIeTNHoEQK+hgCgy3Sbhi+e3cjfLEeiiHIniqDZA1MAn16X
aBno4M1fZkaezUviWlC/FePd
=L1N6
-----END PGP SIGNATURE-----


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

Date: Wed, 26 Nov 2003 23:56:31 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: keeping anonymous hash sorted
Message-Id: <bq3bec$1ttbg9$1@ID-184292.news.uni-berlin.de>

Edo wrote:
> I have been using Tie::IxHash to keep my hash sorted but now
> 
>         if (( $tmp > $max )||($tmp = 1)) {
>             tie my (%slic), 'Tie::IxHash';
>             foreach my $ky ( @kdslic ){
>                 $slic{$sym}{$ky} = $$dbits{$ky};
>             }
>             $#{$set{1}} == $enf ? return $set : push 
> @{$set->{$tmp}},\%slic;
> 
> print Dumper %set;
> the $ky is not sorted. how can I keep them sorted in this case?

$ky is not a hash. $ky represents a key in an anonymous hash to which 
$slic{$sym} is a reference. To me, your question indicates that you 
need to further read up on references and complex data structures:

     http://www.perldoc.com/perl5.8.0/pod/perlref.html

     http://www.perldoc.com/perl5.8.0/pod/perldsc.html

As regards the question you probably intended to ask, Tie::IxHash can 
be used to preserve the order of the elements also for anonymous 
hashes. Consequently, right before the foreach loop above, you can do:

     tie %{$slic{$sym}}, 'Tie::IxHash';

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Wed, 26 Nov 2003 17:40:18 -0500
From: Alexander Stremitzer <stremitz@consultant.com>
Subject: Mayo Jax DB disk daot03 repair
Message-Id: <fY9xb.134$s7.6@bignews6.bellsouth.net>

Nov 23 21:37:54 daot03  Error for Command: read(10)                Error 
Level:
Retryable
Nov 23 21:37:54 daoError Block: 2150724 kern.notice]    Requested Block: 
2150694
Nov 23 21:37:54 daot03 scsi: [ID 107833 kern.notice]    Vendor: SEAGATE
                    Serial Number: 3FA07R0S
Nov 23 21:37:54 daot03 scsi: [ID 107833 kern.notice]    Sense Key: Media 
Error
Nov 23 21:38:01 daot03  Error for Command: read(10)                Error 
Level:
Retryable
Nov 23 21:38:01 daot03 scsi: [ID 107833 kern.notice]    Requested Block: 
2150694
                    Error Block: 2150724
Nov 23 21:38:01 daot03 scsi: [ID 107833 kern.notice]    Vendor: SEAGATE
                    Serial Number: 3FA07R0S
Nov 23 21:38:01 daot03 scsi: [ID 107833 kern.notice]    Sense Key: Media 
Error
Nov 23 21:38:01 daot03 scsi: [ID 107833 kern.notice]    ASC: 0x11 
(unrecovered r
ead error), ASCQ: 0x0, FRU: 0xe4
Nov 23 21:38:04 daot03 scsi: [ID 107833 kern.warning] WARNING: 
/pci@1f,4000/scsi
@2,1/sd@2,0 (sd60):
Nov 23 21:38:04 daot03  Error for Command: read(10)                Error 
Level:
Fatal
Nov 23 21:38:04 daot03 scsi: [ID 107833 kern.notice]    Requested Block: 
2150694
                    Error Block: 2150724
Nov 23 21:38:04 daot03 scsi: [ID 107833 kern.notice]    Vendor: SEAGATE
                    Serial Number: 3FA07R0S
Nov 23 21:38:04 daot03 scsi: [ID 107833 kern.notice]    Sense Key: Media 
Error
Nov 23 21:38:04 daot03 scsi: [ID 107833 kern.notice]    ASC: 0x11 
(unrecovered r
ead error), ASCQ: 0x0, FRU: 0xe4


daot03:/dev> ls -al sd60*
lrwxrwxrwx   1 root     root          12 Nov 15 05:12 sd60a -> dsk/c1t2d0s0
lrwxrwxrwx   1 root     root          12 Nov 15 05:12 sd60b -> dsk/c1t2d0s1
lrwxrwxrwx   1 root     root          12 Nov 15 05:12 sd60c -> dsk/c1t2d0s2
lrwxrwxrwx   1 root     root          12 Nov 15 05:12 sd60d -> dsk/c1t2d0s3
lrwxrwxrwx   1 root     root          12 Nov 15 05:12 sd60e -> dsk/c1t2d0s4
lrwxrwxrwx   1 root     root          12 Nov 15 05:12 sd60f -> dsk/c1t2d0s5
lrwxrwxrwx   1 root     root          12 Nov 15 05:12 sd60g -> dsk/c1t2d0s6
lrwxrwxrwx   1 root     root          12 Nov 15 05:12 sd60h -> dsk/c1t2d0s7
daot03:/dev> su
Password:
# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
        0. c0t0d0 <ST318437LC cyl 29649 alt 2 hd 2 sec 606>
           /pci@1f,4000/scsi@2/sd@0,0
        1. c0t1d0 <ST318437LC cyl 10005 alt 2 hd 27 sec 133>
           /pci@1f,4000/scsi@2/sd@1,0
        2. c0t2d0 <ST336704LC cyl 19961 alt 2 hd 27 sec 133>
           /pci@1f,4000/scsi@2/sd@2,0
        3. c1t0d0 <ST336706LC cyl 19961 alt 2 hd 27 sec 133>
           /pci@1f,4000/scsi@2,1/sd@0,0
        4. c1t1d0 <ST318437LC cyl 10005 alt 2 hd 27 sec 133>
           /pci@1f,4000/scsi@2,1/sd@1,0
        5. c1t2d0 <ST318437LC cyl 10005 alt 2 hd 27 sec 133>
           /pci@1f,4000/scsi@2,1/sd@2,0
        6. c2t0d0 <ST318437LC cyl 29649 alt 2 hd 2 sec 606>
           /pci@1f,4000/scsi@3/sd@0,0
        7. c2t1d0 <ST318437LC cyl 10005 alt 2 hd 27 sec 133>
           /pci@1f,4000/scsi@3/sd@1,0
        8. c2t2d0 <ST336704LC cyl 19961 alt 2 hd 27 sec 133>
           /pci@1f,4000/scsi@3/sd@2,0
        9. c3t0d0 <ST318437LC cyl 10005 alt 2 hd 27 sec 133>
           /pci@1f,4000/scsi@3,1/sd@0,0
       10. c3t1d0 <ST318437LC cyl 10005 alt 2 hd 27 sec 133>
           /pci@1f,4000/scsi@3,1/sd@1,0
       11. c3t2d0 <ST318437LC cyl 10005 alt 2 hd 27 sec 133>
           /pci@1f,4000/scsi@3,1/sd@2,0
Specify disk (enter its number): 5
selecting c1t2d0
[disk formatted]


analyze> rea
Ready to analyze (won't harm SunOS). This takes a long time,
but is interruptable with CTRL-C. Continue? y

         pass 0
Medium error during read: block 2150724 (0x20d144) (598/24/114)
ASC: 0x11   ASCQ: 0x0
Repairing hard error on 2150724 (598/24/114)...ok.

^C 3698/3/105
Total of 1 defective blocks repaired.
analyze>

Nov 26 16:52:47 daot03  Error for Command: read(10)                Error 
Level:
Retryable
Nov 26 16:52:47 daot03 scsi: [ID 107833 kern.notice]    Requested Block: 
2150724
                    Error Block: 2150724
Nov 26 16:52:47 daot03 scsi: [ID 107833 kern.notice]    Vendor: SEAGATE
                    Serial Number: 3FA07R0S
Nov 26 16:52:47 daot03 scsi: [ID 107833 kern.notice]    Sense Key: Media 
Error
Nov 26 16:52:47 daot03 scsi: [ID 107833 kern.notice]    ASC: 0x11 
(unrecovered r
ead error), ASCQ: 0x0, FRU: 0xe4



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

Date: Wed, 26 Nov 2003 17:43:10 -0500
From: Alexander Stremitzer <stremitz@consultant.com>
Subject: Re: Mayo Jax DB disk daot03 repair
Message-Id: <X_9xb.137$s7.114@bignews6.bellsouth.net>

OOPS. Wrong recipient. My apologies.

Alexander Stremitzer wrote:
> Nov 23 21:37:54 daot03  Error for Command: read(10)                Error 
> Level:
> Retryable
> Nov 23 21:37:54 daoError Block: 2150724 kern.notice]    Requested Block: 
> 2150694
> Nov 23 21:37:54 daot03 scsi: [ID 107833 kern.notice]    Vendor: SEAGATE
>                    Serial Number: 3FA07R0S
> Nov 23 21:37:54 daot03 scsi: [ID 107833 kern.notice]    Sense Key: Media 
> Error
> Nov 23 21:38:01 daot03  Error for Command: read(10)                Error 
> Level:
> Retryable
> Nov 23 21:38:01 daot03 scsi: [ID 107833 kern.notice]    Requested Block: 
> 2150694
>                    Error Block: 2150724
> Nov 23 21:38:01 daot03 scsi: [ID 107833 kern.notice]    Vendor: SEAGATE
>                    Serial Number: 3FA07R0S
> Nov 23 21:38:01 daot03 scsi: [ID 107833 kern.notice]    Sense Key: Media 
> Error
> Nov 23 21:38:01 daot03 scsi: [ID 107833 kern.notice]    ASC: 0x11 
> (unrecovered r
> ead error), ASCQ: 0x0, FRU: 0xe4
> Nov 23 21:38:04 daot03 scsi: [ID 107833 kern.warning] WARNING: 
> /pci@1f,4000/scsi
> @2,1/sd@2,0 (sd60):
> Nov 23 21:38:04 daot03  Error for Command: read(10)                Error 
> Level:
> Fatal
> Nov 23 21:38:04 daot03 scsi: [ID 107833 kern.notice]    Requested Block: 
> 2150694
>                    Error Block: 2150724
> Nov 23 21:38:04 daot03 scsi: [ID 107833 kern.notice]    Vendor: SEAGATE
>                    Serial Number: 3FA07R0S
> Nov 23 21:38:04 daot03 scsi: [ID 107833 kern.notice]    Sense Key: Media 
> Error
> Nov 23 21:38:04 daot03 scsi: [ID 107833 kern.notice]    ASC: 0x11 
> (unrecovered r
> ead error), ASCQ: 0x0, FRU: 0xe4
> 
> 
> daot03:/dev> ls -al sd60*
> lrwxrwxrwx   1 root     root          12 Nov 15 05:12 sd60a -> dsk/c1t2d0s0
> lrwxrwxrwx   1 root     root          12 Nov 15 05:12 sd60b -> dsk/c1t2d0s1
> lrwxrwxrwx   1 root     root          12 Nov 15 05:12 sd60c -> dsk/c1t2d0s2
> lrwxrwxrwx   1 root     root          12 Nov 15 05:12 sd60d -> dsk/c1t2d0s3
> lrwxrwxrwx   1 root     root          12 Nov 15 05:12 sd60e -> dsk/c1t2d0s4
> lrwxrwxrwx   1 root     root          12 Nov 15 05:12 sd60f -> dsk/c1t2d0s5
> lrwxrwxrwx   1 root     root          12 Nov 15 05:12 sd60g -> dsk/c1t2d0s6
> lrwxrwxrwx   1 root     root          12 Nov 15 05:12 sd60h -> dsk/c1t2d0s7
> daot03:/dev> su
> Password:
> # format
> Searching for disks...done
> 
> 
> AVAILABLE DISK SELECTIONS:
>        0. c0t0d0 <ST318437LC cyl 29649 alt 2 hd 2 sec 606>
>           /pci@1f,4000/scsi@2/sd@0,0
>        1. c0t1d0 <ST318437LC cyl 10005 alt 2 hd 27 sec 133>
>           /pci@1f,4000/scsi@2/sd@1,0
>        2. c0t2d0 <ST336704LC cyl 19961 alt 2 hd 27 sec 133>
>           /pci@1f,4000/scsi@2/sd@2,0
>        3. c1t0d0 <ST336706LC cyl 19961 alt 2 hd 27 sec 133>
>           /pci@1f,4000/scsi@2,1/sd@0,0
>        4. c1t1d0 <ST318437LC cyl 10005 alt 2 hd 27 sec 133>
>           /pci@1f,4000/scsi@2,1/sd@1,0
>        5. c1t2d0 <ST318437LC cyl 10005 alt 2 hd 27 sec 133>
>           /pci@1f,4000/scsi@2,1/sd@2,0
>        6. c2t0d0 <ST318437LC cyl 29649 alt 2 hd 2 sec 606>
>           /pci@1f,4000/scsi@3/sd@0,0
>        7. c2t1d0 <ST318437LC cyl 10005 alt 2 hd 27 sec 133>
>           /pci@1f,4000/scsi@3/sd@1,0
>        8. c2t2d0 <ST336704LC cyl 19961 alt 2 hd 27 sec 133>
>           /pci@1f,4000/scsi@3/sd@2,0
>        9. c3t0d0 <ST318437LC cyl 10005 alt 2 hd 27 sec 133>
>           /pci@1f,4000/scsi@3,1/sd@0,0
>       10. c3t1d0 <ST318437LC cyl 10005 alt 2 hd 27 sec 133>
>           /pci@1f,4000/scsi@3,1/sd@1,0
>       11. c3t2d0 <ST318437LC cyl 10005 alt 2 hd 27 sec 133>
>           /pci@1f,4000/scsi@3,1/sd@2,0
> Specify disk (enter its number): 5
> selecting c1t2d0
> [disk formatted]
> 
> 
> analyze> rea
> Ready to analyze (won't harm SunOS). This takes a long time,
> but is interruptable with CTRL-C. Continue? y
> 
>         pass 0
> Medium error during read: block 2150724 (0x20d144) (598/24/114)
> ASC: 0x11   ASCQ: 0x0
> Repairing hard error on 2150724 (598/24/114)...ok.
> 
> ^C 3698/3/105
> Total of 1 defective blocks repaired.
> analyze>
> 
> Nov 26 16:52:47 daot03  Error for Command: read(10)                Error 
> Level:
> Retryable
> Nov 26 16:52:47 daot03 scsi: [ID 107833 kern.notice]    Requested Block: 
> 2150724
>                    Error Block: 2150724
> Nov 26 16:52:47 daot03 scsi: [ID 107833 kern.notice]    Vendor: SEAGATE
>                    Serial Number: 3FA07R0S
> Nov 26 16:52:47 daot03 scsi: [ID 107833 kern.notice]    Sense Key: Media 
> Error
> Nov 26 16:52:47 daot03 scsi: [ID 107833 kern.notice]    ASC: 0x11 
> (unrecovered r
> ead error), ASCQ: 0x0, FRU: 0xe4
> 



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

Date: 26 Nov 2003 21:21:14 GMT
From: "Clayton L. Scott" <tex@lager.engsoc.carleton.ca>
Subject: Re: Newbie Question: Best way to Extract Post Hashes?
Message-Id: <bq35ga$pa3$2@driftwood.ccs.carleton.ca>

Eric J. Roode <REMOVEsdnCAPS@comcast.net> wrote:
> -----BEGIN xxx SIGNED MESSAGE-----
> Hash: SHA1

> awilhite@cableone.net (Andrew) wrote in
> news:9b7dcecd.0311240148.1ce72a0b@posting.google.com: 

>> Sorry about the confusion in my wording.   What I was looking for tips
>> on how to  automatically detect all necessary post values the form is
>> expecting.  For example, When I look at the source code for
>> my.yahoo.com,  there are several hidden attributes that it is
>> requesting aside form the obvious username and password fields.  I was
>> wondering if anyone knew of a module that could help identify these
>> hidden values.

> Ah. Sounds like you need a module for parsing HTML, such as 
> HTML::TokeParser.

Or a way to submit forms WWW::Mechanise

CLayton


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

Date: 26 Nov 2003 12:02:31 -0800
From: genericax@hotmail.com (Sara)
Subject: Re: Perl Editor
Message-Id: <776e0325.0311261202.148e6622@posting.google.com>

Xaonon <xaonon@hotpop.com> wrote in message news:<slrnbs4g6t.qvf.xaonon@xaonon.local>...
> Ned i bach <c659b5f9.0311240932.58c5a21@posting.google.com>, AnnMarie
> <carusoa@optonline.net> teithant i thiw hin: 
> 
> > What is the best editor for Perl CGI-Scripts?
> 
> Emacs.

But of course, really the only choice for the contemporary programmuer
with flair! And like the movie says, "One Editor to RULE the rest!"

Give a TURKEY a break- TOFU TURKEY the OTHER white meat!

G


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

Date: Wed, 26 Nov 2003 19:25:34 -0000
From: Mike <mikee@mikee.ath.cx>
Subject: problem connecting pipes in Expect.pm
Message-Id: <vs9vhegus8jgc0@corp.supernews.com>

Here is a script I'm working on to connect to various lpars
that are connected to my local HMC. The script creates the
proper magic string and is then connected to the intended
lpar, but then the script does not connect the user's stdin
with the telnet session. What am I doing wrong in this
script?

Mike


#!/usr/bin/perl

# $Id$
# $Log$

use Expect;
use strict;

sub usage {
	exit 0;
}

usage if $ARGV[0] eq '-h';

my %hostdefs = (
	'drtest'   => { 'machtype' => '7028-6C4', 'serno' => '10BCCDA', 'lpar' => 2 },
	'txwasp01' => { 'machtype' => '7038-6M2', 'serno' => '1021A4A', 'lpar' => 2 },
	'txwasp02' => { 'machtype' => '7038-6M2', 'serno' => '103053A', 'lpar' => 1 },
	'txwasq01' => { 'machtype' => '7038-6M2', 'serno' => '103053A', 'lpar' => 2 },
	'txwast01' => { 'machtype' => '7038-6M2', 'serno' => '1021A4A', 'lpar' => 1 },
	'txmqsp01' => { 'machtype' => '7028-6C4', 'serno' => '10BCCDA', 'lpar' => 1 },
	'txmqsp02' => { 'machtype' => '7028-6C4', 'serno' => '10DD09A', 'lpar' => 1 },
	'txmqsq01' => { 'machtype' => '7028-6C4', 'serno' => '10DD09A', 'lpar' => 3 },
	'txmqst01' => { 'machtype' => '7028-6C4', 'serno' => '10DD09A', 'lpar' => 2 }
);

sub findlpar {
	my $host = shift;
	die "$0: lpar not found for host '$host'"
			if $hostdefs{$host}->{'lpar'} == undef;
	return $hostdefs{$host}->{'lpar'} or die "$0: lpar not found for host '$host'";
}

sub findmachtype {
	my $host = shift;
	die "$0: machine type not found for host '$host'"
			if $hostdefs{$host}->{'machtype'} == undef;
	return $hostdefs{$host}->{'machtype'};
}

sub findserno {
	my $host = shift;
	die "$0: serial number not found for host '$host'"
			if $hostdefs{$host}->{'serno'} == undef;
	return $hostdefs{$host}->{'serno'};
}

my $cmd = 'telnet';				# connection command
my $start = 'FFFX';
my $hmchost = 'txhmc001';		# hmc host
my $host = shift;				# lpar to connect to
my $hmcport = 9735;				# port on the hmc
my $lparport = 9734;			# default telnet connection port for the lpars
my $lparno = findlpar($host);
my $machtype = findmachtype($host);
my $serno = findserno($host);
my $sesno = 1;

my $constrpart = join('*', $hmchost, $lparport, $lparno, $machtype,
			$serno, $sesno);
my $constr = $start . length($constrpart) . '*' . $constrpart;

print $constr, "\n";
my $stdin = Expect->exp_init(\*STDIN);
$stdin->manual_stty(1);

my $exp = new Expect;
$exp->slave->clone_winsize_from(\*STDIN);
$exp = Expect->spawn("$cmd $hmchost $hmcport")
		or die "Cannot spawn $cmd: $!\n";

# prepare for window resizing
$SIG{WINCH} = \&winch;

sub winch {
	$exp->slave->clone_winsize_from(\*STDIN);
	kill WINCH => $exp->pid if $exp->pid;
	$SIG{WINCH} = \&winch;
}

# wait for connection prompt
unless($exp->expect(30, 'scape')) {
	die "timeout waiting for connection string";
}
$exp->send($constr . "\n");

# wait for lpar connection
unless($exp->expect(30, 'ogin:')) {
	die "timeout waiting for lpar connection";
}

# make sure telnet is in character mode
$exp->send("\n");
unless($exp->expect(30, "mode character\n")) {
	die "timeout waiting for mode set conformation";
}
$exp->send("\n");

# turn control back to the user
$stdin->set_group($exp);
$exp->set_group($stdin);
Expect::interconnect($stdin, $exp);


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

Date: 26 Nov 2003 19:03:35 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Protecting Source code of a perl script
Message-Id: <u9y8u3c5q0.fsf@wcl-l.bham.ac.uk>

"Jürgen Exner" <jurgenex@hotmail.com> writes:

> ctcgag@hotmail.com wrote:
> > Is the administrator of the application also the administrator of the
> > machine on which the application runs?  How can an application be
> > considered secure if you don't trust the person who is in charge of
> > it?
> 
> Actually this is a very frequent scenario.

No it isn't.

> Or would you trust your personal medical files to the admin of the hospital
> computer?

Yes I do.  Are you perhaps confusing admin and operator?

Curious, when you are admitted to hospital how to they react to your
reuest to audit their IT infrastructure? 

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


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

Date: Wed, 26 Nov 2003 17:49:10 GMT
From: Alexander Stremitzer <stremitz@consultant.com>
Subject: Re: Regex matching question
Message-Id: <e43521fefba31e95ebe445f8a2c0c8f8@news.teranews.com>

Sam Holden wrote:

> On Tue, 25 Nov 2003 19:27:20 -0500,
> 	Alexander Stremitzer <stremitz@consultant.com> wrote:
> 
>>I want to be able to break a string into 2 parts. One part should be 
>>everything before "/", the second one everything after "/" or empty if 
>>there is no "/".
>>Here is some sample input data and what I would expect.
>>"SKULL"
>>    "SKULL",""
>>"SKULL /LEFT"
>>    "SKULL","LEFT"
>>"SKULL /FULL /LEFT"
>>    "SKULL","FULL /LEFT"
> 
> 
> Your data doesn't match you description. Everything before "/" includes
> the space but your sample data does not..
> 
> my ($string1, $string2) = split m|\s*/|, $full_desc, 2;
> 
You are correct, I overlooked the space. Sorry for my sloppy
description. Your solution does exactly what I wanted. Thanks.

I am not sure what the "split m|\s*/|" does compared to "split |\s*/|".
I was reading the paragraph below at
http://www.perl.com/pub/a/2002/06/04/apo5.html?page=9

But it's vitally important to understand this fundamental change, that
// is no longer a short form of m//, but rather a short form of rx//. If
you want to add modifiers to a //, you have to turn it into an rx//, not
an m//. It's now wrong to call split like this:

     split m/.../

(That is, it's wrong unless you actually want the return value of the
pattern match to be used as the literal split delimiter.)

> 
>>I have tried with pattern matching but can't get it to work. Any help is 
>>appreciated.
>>
>>$full_desc = "SKULL";
>>$full_desc =~ m/(\w*)\/(\w*)/;
>>print "string1: $1\n";
>>print "string2: $2\n";
> 
> 
> Clearly that regex requires a / character to appear in the string,
> violating your problem description. You should also never use $1 and $2
> (and the rest) variables unless you know the regex has succeeded.
> 
Appreciate the hint. It caused me to rewrite some of my existing code.

> And \w isn't what your description said: \w doesn't match "everything".
> And doesn't match '/' which your description sample data claims should
> be matched.
> 
Again correct. But I did not know how to match against evrything except
/. So I used \w as a first attempt.






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

Date: Wed, 26 Nov 2003 20:01:44 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Regex matching question
Message-Id: <bq30r8$eu5$3@wisteria.csv.warwick.ac.uk>


Alexander Stremitzer <stremitz@consultant.com> wrote:
> I am not sure what the "split m|\s*/|" does compared to "split |\s*/|".

'split |\s*/|' is a syntax error, 'split m|\s*/|' is not. :)

/.../ is equivalent to m/.../; this is *only* true if the delimiters
are //. See perldoc perlop "Quote and Quote-like Operators".

> I was reading the paragraph below at
> http://www.perl.com/pub/a/2002/06/04/apo5.html?page=9
> 
> But it's vitally important to understand this fundamental change, that
> // is no longer a short form of m//, but rather a short form of rx//. If
> you want to add modifiers to a //, you have to turn it into an rx//, not
> an m//. It's now wrong to call split like this:
> 
>      split m/.../
> 
> (That is, it's wrong unless you actually want the return value of the
> pattern match to be used as the literal split delimiter.)

Whoa there... this is about Perl6. Don't go reading that if you don't
understand Perl5 yet :). Perl6 is the next version of the Perl
language; a usable version of it is unlikely to be released for
several years.

What this is saying is that what in Perl5 (ie. current Perl) is
written

  split m|\s*/|

will in Perl6 be written

  split rx|\s*/|

 . But this does not need to concern you :).

> Again correct. But I did not know how to match against evrything except
> /. So I used \w as a first attempt.

The general answer to this is [^/] (a character class matching
everything except '/'); but this is not usually the answer you are
looking for. It is nearly always better to use .*? somewhere instead.

Ben

-- 
Musica Dei donum optimi, trahit homines, trahit deos.    |
Musica truces mollit animos, tristesque mentes erigit.   |   ben@morrow.me.uk
Musica vel ipsas arbores et horridas movet feras.        |


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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


------------------------------
End of Perl-Users Digest V10 Issue 5861
***************************************


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