Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date ][Interchange by thread ]

[ic] IPC::Open2 inside GlobalSub



Hi,

I'm trying to encrypt some data using a globalsub and an external binary,
but somehow the $data isn't getting out to the $encrypt_cmd via "Writer"
handle.  This code runs perfectly fine on a perl script by itself...  I'm
not getting any errors and using the ::logDebug statements, the code is
being excuted and the $encrypt_cmd is being called.  I know this because
open2 returns a different process id everytime the code runs.  Could someone
shine some light on this?  Much appreciated.

GlobalSub <<EOS
sub encrypt_some_data {

    use FileHandle;
    use IPC::Open2;

    my $rec_data;
    my $pid = eval{
        open2(\*Reader, \*Writer, "$encrypt_cmd");
        Writer->autoflush;
        print Writer "$data";
        close(Writer);

        local($/) = undef;
        $rec_data = <Reader>;
        close(Reader);
    };
    return($rec_data);
}


_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users


Search for: Match: Format: Sort by: