[29077] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 321 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 10 18:10:08 2007

Date: Tue, 10 Apr 2007 15:09:12 -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           Tue, 10 Apr 2007     Volume: 11 Number: 321

Today's topics:
    Re: Absolute Path errors <hackeras@gmail.com>
    Re: Absolute Path errors <bik.mido@tiscalinet.it>
    Re: Absolute Path errors <hackeras@gmail.com>
        Collecting details from router, striping info, map and  <johngnub@COX.NET>
    Re: Collecting details from router, striping info, map  <glex_no-spam@qwest-spam-no.invalid>
    Re: LWP hangs yahavba@gmail.com
        Problem installing Test::Base <joliver@john-oliver.net>
    Re: Problems Binding Parameters for Stored Procedure <4i4ko_trevi4ko@hui.de>
    Re: Problems Binding Parameters for Stored Procedure <4i4ko_trevi4ko@hui.de>
    Re: Problems Binding Parameters for Stored Procedure <4i4ko_trevi4ko@hui.de>
        Regular expression <s@sm.com>
    Re: Regular expression <glex_no-spam@qwest-spam-no.invalid>
    Re: Regular expression <4i4ko_trevi4ko@hui.de>
    Re: Regular expression guillaume.carbonneau@gmail.com
    Re: Regular expression <s@sm.com>
    Re: Regular expression guillaume.carbonneau@gmail.com
        Using Modules once <googleAcct@screenlight.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 10 Apr 2007 13:13:39 -0700
From: "=?iso-8859-7?B?zd/q7/I=?=" <hackeras@gmail.com>
Subject: Re: Absolute Path errors
Message-Id: <1176236019.746817.290280@30g2000cwc.googlegroups.com>


=CF/=C7 Michele Dondi =DD=E3=F1=E1=F8=E5:
> On 10 Apr 2007 03:55:10 -0700, "?????" <hackeras@gmail.com> wrote:
>
> >Yes but when i used to sue the index.html pointing to index.pl all
> >paths i ahd were relative and all I/O functions like fillign an @array
> >with files or opening files used to work with, could be opened and
> >edited without me having to descrivr the full hdd locations.
> >
> >How was that possible back then?
>
> Apparently there was a 1 to 1 mapping between local paths and urls
> that gave you the impression you could *generally* use them in a
> completely intechangeable manner, which is not the case.

What do you mean by 1 to 1 mapping and what made ti change now?!

i only deleted the idnex.html file pointing to index.pl, that all and
i set DirectoryIndex index.html cgi-bin/index.pl



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

Date: Tue, 10 Apr 2007 22:59:37 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Absolute Path errors
Message-Id: <kkun13do516ou2ibetef6f3qovgengv8ts@4ax.com>

On 10 Apr 2007 13:13:39 -0700, "?????" <hackeras@gmail.com> wrote:

>What do you mean by 1 to 1 mapping and what made ti change now?!
>
>i only deleted the idnex.html file pointing to index.pl, that all and
>i set DirectoryIndex index.html cgi-bin/index.pl

What effect does the latter operation create?


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: 10 Apr 2007 14:27:29 -0700
From: "=?iso-8859-7?B?zd/q7/I=?=" <hackeras@gmail.com>
Subject: Re: Absolute Path errors
Message-Id: <1176240449.669111.97580@l30g2000cwa.googlegroups.com>


=CF/=C7 Michele Dondi =DD=E3=F1=E1=F8=E5:
> On 10 Apr 2007 13:13:39 -0700, "?????" <hackeras@gmail.com> wrote:
>
> >What do you mean by 1 to 1 mapping and what made ti change now?!
> >
> >i only deleted the idnex.html file pointing to index.pl, that all and
> >i set DirectoryIndex index.html cgi-bin/index.pl
>
> What effect does the latter operation create?

When a user asks for a webserver directory apache sees iftf there is
an index.html file there first, if its not it serves cgi-bin/index.pl
if it cant find it then it gives a dirr index.



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

Date: 10 Apr 2007 12:29:49 -0700
From: "johngnub" <johngnub@COX.NET>
Subject: Collecting details from router, striping info, map and regex. Example.
Message-Id: <1176233389.073768.96430@n76g2000hsh.googlegroups.com>

Silly, short, handy, Open View, perl that gets the snmp system
location, ( if set in the device ) from the host ( cisco in this
case ), use map and a regex to get from the word street to the end of
the data, the data is from the nexted back ticks, for the command
snmpget, an open view command in this case. I think @foo can be a
$foo, in this case.

(@foo) = map /street(.*)/, `snmpget myrouter.at.home.org
system.sysLocation.0` ;

PS: Here I have ( many ) of the routers with location as street 123
main. Thus street is
the regex.

2 cents JB



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

Date: Tue, 10 Apr 2007 15:45:27 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Collecting details from router, striping info, map and regex. Example.
Message-Id: <461bf767$0$496$815e3792@news.qwest.net>

johngnub wrote:
> Silly, short, handy, Open View, perl that gets the snmp system
> location, ( if set in the device ) from the host ( cisco in this
> case ), use map and a regex to get from the word street to the end of
> the data, the data is from the nexted back ticks, for the command
> snmpget, an open view command in this case. I think @foo can be a
> $foo, in this case.
> 
> (@foo) = map /street(.*)/, `snmpget myrouter.at.home.org
> system.sysLocation.0` ;
> 
> PS: Here I have ( many ) of the routers with location as street 123
> main. Thus street is the regex.

What exactly is your question?

There are a few SNMP modules on CPAN that might make things more efficient.


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

Date: 10 Apr 2007 13:20:57 -0700
From: yahavba@gmail.com
Subject: Re: LWP hangs
Message-Id: <1176236457.507909.250870@l30g2000cwa.googlegroups.com>

On Mar 28, 11:45 pm, nos...@geniegate.com (Jamie) wrote:
> In <1175088931.660927.71...@y66g2000hsf.googlegroups.com>,
> yaha...@gmail.com mentions:
>
> >On Mar 23, 3:32 am, nos...@geniegate.com (Jamie) wrote:
> >i've tried your solution, and i see that theGETactually receive the
> >correct URL. Afterwards, usually after fetching pages for 1-2 hours,
> >it hangs. I tried to use "alarm" of 60 seconds (and mapped SIG{ALRM}
> >to a subroutine of my own) but it didn't help, even ctrl-C doesn't
> >kill the process - only Task Manager kill.
>
> Does ithangon the exact URL each time? The ^C sort of baffles
> me. With UNIX, I would probably examine the process and see if it's
> taking a lot of memory (even then, ^C should work)
>
> >I'm thinking of another way of running theGETcommands in a seperate
> >process or thread, and then if i can't see the results of theGETin
> >the main process i will kill this thread, what do you think?
>
> I suppose that would work, or, fork a new process for each URL, wait
> and then process it, then fork another process each time you fetch
> a URL. The hack being, keep resource allocations in a child proc where
> they can be cleaned up on exit.
>
> Long running processes are sort of famous for memory leaks. (usually theyget
> progressively slower and slower and eventually just don't work / memory errors)
>
> The "right way" (IMO) is to find out whats happening though. (this can be
> really hard to do. Data::Dumper combined with UNIVERSAL::DESTROY will sometimes
> help, but.. it's just not easy)
>
> Doing a "fork()" is a cheap way around the problem, when the child process
> dies (at least with unix) the memory is reclaimed. It's more of a band-aid
> than a solution though. (useful if you need to do something you /know/ will
> take a lot of memory, it's the only way I know of to give it back when
> done)
>
> If it's practical, you might take just the part thatGET'sthe URL, without
> any other code, run that in a loop and see if it hangs. That might let
> you know if it's a problem withLWPor the rest of your code is doing
> something that doesn't cause a problem until theGET.
>
> I don't know enough about windows to understand the rest of the story,
> could be most anything.. sockets not being closed? handles? collecting
> a boatload of UserAgent objects some place?
>
> Jamie
> --http://www.geniegate.com                   Custom web programming
> Perl * Java * UNIX                        User Management Solutions

Hi Jamie,

I noticed that the perl process gets more and more memory (up to 300M
and more) over time. i did some investigation on the web and found out
that this might happen because the Mechanize object saves each visited
page so that the "back()" procedure will be possible. i know suspect
that this might cause the trouble - and not other issues. I'm trying
my best to find out how to overcome this - till now i haven't found
any way to disable this page saving.
did you came across such a behavior of mech?
since i'm logged in to the website, it's not reasonable for me to re-
create the object each time...
have to keep on thinking about it.
happy holiday and thanks!




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

Date: 10 Apr 2007 19:48:04 GMT
From: John Oliver <joliver@john-oliver.net>
Subject: Problem installing Test::Base
Message-Id: <slrnf1nqfk.mdp.joliver@ns.sdsitehosting.net>

[root@sdtvm07 perl]# rpmbuild --rebuild
perl-Test-Base-0.52-2.fc6.src.rpm
Installing perl-Test-Base-0.52-2.fc6.src.rpm
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.27092
+ umask 022
+ cd /usr/src/redhat/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /usr/src/redhat/BUILD
+ rm -rf Test-Base-0.52
+ /usr/bin/gzip -dc /usr/src/redhat/SOURCES/Test-Base-0.52.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd Test-Base-0.52
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chown -Rhf root .
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chgrp -Rhf root .
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.27092
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd Test-Base-0.52
+ LANG=C
+ export LANG
+ unset DISPLAY
+ /usr/bin/perl Makefile.PL INSTALLDIRS=vendor
Checking if your kit is complete...
Looks good
Writing Makefile for Test::Base
+ make
cp lib/Test/Base/Filter.pm blib/lib/Test/Base/Filter.pm
cp lib/Module/Install/TestBase.pm blib/lib/Module/Install/TestBase.pm
cp lib/Test/Base.pm blib/lib/Test/Base.pm
Manifying blib/man3/Module::Install::TestBase.3pm
Manifying blib/man3/Test::Base::Filter.3pm
Manifying blib/man3/Test::Base.3pm
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.88840
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd Test-Base-0.52
+ LANG=C
+ export LANG
+ unset DISPLAY
+ rm -rf /var/tmp/perl-Test-Base-0.52-2-root-root
+ make pure_install
PERL_INSTALL_ROOT=/var/tmp/perl-Test-Base-0.52-2-root-root
Installing
/var/tmp/perl-Test-Base-0.52-2-root-root/usr/lib/perl5/vendor_perl/5.8.5/Test/Base.pm
Installing
/var/tmp/perl-Test-Base-0.52-2-root-root/usr/lib/perl5/vendor_perl/5.8.5/Test/Base/Filter.pm
Installing
/var/tmp/perl-Test-Base-0.52-2-root-root/usr/lib/perl5/vendor_perl/5.8.5/Module/Install/TestBase.pm
Installing
/var/tmp/perl-Test-Base-0.52-2-root-root/usr/share/man/man3/Module::Install::TestBase.3pm
Installing
/var/tmp/perl-Test-Base-0.52-2-root-root/usr/share/man/man3/Test::Base.3pm
Installing
/var/tmp/perl-Test-Base-0.52-2-root-root/usr/share/man/man3/Test::Base::Filter.3pm
Writing
/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/auto/Test/Base/.packlist
+ find /var/tmp/perl-Test-Base-0.52-2-root-root -type f -name .packlist
-exec rm -f '{}' ';'
+ find /var/tmp/perl-Test-Base-0.52-2-root-root -depth -type d -exec
rmdir '{}' ';'
+ chmod -R u+rwX,go+rX,go-w /var/tmp/perl-Test-Base-0.52-2-root-root/usr
+ /usr/lib/rpm/find-debuginfo.sh /usr/src/redhat/BUILD/Test-Base-0.52
0 blocks
find: /var/tmp/perl-Test-Base-0.52-2-root-root/usr/lib/debug: No such
file or directory
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip
/usr/bin/objdump
Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.53881
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd Test-Base-0.52
+ make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/*.t
t/append.................ok
t/arguments..............ok
t/array..................ok
t/autoload...............ok
t/base64.................ok
t/blocks-scalar..........ok
t/blocks_grep............ok
t/chomp..................ok
t/chop...................ok
t/compact................ok
t/compile................ok
t/delimiters.............ok
t/description............ok
t/diff_is................NOK 1/3
#   Failed test 'little diff
# @@ -1,7 +1,7 @@
#  1..1
#  not ok 1 - little diff
#  \#   Failed test 'little diff'
# -\#   in /tmp/test-blocks-321 at line 3.
# +\#   at /tmp/test-blocks-321 line 3.
#  \#          got: 'a b c'
#  \#     expected: 'a b x'
#  \# Looks like you failed 1 test of 1.
# '
#   at t/diff_is.t line 16.
t/diff_is................NOK 2/3
#   Failed test 'big diff
# @@ -15,5 +15,5 @@
#  \#  four
#  \# +five
#  \# '
# -\#   in /tmp/test-blocks-321 at line 3.
# +\#   at /tmp/test-blocks-321 line 3.
#  \# Looks like you failed 1 test of 1.
# '
#   at t/diff_is.t line 16.
t/diff_is................NOK 3/3
#   Failed test 'diff with space - note: doesn't help point out the
extra space (yet)
# @@ -13,5 +13,5 @@
#  \# +two
#  \#  three
#  \# '
# -\#   in /tmp/test-blocks-321 at line 3.
# +\#   at /tmp/test-blocks-321 line 3.
#  \# Looks like you failed 1 test of 1.
# '
#   at t/diff_is.t line 16.
# Looks like you failed 3 tests of 3.
t/diff_is................dubious
        Test returned status 3 (wstat 768, 0x300)
DIED. FAILED tests 1-3
        Failed 3/3 tests, 0.00% okay
t/dumper.................ok
t/embed_perl.............ok
t/escape.................ok
t/eval...................ok
t/eval_all...............ok
t/eval_stderr............ok
t/eval_stdout............ok
t/export.................ok
t/filter_arguments.......ok
t/filter_delay...........ok
t/filter_functions.......ok
t/filters-append.........ok
t/filters................ok
t/filters_map............ok
t/first_block............ok
t/flatten................ok
t/get_url................skipped
        all skipped: Need to figure out network testing
t/hash...................ok
t/head...................ok
t/internals..............ok
t/is.....................ok
t/jit-run................ok
t/join-deep..............ok
t/join...................ok
t/last...................ok
t/late...................ok
t/lazy-filters...........ok
t/lines..................ok
t/list...................ok
t/main_filters...........ok
t/multi-level-inherit....ok
t/name...................ok
t/next...................ok
t/no_diff................ok
t/no_plan................ok
t/normalize..............ok
t/only-with-implicit.....ok
t/only...................ok
t/oo.....................ok
t/oo_run.................ok
t/parentheses............ok
t/prepend................ok
t/preserve-order.........ok
t/prototypes.............ok
t/quick-plan.............ok
t/quick_test.............ok
t/read_file..............ok
t/regexp.................ok
t/repeated-filters.......ok
t/require................ok
t/reserved_names.........ok
t/reverse-deep...........ok
t/reverse................ok
t/run-args...............ok
t/run_compare............ok
t/run_is.................ok
t/run_is_deeply..........ok
t/run_like...............ok
t/run_unlike.............ok
t/simple.................ok
t/skip...................ok
t/slice..................ok
t/sort-deep..............ok
t/sort...................ok
t/spec_file..............ok
t/spec_string............ok
t/split-deep.............ok
t/split-regexp...........ok
t/split..................ok
t/strict-warnings........ok
t/strict.................ok
t/subclass-autoclass.....ok
t/subclass-import........ok
t/subclass...............ok
t/subclass_late..........ok
        1/1 skipped: various reasons
t/tail...................ok
t/tie_output.............ok
t/trim...................ok
t/unchomp................ok
t/use-test-more..........ok
t/write_file.............ok
t/xxx....................ok
t/yaml...................ok
t/zero-blocks............ok
Failed Test Stat Wstat Total Fail  List of Failed
-------------------------------------------------------------------------------
t/diff_is.t    3   768     3    3  1-3
1 test and 1 subtest skipped.
Failed 1/98 test scripts. 3/423 subtests failed.
Files=98, Tests=423, 23 wallclock secs ( 4.70 cusr + 13.92 csys = 18.62
CPU)
Failed 1/98 test programs. 3/423 subtests failed.
make: *** [test_dynamic] Error 255
error: Bad exit status from /var/tmp/rpm-tmp.53881 (%check)


RPM build errors:
    user mockbuild does not exist - using root
    group mockbuild does not exist - using root
    user mockbuild does not exist - using root
    group mockbuild does not exist - using root
    Bad exit status from /var/tmp/rpm-tmp.53881 (%check)

-- 
* John Oliver                              http://www.john-oliver.net/ *


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

Date: Tue, 10 Apr 2007 20:48:24 +0200
From: 4i4ko Trevi4ko <4i4ko_trevi4ko@hui.de>
Subject: Re: Problems Binding Parameters for Stored Procedure
Message-Id: <pan.2007.04.10.18.48.21.945557@hui.de>

Hi!

I dont know what kind of problem this could be. You can try to make it
more generic:
my $statement = "exec spMyStoredProcedure 'somestring'";
my $sth = $dbh->prepare($statement);
if(!$sth->err) {
    $sth->execute();
    #go on with fetchrow_array......
} else {
  #error handling here

}

and inside of spMyStoredProcedure:
"SELECT value from foo WHERE col = @variable_containing_somestring"
or
"SELECT 'return_value:',value from foo WHERE col =
 @variable_containing_somestring"

then scan the output (collected through fetchrow_array) of
spMyStoredProcedure for the desired value from the SELECT. 


Best Regards

4i4ko Trevi4ko


On Tue, 10 Apr 2007 10:42:54 -0700, geoffrobinson wrote:

> I have a stored procedure I need to call and get a value back from an
> input/output parameter. The stored procedure is on a SQL Server 2005
> DB. The first parameter is a varchar parameter. The second is a inout
> variable which is returning a decimal value.
> 
> Via, SQL Server tools I would call it like this:
> exec spMyStoredProcedure 'some string', @varname OUTPUT
> 
> So after research and tinkering the best code I could come up with is:
> 
> my $var1;
> my $statement = "exec spMyStoredProcedure '?', ? OUTPUT";
> my $sth-> $dbh->prepare($statement);
> $sth->bind_param(1, "some string");
> $sth->bind_param_inout(2, \$var1, 50);
> $sth->execute();
> $sth->finish();
> 
> The above code is giving me an error that I "can't bind unknown
> placeholder '2'. I tried removing the quotes from the first question
> mark, and I got a different error. The statement could not be
> prepared.
> 
> If anyone has any insight into what is wrong, I would greatly
> appreciate any help you can give me.
> 
> thanks,
> Geoff



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

Date: Tue, 10 Apr 2007 21:49:56 +0200
From: 4i4ko Trevi4ko <4i4ko_trevi4ko@hui.de>
Subject: Re: Problems Binding Parameters for Stored Procedure
Message-Id: <pan.2007.04.10.19.49.55.237917@hui.de>

 ... or try so:
instead of:
$sth->bind_param(1, "some string");
this one:
$sth->bind_param(1, "'some string'");



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

Date: Tue, 10 Apr 2007 22:19:21 +0200
From: 4i4ko Trevi4ko <4i4ko_trevi4ko@hui.de>
Subject: Re: Problems Binding Parameters for Stored Procedure
Message-Id: <pan.2007.04.10.20.19.17.894487@hui.de>

another hint:

if you sql-script contains errors (more then one), DBD::ODBC saves in
$sth->errstr only the last produced error, in most cases: "The statement
could not be prepared."

To see/catch all produced errors, you must attach an error handler to
$dbh, like this (see POD documentation of DBI):

my $dbh = DBI->connect(here_comes_connection_string,
                                "user_name", "password_of_user",
                                { RaiseError => 0, AutoCommit => 1, PrintError => 0, PrintWarn => 0}
                                );

$dbh->{odbc_err_handler} = \&err_handler;

err_handler looks something like:
sub err_handler
{
    my($SQLState, $ErrorMessage, $NativeServerError) = @_;
    #$SQLState -- ODBC state, from driver
    #$ErrorMessage -- comes from server
    #$NativeServerError -- error number from db-server

    print "' number='.$NativeServerError.' state=ORIGSTATE
    odbc_state='.$SQLState.' text='.$ErrorMessage;
    # or do what you want here...

    return 1; #DBD::ODBC will not ignore the error, if 0 -- ignores error
}



But be aware: MSSQL returns on some operation codes, that looks for
DBD::ODBC like *errors* (on these *errors* err_handler will be invoked),
but these *errors* are de facto "informative messages". Examples: 
15338  -- thrown by sp_rename
15477 - thrown after renaming
15070 -- thrown from sp_recompile
Another error numbers (I dont remember what they mean...):
0
5021
5701
15472
15491
15492

This means: you must modify your err_handler so, that on some error codes
the return value 0 is.

Best Regards


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

Date: Tue, 10 Apr 2007 19:43:14 GMT
From: "sk" <s@sm.com>
Subject: Regular expression
Message-Id: <mNRSh.10061$Uf7.7193@edtnps89>

I m trying to add a extra keyword on a specific word in a html document
In the following document I want to put "My" in front of all the 
words"computer"
excluding the id for the stylesheet and name of image files.

<html>
    <head>
        <title>hello</titile>
    </head>
    <body>
        <div id="computer"> This is computer</div>
       <img src="images/computer.jpg" >Computer
    </body>
</html>
 




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

Date: Tue, 10 Apr 2007 15:41:25 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Regular expression
Message-Id: <461bf675$0$496$815e3792@news.qwest.net>

sk wrote:
> I m trying to add a extra keyword on a specific word in a html document
> In the following document I want to put "My" in front of all the 
> words"computer"
> excluding the id for the stylesheet and name of image files.
> 
> <html>
>     <head>
>         <title>hello</titile>
>     </head>
>     <body>
>         <div id="computer"> This is computer</div>
>        <img src="images/computer.jpg" >Computer
>     </body>
> </html>

s/\scomputer/ My computer/;


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

Date: Tue, 10 Apr 2007 22:43:33 +0200
From: 4i4ko Trevi4ko <4i4ko_trevi4ko@hui.de>
Subject: Re: Regular expression
Message-Id: <pan.2007.04.10.20.43.29.647075@hui.de>

On Tue, 10 Apr 2007 15:41:25 -0500, J. Gleixner wrote:

> sk wrote:
>> I m trying to add a extra keyword on a specific word in a html document
>> In the following document I want to put "My" in front of all the 
>> words"computer"
>> excluding the id for the stylesheet and name of image files.
>> 
>> <html>
>>     <head>
>>         <title>hello</titile>
>>     </head>
>>     <body>
>>         <div id="computer"> This is computer</div>
>>        <img src="images/computer.jpg" >Computer
>>     </body>
>> </html>
> 
> s/\scomputer/ My computer/;

will not work on:
<img src="images/computer.jpg" >Computer
                                


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

Date: 10 Apr 2007 14:17:36 -0700
From: guillaume.carbonneau@gmail.com
Subject: Re: Regular expression
Message-Id: <1176239856.616325.232850@j27g2000cwj.googlegroups.com>

On Apr 10, 4:43 pm, 4i4ko Trevi4ko <4i4ko_trevi...@hui.de> wrote:
> On Tue, 10 Apr 2007 15:41:25 -0500, J. Gleixner wrote:
> > sk wrote:
> >> I m trying to add a extra keyword on a specific word in a html document
> >> In the following document I want to put "My" in front of all the
> >> words"computer"
> >> excluding the id for the stylesheet and name of image files.
>
> >> <html>
> >>     <head>
> >>         <title>hello</titile>
> >>     </head>
> >>     <body>
> >>         <div id="computer"> This is computer</div>
> >>        <img src="images/computer.jpg" >Computer
> >>     </body>
> >> </html>
>
> > s/\scomputer/ My computer/;
>
> will not work on:
> <img src="images/computer.jpg" >Computer

I got it through 2 regular expressions. Maybe someone can help me
merge them together...

$string =~ s/(>.*)(computer)(.*<)/\1my \2\3/igms;
$string =~ s/(>.*)(computer)(.*<)/\1my \2\3/ig;



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

Date: Tue, 10 Apr 2007 21:22:40 GMT
From: "sk" <s@sm.com>
Subject: Re: Regular expression
Message-Id: <AeTSh.10076$Uf7.6720@edtnps89>


"J. Gleixner" <glex_no-spam@qwest-spam-no.invalid> wrote in message 
news:461bf675$0$496$815e3792@news.qwest.net...
> sk wrote:
>> I m trying to add a extra keyword on a specific word in a html document
>> In the following document I want to put "My" in front of all the 
>> words"computer"
>> excluding the id for the stylesheet and name of image files.
>>
>> <html>
>>     <head>
>>         <title>hello</titile>
>>     </head>
>>     <body>
>>         <div id="computer"> This is computer</div>
>>        <img src="images/computer.jpg" >Computer
>>     </body>
>> </html>
>
> s/\scomputer/ My computer/;

what is \s? a whole word? Is there another way to do this?
Sometimes i define the function name like "GetComputer".
 I want to be able to change to "GetMyComputer"




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

Date: 10 Apr 2007 14:30:50 -0700
From: guillaume.carbonneau@gmail.com
Subject: Re: Regular expression
Message-Id: <1176240650.836551.197310@e13g2000cwb.googlegroups.com>

On Apr 10, 5:22 pm, "sk" <s...@sm.com> wrote:
> "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid> wrote in message
>
> news:461bf675$0$496$815e3792@news.qwest.net...
>
>
>
> > sk wrote:
> >> I m trying to add a extra keyword on a specific word in a html document
> >> In the following document I want to put "My" in front of all the
> >> words"computer"
> >> excluding the id for the stylesheet and name of image files.
>
> >> <html>
> >>     <head>
> >>         <title>hello</titile>
> >>     </head>
> >>     <body>
> >>         <div id="computer"> This is computer</div>
> >>        <img src="images/computer.jpg" >Computer
> >>     </body>
> >> </html>
>
> > s/\scomputer/ My computer/;
>
> what is \s? a whole word? Is there another way to do this?
> Sometimes i define the function name like "GetComputer".
>  I want to be able to change to "GetMyComputer"

\s is whitespaces



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

Date: 10 Apr 2007 13:53:20 -0700
From: "Brian" <googleAcct@screenlight.com>
Subject: Using Modules once
Message-Id: <1176238400.258331.183950@j27g2000cwj.googlegroups.com>

Hi All-
  I am getting the hang of some Perl approaches to situations. But one
thing is bothering me. Perhaps this has been written about somewhere.
Pointers appreciated.

  Can you do something in general with a set of perl package files to
make it into a 'run once program' instead of installing it?

--

  Today, I want to use a set of files that reads Palm OS .pdb
databases. I will likely not ever look at this again, or perhaps once
more a long time from now. Although the author  seems to have done an
earnest job in making a very full set of packages, his namespace
choices were poor, in that he uses names like Mail, Raw and DateBook.
It looks to me like those files are going to be tossed into a flat
list in man and perl INC directories. That sounds unlucky.

  SO what I did was:

a) copy the source code for each package called out in the desired
final program, into a same source, but removing the 'use xxx' line.

b) did so for all the required packages in reverse order, so the final
program comes last, the most basic package is first.

  that seems to work, though I haven't poked at it much. please advise



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

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


Administrivia:

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

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

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

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

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


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


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