[17320] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4742 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 27 09:42:59 2000

Date: Fri, 27 Oct 2000 06:05:08 -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: <972651908-v9-i4742@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 27 Oct 2000     Volume: 9 Number: 4742

Today's topics:
    Re: [Q] Newbie question imancer@my-deja.com
    Re: Changing a User's P/W on Win2K through browser <Peter.Dintelmann@dresdner-bank.com>
        Data::Walker Bug? <uackermann@orga.com>
    Re: does the CPAN shell work in win32? (CDM)
    Re: First steps <xerxes_2k@my-deja.com>
    Re: First steps (Bernard El-Hagin)
    Re: Hilfe zu Penguin (Michel Dalle)
        How can i find my ip? <nathangoing@yahoo.com>
    Re: How can i find my ip? (Bernard El-Hagin)
    Re: How can i find my ip? <nathangoing@yahoo.com>
    Re: How can I word wrap on STDOUT? <thunderbear@bigfoot.com>
    Re: How to open and read PDF file <graham.wood@iona.com>
    Re: How to output to printer <ra_jones@my-deja.com>
    Re: IBM AS/400 connectivity using Perl? (Csaba Raduly)
    Re: Matching and removing multiline block in perl 1-lin (Bernard El-Hagin)
        operators <sdoraira@vt.edu>
    Re: operators <graham.wood@iona.com>
        perlembed problems <hotrock@freenetname.co.uk>
    Re: Spaces to tab <abe@ztreet.demon.nl>
        stat / inode question <christelle.gilbergues@eed.ericsson.se>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 27 Oct 2000 12:43:05 GMT
From: imancer@my-deja.com
Subject: Re: [Q] Newbie question
Message-Id: <8tbt8o$fmb$1@nnrp1.deja.com>

In article <8t98j8$b56$1@nnrp1.deja.com>,
  bh <bh_ent@my-deja.com> wrote:
> Here is a snippet of code.  Please don't laugh too hard.  This doesn't
> work, but it should give you an idea of what I'm trying to accomplish.
>
> foreach my $server (@HOSTS) {
>     open((PASSWD),"/tmp/passwd.$server") || die "Cannot open passwd
> files: $!";
>     while (<PASSWD>) {
>       ($login, $uid) =(split /:/)[0,2];
>       $uid{$login} = $uid;
>     }
>     foreach $href{$_}(each (\%uid)) {
>       foreach %hreg(each (\%uid)) {
>         if (%href eq %hreg || %href = %hreg) {
>           %key_count=%href;
>         }
>       }
>     }
> }
>
> I'm trying to compare one key/value pair from the hash, against the
> entire hash to verify that if the key exists, it has the same value
> associated (ie, if the first key/value pair is root{0} then I want to
> verify that if another key of 'root' exists, that is has the value
> of '0'.  I also want to verify that all values of '0' share the same
> key, 'root' in this case).
>
> I know I'm not very good at explaining this, and I appreciate
> everyone's patience.  Sometimes I have to be dragged kicking and
> screaming into the light.  Thanks for the helping hand!
>
> Drew
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
I think the problem you're having is that, even though the uid/login
combinations are unique within each server, when you combine servers
there are duplicates.  In your snippet, when you're building your hash,
you're overwriting an entry in your hash whenever the same login
appears on another server, and you're losing information you need when
the UID is different on that other server.

You really need to keep track of three sets of values:  login, UID and
servername. A simple hash can only map one set to another set, so you
will need to combine some of your values or use a more complex
structure. But don't forget that whatever you choose for hash keys must
be unique. For example, you could combine login and servername to make
the keys, and use UID as the value.  I think that would be hard to
search.

My thought would be to use a more complex structure. I have two
suggestions. Number one, use login as the key to a hash.  The values
are references to secondary hashes, each of which uses servername as
the key and UID as the value.  So each login points to a list of the
servers where that login appears, associated with the UID for the login
on each server.

To find the logins with different UIDs on different servers, you go
through the main hash login by login and look for duplicate values in
the secondary hash for that login.  If there are duplicates you have
the servers that they appear on, but you have to do some searching to
find them since you don't have a mapping of UID to server.

Approach number two is a little more complex. Start with the same main
hash, but each value is a reference to a hash keyed by UID whose values
are references to arrays whose entries are the servers on which that
UID appears.  The bad logins would be ones which point to a secondary
hash with more than one key (more than one different UID).  Those extra
entries point to lists of server which have that different UID.  A
simple example
(With quotes, this would almost be a valid Perl expression to generate
the structure):

{John	=>	{1001	=>	[server1,     server2, server4]
 		},

 Mary	=>	{1003 =>	[server1, server3]
		 2005 =>	[server4]
		}
}

The main hash as two keys, logins 'John' and 'Mary'.

'John's value is reference to a hash with one key (1001), whose value
is a reference to an array of all the servers that John:1001 appears on.

'Mary's value is a reference to a hash with two keys (1003, 2005), each
of whose values is a reference to an array of the servers where each
login:UID combination appears.

Login John is OK - it refers to a hash with only one key (same UID
everywhere).

Login Mary has a problem - a consistent UID on servers 1 and 3, but a
different UID on server4.

In general, the logins with problems will refer to hashes with a number
of UIDs different from 1.  Now, if you also need to find the UIDs that
may have different logins associated on different servers,  you would
need to build a similar structure with login and UID  switched in the
hierarchy.

Either of these approaches would work for the initial task of
identifying the problem logins.  And you would get lots of great
practice dealing with references in Perl.

In the long run though, you probably want a database. You could just
have the three fields in each record.  Then you could use SQL queries
to identify instances of duplicates.  Once you're all cleaned up, just
keep the database up to date and you can easily find unused logins or
UIDs.


Roger


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


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

Date: Fri, 27 Oct 2000 13:57:48 +0200
From: "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com>
Subject: Re: Changing a User's P/W on Win2K through browser
Message-Id: <8tbqkd$ktn1@intranews.bank.dresdner.net>

    Hi,

Roland Corbet schrieb in Nachricht <39f84a83@news.myratech.net>...
>Does anyone know if it's possible to write a script that can be used to
>change a user's NT password, under Windows 2000.  The server is Win2K
>Advanced server, running the latest version of Active Perl.
>
>Maybe the script would need to log on as administrator, and change the
>users' password?

    right, that's by NT security.

    Use "system 'net', 'use', 'login', 'pwd';"
    But you do not need perl to do this :-)
    This works on NT4 (sorry no w2k available here).
    Check out the docu for w2k

    Best regards,

        Peter Dintelmann






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

Date: Fri, 27 Oct 2000 13:00:03 +0200
From: Ulrich Ackermann <uackermann@orga.com>
Subject: Data::Walker Bug?
Message-Id: <39F96033.217F4002@orga.com>

Hi all,
I am using Data::Walker in a skript and found a behaviour which might be
an error:
This is the way I am using the module:

#!/usr/bin/perl -w
use strict;
use Data::Walker;

my %hash;  # gets filled somewhere
    .
    .
    .

Data::Walker->cli(\%hash);

Whenever I am using my script without a commandline parameter everything
works fine (I can walk through the hash.
But if I use it with a commandline parameter, Data::Walker tries to walk
a data structure, which has the name of the commandline parameter, e.g.:

myscript.pl para1 para2
Can't open para1: File or directory not found at
/usr/local/lib/perl5/site_perl/5.6.0/Data/Walker.pm
Can't open para2: File or directory not found at
/usr/local/lib/perl5/site_perl/5.6.0/Data/Walker.pm

TIA

Ulrich
-- 
Ulrich Ackermann
ORGA Kartensysteme GmbH (SY-PEAT-STA)
Tel.:+49.5254.991-925 
mailto:uackermann@orga.com


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

Date: Fri, 27 Oct 2000 13:09:29 +0200
From: cdemaeyer1@mmm.com (CDM)
Subject: Re: does the CPAN shell work in win32?
Message-Id: <8tbohj$jjc$1@magnum.mmm.com>

Maybe a good idea is to have Cygwin installed so the GNU utilities (tar,
gzip, make) are available...

<pintihar@mail.com> wrote in message news:8t9ukt$up5$1@nnrp1.deja.com...
> It seems that there are many modules available in CPAN which are not
> available through ppm. Does anyone know how to get "perl -MCPAN -e
> shell" to work with activestate perl? (v5.6.0)
>
> thanks
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




Opinions expressed herein are my own and may not represent those of my employer.



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

Date: Fri, 27 Oct 2000 09:56:10 GMT
From: arse <xerxes_2k@my-deja.com>
Subject: Re: First steps
Message-Id: <8tbjfp$8m2$1@nnrp1.deja.com>

ooppps i #!/usr/bin/perl -w
arsearsearse
--
[][][]{}{}~~';:.<<//?|1¬!"£$$%^^&*(())__+/*+
oooh random characters i must be coool!


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


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

Date: 27 Oct 2000 10:11:17 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: First steps
Message-Id: <slrn8vil9d.28m.bernard.el-hagin@gdndev25.lido-tech>

On Fri, 27 Oct 2000 09:53:37 GMT, arse <xerxes_2k@my-deja.com> wrote:
>do you have ~!/usr/bin/perl -w

That should read:

#!/usr/bin/perl -w

Cheers,
Bernard
--
perl -le'
($B,$e,$r,$n,$a,$r,$d)=q=$B$e$r$n$a$r$d==~m;
\$(.);xg;print$B.$e.$r.$n.$a.$r.$d;'


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

Date: Fri, 27 Oct 2000 13:00:48 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Hilfe zu Penguin
Message-Id: <8tbud6$6th$2@news.mch.sbs.de>

In article <MPG.1462560259476984989682@news1.premium-news.de>, Lie Wynn <Buntaro@gmx.de> wrote:
>Hi Leute
>
>hat zufaellig einer eine Idee wo es zum Penguin Module fuer Perl ein 
>Tutorial oder etwas in der Art gibt. Ich hab zwar schon danach gesucht 
>aber leider nichts brauchbares gefunden.
>Fuer Hinweise gibt es zwar keine Belohnung baer ich hoffe es findet sicht 
>trozdem jemand ;-)
>
>By Leute

Penguin::Easy might be created for you :)

HTH,

Michel.


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

Date: Fri, 27 Oct 2000 12:08:32 +0200
From: "Nathan Going" <nathangoing@yahoo.com>
Subject: How can i find my ip?
Message-Id: <8tbk8f$fjl$1@lacerta.tiscalinet.it>

How do i discover my internet ip address?






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

Date: 27 Oct 2000 10:20:51 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: How can i find my ip?
Message-Id: <slrn8vilrb.28m.bernard.el-hagin@gdndev25.lido-tech>

On Fri, 27 Oct 2000 12:08:32 +0200, Nathan Going <nathangoing@yahoo.com>
wrote:
>How do i discover my internet ip address?

----------------------------------------------------
#!/usr/bin/perl

@this_is_not_a_Perl_question = qw (h o s t n a m e);
s//join '', @this_is_not_a_Perl_question, ' -i'/e;
print qx _$\__;
----------------------------------------------------

Cheers,
Bernard
--
perl -le'
($B,$e,$r,$n,$a,$r,$d)=q=$B$e$r$n$a$r$d==~m;
\$(.);xg;print$B.$e.$r.$n.$a.$r.$d;'


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

Date: Fri, 27 Oct 2000 14:38:40 +0200
From: "Nathan Going" <nathangoing@yahoo.com>
Subject: Re: How can i find my ip?
Message-Id: <8tbt0t$lar$1@lacerta.tiscalinet.it>

 USING PERL

"Bernard El-Hagin" <bernard.el-hagin@lido-tech.net> wrote in message
news:slrn8vilrb.28m.bernard.el-hagin@gdndev25.lido-tech...
> On Fri, 27 Oct 2000 12:08:32 +0200, Nathan Going <nathangoing@yahoo.com>
> wrote:
> >How do i discover my internet ip address?
>
> ----------------------------------------------------
> #!/usr/bin/perl
>
> @this_is_not_a_Perl_question = qw (h o s t n a m e);
> s//join '', @this_is_not_a_Perl_question, ' -i'/e;
> print qx _$\__;
> ----------------------------------------------------
>
> Cheers,
> Bernard
> --
> perl -le'
> ($B,$e,$r,$n,$a,$r,$d)=q=$B$e$r$n$a$r$d==~m;
> \$(.);xg;print$B.$e.$r.$n.$a.$r.$d;'




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

Date: Fri, 27 Oct 2000 14:56:01 +0200
From: =?iso-8859-1?Q?Thorbj=F8rn?= Ravn Andersen <thunderbear@bigfoot.com>
Subject: Re: How can I word wrap on STDOUT?
Message-Id: <39F97B61.468A4A36@bigfoot.com>

NP wrote:
> And that's a problem, not referring to "use CGI" in particular, but to
> the general "here, 'use blah blah'".

There comes a time when you have implemented enough wheels (and bugfixed
all of them), and would like to start doing more complicated stuff.

-- 
  Thorbjørn Ravn Andersen         "...plus...Tubular Bells!"
  http://bigfoot.com/~thunderbear


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

Date: Fri, 27 Oct 2000 10:29:08 +0100
From: "Graham Wood" <graham.wood@iona.com>
Subject: Re: How to open and read PDF file
Message-Id: <8tbid7$sll$1@bvweb.iona.com>

I was about to ask the same question.  I've had a look at the modules that
are available on CPAN and they mostly appear to read information about the
PDF file rather than the PDF file itself.

From Trevor's response I deduce that you should be able to use the CPAN
modules to discover which encryption and compression methods have been used
and then it's up to you to uncompress and decrypt the file into usable text.

Graham Wood

Trevor Ward <tward10@jaguar.com> wrote in message
news:8t8jt1$h9b12@eccws12.dearborn.ford.com...
>
> <shilong88@my-deja.com> wrote in message
news:8t6pki$a5m$1@nnrp1.deja.com...
> > Hi,
> >
> > I am new to Perl. I am doing a project which needs to open PDF format
> > file and read a title line of the file. Can anybody teach me how to do
> > it or tell me where can I find related information? Thanks in advance.
> >
> >   To which the answer is why ??????? bother that is.
>
>    Sorry being a little sceptical there. The answer to your question is
this
> is
>    possible if the PDF has not been encrypted or compressed which is
> standard
>    practice within PDF files.
>
>    If it is a plain text file you can just open the file as a normal text
> file and find the
>    specified data line which contains the title.
>
>    To find out the PDF file layout there is a technical manual on
> www.adobe.com
>    but it will take some investigation to a figure out if you have to
> uncompress the
>    data and then unencode the data.
>
>    Are well should be an interesting exercise though.
>
>
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
>




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

Date: Fri, 27 Oct 2000 11:00:36 GMT
From: ra jones <ra_jones@my-deja.com>
Subject: Re: How to output to printer
Message-Id: <8tbn8j$bbq$1@nnrp1.deja.com>

Josef Moellers <josef.moellers@fujitsu-siemens.com> wrote:

> Where exactly do you want to print? On the server side? In that case,
> the mentioned techniques will work (open OUTPUT '>LPT1:', pipe to lpr,
> use Net::Printer).
> If you want to print on the client side, you should realize that the
> Perl script runs on the server side and will produce HTML output. YOu
> would need to use something like Javascript to print on the client
side.

Josef,

I want to print on my local printer attached to my PC. The script is
producing a report displayed on my screen as HTML, which I can print in
the usual way by pressing the browsers 'Print' button, but I want to
bypass this stage and make the script print the report via my local
printer. Thanks for your help so far.


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


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

Date: Fri, 27 Oct 2000 09:37:45 +0000 (UTC)
From: real.email@signature.this.is.invalid (Csaba Raduly)
Subject: Re: IBM AS/400 connectivity using Perl?
Message-Id: <8FDA6A7E5quuxi@194.203.134.135>

A million monkeys weren't enough! It took mark.warnes@limecs.com
(Mark Warnes) on 26 Oct 2000 to produce
<xrTJ5.370$sE.4606@news6-win.server.ntlworld.com>: 

>Does anyone know of any modules or techniques for connecting to an
>IBM AS/400 system through Perl?
>
>I'd like to be able to access data on an AS/400 from a Perl script
>that I'm writing but can't think of any way to get the two to
>communicate. 
>

The OS on AS400 (OS400) is a BFD (big f**** database). It is^H^Hshould 
be possible to do SQL queries against it. Try to approach it from this 
side.

HTH,
-- 
Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
mailto:csaba.raduly@sophos.com      http://www.sophos.com/
US Support +1 888 SOPHOS 9      UK Support +44 1235 559933
Life is complex, with real and imaginary parts.


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

Date: 27 Oct 2000 10:54:32 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Matching and removing multiline block in perl 1-liner
Message-Id: <slrn8vinqg.28m.bernard.el-hagin@gdndev25.lido-tech>

On Fri, 27 Oct 2000 11:59:51 +0200, Jan Krag <jak@framfab.dk> wrote:
>Hi.
>
>I am having some problems making a small regexp work.
>I am trying to remove the following block of code:
>
>  <!-- PRINT_BLOCK - STATIC -->
>   <tr align="right" valign="top">
>    <td colspan="2"><a
>href="javascript:popUp('printUrl','pagePrint',584,500,'scrollbars');"
>class="dark"><img src="/opencms/content/internal/img/bn/bn_ic_print.gif"
>width="17" height="14" border="0" alt="Print" />Print</a></td>
>   </tr>
>  <!-- PRINT_BLOCK - STATIC -->
>
>
>
>(including the <!-- PRINT_BLOCK - STATIC --> comments)
>
>from a large number of files in a directory structure.
>
>I have attempted to use the following 1-liner in various (quite many)
>modifications:

[snip]

perl -i.orig -ne 'print unless
/<!-- PRINT_BLOCK - STATIC -->/g .. /<!-- PRINT_BLOCK - STATIC -->/g'
index.html

Didn't fit that on a line, but you get the idea.

>but it doesn't seem to want to match.
>
>(yes, It will finally be run on * instead of index.html only, but i want to
>see it work first :-)
>
>And while I am asking; Is there a smart commandline switch (that I have
>missed) that will make it work recursively in subdirectories?

Why not use find:

find /starting/dir -name "*.html" -print | xargs | perl -i.orig etc.

Cheers,
Bernard
--
perl -le'
($B,$e,$r,$n,$a,$r,$d)=q=$B$e$r$n$a$r$d==~m;
\$(.);xg;print$B.$e.$r.$n.$a.$r.$d;'


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

Date: Fri, 27 Oct 2000 12:14:11 GMT
From: Sundar <sdoraira@vt.edu>
Subject: operators
Message-Id: <8tbrif$ece$1@nnrp1.deja.com>

Could someone explain the following operators in the code below:
1. =~ (search, I think. Sort of like grep?)
2. s/^\d*\)\s*// (No idea!)
3. /^\d+/ (No idea!)

I'm not a Perl guy, so any help will be appreciated.

HTML code:
Name: <input type=text name="01)required-name" size=20><p>
Email: <input type=text name="02)required-user_email" size=20><p>
Political affiliation: <p>
<input type=radio name="03)political" value="Democrat"> Democrat<br>
<input type=radio name="03)political" value="Republican"> Republican<br>
<input type=radio name="03)political" value="Green"> Green<br>
<input type=radio name="03)political" value="Reform"> Reform<br>
<input type=radio name="03)political" value="Other"> Other
<input type=text name="04)otherpolitical" size=10>

PERL code:
foreach $key (sort(keys(%input))) {
  if ($key =~ /user_email/) {
    $user_email = "$input{$key}";
    $user_email =~ s/^\d*\)\s*//;
    $user_email =~ s/required-//;
  }
  unless ($key =~ /^\d+/) {
    next;
  }
  push (@sortedkeys, "$key|$input{$key}");
}

What I would like to do is to check if 04)otherpolitical is blank
conditional on the user selecting 03)political="Other".

Thanks.

--
Sundar Dorai-Raj
Department of Statistics
Virginia Tech
sdoraira@vt.edu


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


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

Date: Fri, 27 Oct 2000 13:50:24 +0100
From: "Graham Wood" <graham.wood@iona.com>
Subject: Re: operators
Message-Id: <8tbu6k$t3$1@bvweb.iona.com>

perldoc perlop will tell you these.

//  is the match operator which by default looks into $_ ("perldoc perlvar"
for details) the current input line.

s/// is the substitution operator which again uses the current input line $_
by default but can be made to point elsewhere by means of =~ (see below)

=~ is used to point the statement on the right of =~ at the variable or
expression on the left of =~.

Here's an example:

$string="Some text I wish to mess with";

if($string =~ /text/){ # if $string contains the characters "text"
    print "I found the string 'text' in dollar string\n";
}

$string =~ s/text/characters/; # substitute "text" with "characters" in
$string
if($string =~ /text/){
    print "I found the string 'text' in dollar string\n";
}
else{
    print "The string 'text' is not in dollar string\n";
}

Hope this helps

Graham Wood

Sundar <sdoraira@vt.edu> wrote in message
news:8tbrif$ece$1@nnrp1.deja.com...
> Could someone explain the following operators in the code below:
> 1. =~ (search, I think. Sort of like grep?)
> 2. s/^\d*\)\s*// (No idea!)
> 3. /^\d+/ (No idea!)
>
> I'm not a Perl guy, so any help will be appreciated.
>
> HTML code:
> Name: <input type=text name="01)required-name" size=20><p>
> Email: <input type=text name="02)required-user_email" size=20><p>
> Political affiliation: <p>
> <input type=radio name="03)political" value="Democrat"> Democrat<br>
> <input type=radio name="03)political" value="Republican"> Republican<br>
> <input type=radio name="03)political" value="Green"> Green<br>
> <input type=radio name="03)political" value="Reform"> Reform<br>
> <input type=radio name="03)political" value="Other"> Other
> <input type=text name="04)otherpolitical" size=10>
>
> PERL code:
> foreach $key (sort(keys(%input))) {
>   if ($key =~ /user_email/) {
>     $user_email = "$input{$key}";
>     $user_email =~ s/^\d*\)\s*//;
>     $user_email =~ s/required-//;
>   }
>   unless ($key =~ /^\d+/) {
>     next;
>   }
>   push (@sortedkeys, "$key|$input{$key}");
> }
>
> What I would like to do is to check if 04)otherpolitical is blank
> conditional on the user selecting 03)political="Other".
>
> Thanks.
>
> --
> Sundar Dorai-Raj
> Department of Statistics
> Virginia Tech
> sdoraira@vt.edu
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: Fri, 27 Oct 2000 13:10:33 +0100
From: dave frost <hotrock@freenetname.co.uk>
Subject: perlembed problems
Message-Id: <39F970B9.530B293C@freenetname.co.uk>

hi all,

I am working on a little peice of code that uses sn embedded perl
interpreter to run subroutines.  The problem is that that program also
uses the gtk libraries - i get the following warnings when compiling

 gcc -o rs.o run_sub.c `perl -MExtUtils::Embed -e ccopts -e
ldopts` `gtk-config --cflags --libs`
In file included from /usr/lib/perl5/5.00503/i386-linux/CORE/perl.h:367,

                 from run_sub.c:3:
/usr/include/sys/param.h:56: warning: `MIN' redefined
/usr/include/glib.h:126: warning: this is the location of the previous
definition
/usr/include/sys/param.h:57: warning: `MAX' redefined
/usr/include/glib.h:123: warning: this is the location of the previous
definition

id there anything i should be     really     worried about here - it
does still run and seems to be ok.  The main strange thang is that i
cannot compile any file that uses the perl into a standalone object file
for example, if i

#include <EXTERN.h>
#include <perl.h>

static PerlInterpreter *my_perl;

static void PerlPower(int a, int b)
{
             dSP;                            /* initialize stack
pointer      */
             ENTER;                          /* everything created after
here */
             SAVETMPS;                       /* ...is a temporary
variable.   */
             PUSHMARK(SP);                   /* remember the stack
pointer    */
             XPUSHs(sv_2mortal(newSViv(a))); /* push the base onto the
stack  */
             XPUSHs(sv_2mortal(newSViv(b))); /* push the exponent onto
stack  */
             PUTBACK;                      /* make local stack pointer
global */
             perl_call_pv("expo", G_SCALAR); /* call the
function             */
             SPAGAIN;                        /* refresh stack
pointer         */
                                           /* pop the return value from
stack */
             printf ("%d to the %dth power is %d.\n", a, b, POPi);
             PUTBACK;
             FREETMPS;                       /* free that return
value        */
             LEAVE;                       /* ...and the XPUSHed "mortal"
args.*/
}

