Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Seekers of Perl Wisdom

( #479=superdoc: print w/replies, xml ) Need Help??

If you have a question on how to do something in Perl, or you need a Perl solution to an actual real-life problem, or you're unsure why something you've tried just isn't working... then this section is the place to ask. Post a new question!

However, you might consider asking in the chatterbox first (if you're a registered user). The response time tends to be quicker, and if it turns out that the problem/solutions are too much for the cb to handle, the kind monks will be sure to direct you here.

User Questions
Any reason NV is not marked as POK when accessed as string?
2 direct replies — Read more / Contribute
by vr
on Mar 23, 2017 at 07:22

    Just curious, not a 'problem' which requires solution. Maybe developers thought real numbers stringification is usually approximate, that's why? Or simply nobody cares?

    C:\>perl -MDevel::Peek -e "$x = 0.5; qq/$x/; Dump $x" SV = PVNV(0x38bb4) at 0xd217cc REFCNT = 1 FLAGS = (NOK,pNOK) IV = 0 NV = 0.5 PV = 0xd16014 "0.5"\0 CUR = 3 LEN = 28 C:\>perl -MDevel::Peek -e "$x = 0; qq/$x/; Dump $x" SV = PVIV(0xd200c4) at 0xd2685c REFCNT = 1 FLAGS = (IOK,POK,pIOK,pPOK) IV = 0 PV = 0xd16274 "0"\0 CUR = 1 LEN = 10

    Hence, 'double' is converted to string any time it is required. E.g.:

    use Benchmark qw/ cmpthese /; $x = 42.0; %h = (); cmpthese( -1, { F => sub { $h{ pack 'F', $x } = 1 }, s => sub { $h{ $x } = 1 }, });
    Rate s F s 344025/s -- -86% F 2490475/s 624% --

    I found that one my little application, which maintains kind of 'seen' hash, gets nice boost if hash keys are packed as above, instead of 'just used as they are'. Actually, keys are pixels coordinates, they became real numbers because library I use returns them so. Pixels are usually aplenty and hash is accessed a lot, therefore speed gain was significant. But of course it would be even faster if PV was added on first access and POK was set, i.e. without packing.

Parse string and extract word after specific pattern
2 direct replies — Read more / Contribute
by rinkish85
on Mar 23, 2017 at 06:49

    Hi, I need to parse the below string

    stash_ST1.2.3.4_1.ROLLBACK.check.20170228-101051.435944.txt

    I am intrested only in part ROLLBACK.check

    Basically I am looking at what appears after "ROLLBACK" in above string.

    for e.g in this case its "check" .... that could be any word string like check2, check3, migration1, migration2.

    Thank you. Please suggest.
Perl Script execution while system in locked.
1 direct reply — Read more / Contribute
by 9mohit2
on Mar 23, 2017 at 06:46
    Hi,

    Can someone guide me whether all Perl scripts can be executed via Task Scheduler when the system is in locked state. I faced some issue with the scripts involving Win32::OLE use.

    Anyone having experience in this thing??Please comment
Search hash keys using vakues from array
4 direct replies — Read more / Contribute
by AhmedABdo
on Mar 23, 2017 at 06:36

    Hi dear all
    Assuming I have this array and hash.
    My @array = qw(world today is nice);
    my %hash = (0 => "Hello", 1=> "world" , 2=> "today" , 3=> "is" , 4=> "nice" );
    I want to search thought the hash values using the array elements as values and then print the hash keys for each searched value from the array in a new array.
    It should print 1 for world, 2 for today, so on which will be saved in the new array
    I tried to use lookup with loop thought the array but it did not work.
    I used grep also, but did not hot what I want
    Any idea about how I can do it???
    Thanks in advance

SOAP sign more elements
No replies — Read more | Post response
by makita
on Mar 23, 2017 at 04:56
    Hello, does heve anybode experience how to create a signature of more elements via XML::Compile::WSS ::Signature? This is my code:
    my $wsa = XML::Compile::SOAP::WSA->new(version => '1.0'); my $wsdl = XML::Compile::WSDL11->new("some.wsdl"); my $wss = XML::Compile::SOAP::WSS->new(schema => $wsdl); my $cert_obj = Crypt::OpenSSL::X509->new_from_file($cert); my $token = XML::Compile::WSS::SecToken::X509v3->new ( certificate => + $cert_obj,); my $sig = $wss->signature( schema => $wsdl, token => $token, sign_types=>['wsa:Action','wsa:To', 'wsu:Timestamp', 'wsa: +MessageID','SOAP-ENV:Body'], signer=>DSIG_RSA_SHA1, public_key => $cert, private_key =>$cert_pk, );
    My problem is that only 'SOAP-ENV:Body' is always signed as default even i set more types. Inside of source code I've found more parameters like sign_when and sign_put. Don;t know how to use it and documentation is very poor
url get with string
2 direct replies — Read more / Contribute
by bigup401
on Mar 23, 2017 at 04:34

    why if i post like this it doesn't work

    $name = 'john'; my $req = HTTP::Request->new(GET => 'https://www.google.com/?name=$nam +e'); $req->content_type('application/json');

    but it works when no $name string in url

    my $req = HTTP::Request->new(GET => 'https://www.google.com/?name=john +'); $req->content_type('application/json');
Unable to connect to HTTPS servers
2 direct replies — Read more / Contribute
by prathap keerthipati
on Mar 23, 2017 at 02:57

    Hi Perl Monks,

    I have a perlscript which is connecting to urls and downloading the contents of that.The script we are running in unix environment connecting through the proxy server.For http urls it is running fine, but when i gave https url its throwing error like "500 cannot connect to url". I am using WWW::Mechanize module and LWP 6.04v in the script. Can anybody suggest the solution for this? and what are the possible ways to get 500 connection issue?

Scheduling Perl Tasks
3 direct replies — Read more / Contribute
by 9mohit2
on Mar 23, 2017 at 01:37

    Hi,
    I am planning to replace a automation tool with Perl scripts. So I have to schedule Perl scripts to run. There are two types of task one which are triggered via input mail another are to be run on a particular time and day of the week.

    I am planning to make a .bat file which calls the respective script to be scheduled using Windows Task Scheduler. Wanted suggestions from you guys as will it be a good idea can there be complexities like:

    - Scripts running in parallel can cause error by reading and writing from each other excels.
    - Will the scripts run even if the system is locked? It runs but Win32::OLE scripts stuck sometimes.

    Your suggestions will be great for me. Thanks.

User interface using drag and droop
3 direct replies — Read more / Contribute
by Anonymous Monk
on Mar 22, 2017 at 21:10

    How to create a box user interface, so when I drag and drop into the tool it will tell me the file meets my specifications or not. Thanks.

CPAN install module error
3 direct replies — Read more / Contribute
by staszeko
on Mar 22, 2017 at 20:47

    I have a problem downloading Perl module 'Log::Log4Perl' using CPAN on Linux CentOS.

    When I execute command
    # cpan -i Perl::Log4Perl

    I get error
    Can't locate object method "data" via package "CPAN::Modulelist" (perhaps you forgot to load "CPAN::Modulelist"?)

    I loaded newer indicies using command
    cpan> reload index

    then loaded CPAN.pm again
    cpan> reload cpan

    then removed entire directory '.cpan' including file 'Config.pm', but this did not solve the problem.

    I would much appreciate any pointers that could lead me to a successful resolution.

    cpan script version 1.03
    CPAN.pm version 1.7602

    Linux 2.6.18-308.13.1.el5PAE #1 SMP Thu Jul 26 06:08:24 EDT 2012 i686 i386 GNU/Linux


Add your question
Title:
Your question:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":


  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    [MidLifeXis]: Not for a few years yet. Kids in school :-)
    [LanX]: NQC
    [MidLifeXis]: Is there internet access up there on the lakes? If I moved there I would like to be able to fish :-D
    [LanX]: Not Quite Canada
    [Discipulus]: have you been fired?!?
    [LanX]: remote rules, I've been offered jobs in the US with the promise to stay outside
    [MidLifeXis]: Nope. Just looking around, as there are multiple culture and business changes in the area I am in.
    [MidLifeXis]: not yet, anyway. Who knows. Just do my best and whatever happens happens.
    [LanX]: should be even easier for you
    [Discipulus]: oh well we cant afford two monks fired in a day!

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (13)
    As of 2017-03-23 12:40 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Should Pluto Get Its Planethood Back?



      Results (286 votes). Check out past polls.