which is taken straight out of the perlembed man page, and try to
compile with i get the following

gcc -o tpc.o test_pc.c `perl -MExtUtils::Embed -e ccopts -e
 ldopts`
/usr/lib/crt1.o: In function `_start':
/usr/lib/crt1.o(.text+0x18): undefined reference to `main'

which seems to say that i can only put the embedding code into the file
which has the main method in it.

Any help in understanding whats going on here would be much apreciated.

thanks

dave frost



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

Date: Fri, 27 Oct 2000 13:29:05 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Spaces to tab
Message-Id: <ffoivsketbq70ltgeptg3r4859aa3h73qi@4ax.com>

On Fri, 27 Oct 2000 05:41:22 GMT, equilibrium1@my-deja.com wrote:

> In article <8t7ghi$vlr$1@nnrp1.deja.com>,
>   equilibrium1@my-deja.com wrote:
> > I'm trying to come up with a regex pattern that will evaluate the
> space
> > at the beginning of the line up to the non-whitespace characters in
> > such a way that 4 spaces are converted to tab characters and any extra
> > space characters left over are converted to null.
> > So far I have this:
> > $line=~s/( {4}/\t/g;
> 
> I mis-stated my question; thank you all for replying, however. My
> intent was actually to convert every four spaces of whitespace at the
> beginning of the line such that 10 spaces=2 tab (two extra spaces
> eliminated), 7 spaces=1 tab,

	$line =~ s!^( +)!"\t" x (length($1)/4)!e;

>                              and any extraneous whitespace after the
> code portion of the line (save the newline character) be converted to
> null.

	$line =~ s!\s*?$!!;

-- 
Good luck,
Abe

##
perl -Mstrict -wle 'sub Just{&$_}sub another{&$_}sub Perl{&$_}sub hacker{&$_}$_=sub{(split /::/,(caller $^W)[3])[-$^W].$"};print@{[Just,another,Perl,hacker]}'


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

Date: Fri, 27 Oct 2000 12:11:52 +0200
From: Christelle Gibergues <christelle.gilbergues@eed.ericsson.se>
Subject: stat / inode question
Message-Id: <39F954E8.BBCC7CBC@eed.ericsson.se>

Dear all,

I am currently fighting with some silly software where hard-links are
used.
I want to find those hard links, so used stat to work out the inode
numbers. My problem is that the output of stat($file)[1] seems to be
different from that of a 'ls -i $file'. 
Actually, this difference seems to be constant, in that 
stat($file)[1] = (ls -i $file) +6
Example :

sun58:[qedchgi]/vobs/ppdc/cctools/src/script >  ls -li
/vobs/ppdc/spa_tools/spa_platform/export/man/man3/Tcl_Sleep.3
666713 -r--r-----   1 qedchgi  ppdc         5833 Oct 26 20:26
/vobs/ppdc/spa_tools/spa_platform/export/man/man3/Tcl_Sleep.3
sun58:[qedchgi]/vobs/ppdc/cctools/src/script > ls -li
/vobs/ppdc/spa_tools/spa_platform/export/man/man3/Tcl_GetChannel.3
 665993 -r--r-----   1 qedchgi  ppdc        26849 Oct 26 20:25
/vobs/ppdc/spa_tools/spa_platform/export/man/man3/Tcl_GetChannel.3
sun58:[qedchgi]/vobs/ppdc/cctools/src/script > ls -li
/vobs/ppdc/spa_tools/spa_platform/export/man/man3/Tk_NameToWindow.3
 667745 -r--r-----   1 qedchgi  ppdc         7918 Oct 26 19:39
/vobs/ppdc/spa_tools/spa_platform/export/man/man3/Tk_NameToWindow.3

Perl script output:

/vobs/ppdc/spa_tools/spa_platform/export/man/man3/Tk_NameToWindow.3
667751
/vobs/ppdc/spa_tools/spa_platform/export/man/man3/Tcl_GetChannel.3
665999
/vobs/ppdc/spa_tools/spa_platform/export/man/man3/Tcl_Sleep.3		666719

I'm real confused by this, and don't know which I should trust, stat or
ls -i.
Any ideas why it is different, and if it matters much?

TIA
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 4742
**************************************


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